Monday, April 25, 2011

MOON FIGHTER CODE

setup = function()
{

firing = false; // Is player firing?
fireRate = 10; // Frame delay between shots
enemyTime = 0; // Enemy creation timer
enemyRate = 30; // Frame delay between enemy waves
score = 0;
score_txt.text = score;
counter = 20; // Game time
counter_txt.text = counter;

ship.onMouseDown = function()
{
firing = true;
repeatTime = 0;
}

ship.onMouseUp = function()
{
firing = false;
}

ship.onEnterFrame = function()
{
this.destx = _xmouse;

var diffx = (this.destx - this._x)

this._x += diffx * .15;

if (firing && repeatTime == 0)
{
createProjectile("bullet", this._x,
this._y - 5, 0, -15);
}
repeatTime ++;
repeatTime %= fireRate;

if (enemyTime == 0)
{
var sx = Math.random() * 100 + 80;
createEnemy("bob", sx, -30);
createEnemy("bob", 200, -30);
createEnemy("bob", 400 - sx, -30);
}
enemyTime ++;
enemyTime %= 30;

}

doCounter = function()
{
counter--;
counter_txt.text = counter;

if (counter == 0)
{
delete ship.onEnterFrame;
delete bgscroller.onEnterFrame;
enemyLayer.removeMovieClip();
projectileLayer.removeMovieClip();
startButton._visible = true;
clearInterval(countID);
}
}

countID = setInterval(doCounter, 1000);

_root.createEmptyMovieClip("projectileLayer", 99);
projectileCount = 0;

_root.createEmptyMovieClip("enemyLayer", 98);
enemyCount = 0;

ship.swapDepths(100);
ship.gotoAndStop(1);

bgscroller.onEnterFrame = function()
{
if (this._y >= 500)
{
this._y = 0;
}
this._y+=5;
}
}


createProjectile = function(type, x, y, dx, dy)
{
var nm = "proj" + projectileCount;
projectileLayer.attachMovie(type, nm, projectileCount);
projectileLayer[nm]._x = x;
projectileLayer[nm]._y = y;
projectileLayer[nm].dx = dx;
projectileLayer[nm].dy = dy;

projectileLayer[nm].onEnterFrame = function()
{
this._x += this.dx;
this._y += this.dy;

if (this._y < 0) this.removeMovieClip();

for (var i = 0; i < 10; i++)
{
var enm = "enemy" + i;
if (this.hitTest(enemyLayer[enm]) && enemyLayer[enm]._currentframe == 1)
{
enemyLayer[enm].play();
score++;
score_txt.text = score;
this.removeMovieClip();
}
}
}

projectileCount ++;
projectileCount %= 10;

}

createEnemy = function(type, x, y)
{
var nm = "enemy" + enemyCount;
enemyLayer.attachMovie(type, nm, enemyCount);
enemyLayer[nm]._x = x;
enemyLayer[nm].xline = x;
enemyLayer[nm]._y = y;
enemyLayer[nm].dy = Math.random() * 3 + 10;
enemyLayer[nm].t = Math.random() * 6.28;

enemyLayer[nm].onEnterFrame = function()
{
this._x = this.xline + Math.sin(this.t) * 100;
this._y += this.dy;

this.t += 0.1;

if (this._currentframe == 1 && ship.hitTest(this._x, this._y, true))
{
counter = 1;
doCounter();
ship.play();
}

if (this._y > 500) this.removeMovieClip();
}

enemyCount ++;
enemyCount %= 10;
}

startButton.onRelease = function()
{
this._visible = false;
setup();
}

Thursday, April 21, 2011

WHACK - A - CAPSULE ASC code

titleScreen.onRelease = function()
{
this._visible = false;
startgame();
}

startgame = function()
{
for (var i = 0; i < 9; i++)
{
var nm = "m" + i;

_root[nm].onPress = function()
{
if (this._currentframe == 10)
{
this.play();
whacks++;
scoreDisplay.whack_txt.text = whacks;
doWhackAt(_xmouse, _ymouse);
}
}

_root[nm].onEnterFrame = function()
{
if (this._currentframe == 1)
{
if ((Math.random() * 100) < 1)
{
this.play();
}
}
else if (this._currentframe == 10)
{
if ((Math.random() * 100) < 10)
{
this.play();
}
}
}
}

whacks = 0;
scoreDisplay.whack_txt.text = whacks;
endTime = getTimer() + 30000;

_root.onEnterFrame = function()
{
var etime = endTime - getTimer();

if (etime <= 0)
{
scoreDisplay.time_txt.text = "Time Up";

for (var i = 0; i < 9; i++)
{
var nm = "m" + i;
delete _root[nm].onPress;
delete _root[nm].onEnterFrame;
_root[nm].stop();
delete _root.onEnterFrame;
}
}
else
{
scoreDisplay.time_txt.text = Math.ceil(etime / 1000) + " sec";
}
}
}

wcnt = 0;
doWhackAt = function(x, y)
{
var nm = "wc" + wcnt;
_root.attachMovie("whackSign", nm, wcnt + 99);
_root[nm]._x = x;
_root[nm]._y = y;
_root[nm]._xscale = _root[nm]._yscale = 60;

_root[nm].onEnterFrame = function()
{
this._alpha -= 10;
if (this._alpha <= 10)
{
delete this.onEnterFrame;
this.removeMovieClip();
}
}

wcnt++;
wcnt %= 5;
}

Wednesday, April 6, 2011

BLOCK BREAKER ACTIONSCRIPT CODE

function buildboard ()
{
_root.createEmptyMovieClip("board", 1);
board._x = 0;
board._y = 0;

grid = new Array();

bcnt = 0;
for (var j = 4; j < 9; j++)
{
grid[j] = new Array();
for (var i = 0; i < 10; i++)
{
var nm = "block_" + j + "_" + i;
board.attachMovie("block", nm, bcnt);
board[nm]._x = i * 32;
board[nm]._y = j * 16;

var btype = (j) % 4 + 1
board[nm].gotoAndStop(btype);
grid[j][i] = btype;

bcnt++;
}
}
}

paddle.onEnterFrame = function()
{
var xpos = _xmouse;
if (xpos > (320 - (this._width / 2)))
xpos = 320 - (this._width / 2);

if (xpos < (this._width / 2))
xpos = this._width / 2;

this._x = xpos;
}

fadercnt = 0;
function makeFader(x, y)
{
var nm = "fader" + fadercnt;
board.attachMovie("fader", nm, fadercnt + 9999);
board[nm]._x = x;
board[nm]._y = y;
score+=100;
score_txt.text = score;
fadercnt++;

if (fadercnt == bcnt)
{
Mouse.show();
lives_txt.text = "YOU WIN";
delete ball.onEnterFrame;
}
}

function ballAction()
{
this._x += this.dx;
this._y += this.dy;

if (this._x < 0)
{
this._x = 0;
this.dx *= -1;
}
if (this._x > 320)
{
this._x = 320;
this.dx *= -1;
}
if (this._y < 0)
{
this._y = 0;
this.dy *= -1;
}
if (this._y > 400)
{
// Lose a life
lives--;
lives_txt.text = lives;

if (lives == 0)
{
Mouse.show();
lives_txt.text = "GAME OVER";
delete ball.onEnterFrame;
}
else
{
this._x = 160;
this._y = 200;
this.dx = 0;
this.dy = 6;
}
}

if (this._y < paddle._y && (this._y + this.dy) > paddle._y && (this._x + this.dx) > paddle._x - 41 && (this._x + this.dx) < paddle._x + 41)
{
this.dy = -6;
this.dx = (this._x - paddle._x) / 5;
}

var grdx = Math.floor(this._x / 32);
var grdy = Math.floor(this._y / 16);
var ngrdx = Math.floor((this._x + this.dx) / 32);
var ngrdy = Math.floor((this._y + this.dy) / 16);

if (grid[grdy][ngrdx] > 0)
{
grid[grdy][ngrdx] = 0;
var bnm = "block_" + grdy + "_" + ngrdx;
board[bnm].removeMovieClip();
makeFader(ngrdx * 32, grdy * 16);
this.dx *= -1;
}

if (grid[ngrdy][grdx] > 0)
{
grid[ngrdy][grdx] = 0;
var bnm = "block_" + ngrdy + "_" + grdx;
board[bnm].removeMovieClip();
makeFader(grdx * 32, ngrdy * 16);
this.dy *= -1;
}
if (grid[ngrdy][ngrdx] > 0)
{
grid[ngrdy][ngrdx] = 0;
var bnm = "block_" + ngrdy + "_" + ngrdx;
board[bnm].removeMovieClip();
makeFader(ngrdx * 32, ngrdy * 16);
this.dy *= -1;
this.dx *= -1;
}
}

function startClick()
{
buildboard();
lives = 5;
score = 0;
score_txt.text = score;
lives_txt.text = lives;

ball.onEnterFrame = ballAction;
ball._x = 160;
ball._y = 200;
ball.dx = 0;
ball.dy = 6;

Mouse.hide();

}

startButton.addEventListener("click", startClick);

Sunday, February 20, 2011

2011 Nevada FBLA State Conference Info

Download the 2011 FBLA State Conference Info
Click here to download the PDF

Nevada Future Business Leaders of America and the Nevada Department of Education
are excited to invite your FBLA chapter to the 40th Annual Nevada FBLA State
Business Leadership Conference, April 25-27, 2011. The Grand Sierra Resort
will be the site of Nevada FBLA-PBL’s 40th State Business Leadership Conference!

Here's the cost for each FBLA member to attend:
2 Night Package: $205 Quad Occupancy

Important deadlines:
March 11 (RECEIPT DEADLINE):
• SBLC Registration forms due
• State Officer Application Deadline
• Home Site Testing RETURN RECEIPT Deadline for Accounting II,
Computer Applications, Database Design and Applications, Desktop
Publishing, Spreadsheet Applications, Word Processing I, and Word
Processing II

• Pre-Judged Materials Deadline for Future Business Leader, Job
Interview, Web Site Design, Digital Video Production, E-Business,
Desktop Application Programming, Computer Game & Simulation
Programming, Digital Design & Promotion, and Electronic Career
Portfolio
• Chapter Reports Deadline for American Enterprise Project, Business
Financial Plan, Business Plan, Community Service Project, Local
Chapter Annual Business Report, and Partnership with Business
Project
• National Business Honor Roll forms due
• Who’s Who deadline
• Chassey Ako Community Service forms due
• Erin Hackman NLC Scholarship Applications due
• Business Person of the Year nominations due
• Administrator of the Year nominations due
• Adviser of the Year nominations due

March 21 – April 8:
• Online Testing Period

April 25-27:
• State Business Leadership Conference!

Monday, October 11, 2010

STYLED TABLE WITH CSS - PROJECT #3

Hello everyone. Directions for the third project of the semester are here. 60 pts possible. Read carefully. Also, there is an extra credit opportunity on page 3.
DUE DATE IS FRIDAY, OCT. 15