click image to see action
or click here
or click here
In computer and video games, spawning is the in-game creation of an entity, such as a player character or enemy. Respawning is the recreation of an entity after its death or destruction.
This is the code for the enemies (small planes coming from right side of screen) to respawn.
Next week I will post again where you the player can now shoot or fire the enemies.
onClipEvent(load)
{
function reset()
{
this._y = Math.random() * 300
this._x = 600
mySpeed = Math.ceil(Math.random()*6)+1
}
reset();
}
onClipEvent(enterFrame)
{
this._x-=mySpeed;
if(timer>=12)
{
var dir = Math.ceil(Math.random()*3)
timer = 0;
}
timer++
if(dir==1)
{
this._y+=3;
}
else if(dir==2)
{
this._y+=3;
}
if(this._x<-10)
{
reset();
}
}
This is the code for the enemies (small planes coming from right side of screen) to respawn.
Next week I will post again where you the player can now shoot or fire the enemies.
onClipEvent(load)
{
function reset()
{
this._y = Math.random() * 300
this._x = 600
mySpeed = Math.ceil(Math.random()*6)+1
}
reset();
}
onClipEvent(enterFrame)
{
this._x-=mySpeed;
if(timer>=12)
{
var dir = Math.ceil(Math.random()*3)
timer = 0;
}
timer++
if(dir==1)
{
this._y+=3;
}
else if(dir==2)
{
this._y+=3;
}
if(this._x<-10)
{
reset();
}
}
No comments:
Post a Comment