// overriding Tick to change the implementation from the inhireted from GameObject Class public override void Tick(float currentTime, float dt, GameLogic.AddNewObjectDelegate fnAddNew) { float deltaX = this.x - target.x; float deltaY = this.y - target.y; if (deltaX > 0.5) { x -= dt * enamyspeed; } else if (deltaX < -0.5) { x += dt * enamyspeed; } else if (deltaY > 0.5) { y -= dt * enamyspeed; } else if (deltaY < -0.5) { y += dt * enamyspeed; } float lasttime; lasttime = currentTime - lastfireballtime; if (lasttime > 1) { fnAddNew(new Fireball(this.x, this.y)); lastfireballtime = currentTime; } }
// implementing the overrde Tick function from the GameObject class public override void Tick(float currentTime, float dt, GameLogic.AddNewObjectDelegate fnAddNew) { if (this.left) { x -= dt * playerspeed; } if (this.right) { x += dt * playerspeed; } if (this.up) { y -= dt * playerspeed; } if (this.down) { y += dt * playerspeed; } // tasl 1) if (this.space) { Fireball newfireball = new Fireball(this.x, this.y, this); fnAddNew(newfireball); } }
public override void Tick(float currentTime, float dt, GameLogic.AddNewObjectDelegate fnAddNew) { int fireBallSpeed; fireBallSpeed = 100; x += dt * fireBallSpeed; }
public override PlayerObject setupLevel(GameLogic.AddNewObjectDelegate addNew) { PlayerObject player = new PlayerObject(); addNew(new Enemy(player, null)); return(player); }
// implementing the overrde Tick function from the GameObject class public override void Tick(float currentTime, float dt, GameLogic.AddNewObjectDelegate fnAddNew) { if (this.left) { x -= dt * playerspeed; } if (this.right) { x += dt * playerspeed; } if (this.up) { y -= dt * playerspeed; } if (this.down) { y += dt * playerspeed; } }
public override void Tick(float currentTime, float dt, GameLogic.AddNewObjectDelegate fnAddNew) { }
public abstract void Tick(float currentTime, float dt, GameLogic.AddNewObjectDelegate fnAddNew);
public abstract PlayerObject setupLevel(GameLogic.AddNewObjectDelegate addNew);