actionscript para platillos

Creado a las // comentar

/*
The EnemyShip class is linked to an EnemyShip movie clip in the library that will get attached to stage.
*/

class EnemyShip extends MovieClip
{

//We want to create several varibles to keep track of important enemy information.
//We must define them here

//This will track the up and down motion of the enemy ship
var yDirection;
//This will define the horizontal speed of the enemy
var speed;
//This will keep track of how often the enemy shoots missiles
var shootTimer;

//This onLoad function is a built-in function of every movie clip.
//When an enemy is first loaded onto stage (it will get attached to the stage from the library) we want to do several things:
function onLoad()
{
//Decide randomly if this enemy will have any vertical motion
if(Math.random() < .4)
{
//If a random number between 0 and 1 is less than .4, give this enemy a vertical movement
yDirection = 1;
}
//or if it will just move straight across the screen
else
{
//if the random number was greater than .4 just set it's vertical mobility to zero
yDirection = 0;
}

//When created, position this enemy off the right edge of the screen
_x = 700;
//Give this enemy a random y position between 50 and 250 pixels
_y = Math.random()*200 + 50;
//Give this enemy a random speed between 3 and 6
speed = Math.random()*3 + 3;
//add this enemy to the heor ship's list of enemies, its enemy array
_root.ship.enemies.push(this);
//set the shoot timer to a random number between 1 and 60, to randomize when this enemy will shoot
shootTimer = Math.floor(Math.random()*60);

0 comentarios: