The code below has yet to be debugged.
package
{
public class GoatEnemy
{
private var health:int;
private var hspeed:int;
private var vspeed:int;
private var image:MovieClip;
private var x:int;
private var y:int;
public function GoatEnemy(iniHealth:int,iniImage:MovieClip,iniX:int,iniY:int)
{
health = iniHealth;
hspeed = 0;
vspeed = 0;
image = iniImage;
x = iniX;
y = iniY;
}
public function GoatEnemy()
{
this(10,null,0,0);
}
public function update():void
{
x += hspeed;
y += vspeed;
image.x = x;
image.y = y;
}
public function damage(dmg:int):void
{
health = health - dmg;
}
public function getHealth():int
{
return health;
}
public function setImage(nImage:MovieClip):void
{
image = nImage;
}
public function getImage():MovieClip
{
return image;
}
public function setLoc(nLoc:Point):void
{
x = nLoc.x;
y = nLoc.y;
}
public function getX():int
{
return x;
}
public function getY():int
{
return y;
}
}
}
package
{
public class GoatTurret
{
private var image:MovieClip;
private var x:int;
private var y:int;
public function GoatTurret(iniImage:MovieClip,iniX:int,iniY:int)
{
image = iniImage;
x = iniX;
y = iniY;
}
public function GoatTurret()
{
this(null,0,0);
}
public function update():void
{
//Nothing for now
}
public function setImage(nImage:MovieClip):void
{
image = nImage;
}
public function getImage():MovieClip
{
return image;
}
public function setLoc(nLoc:Point):void
{
x = nLoc.x;
y = nLoc.y;
}
public function getX():int
{
return x;
}
public function getY():int
{
return y;
}
}
}
No comments:
Post a Comment