コード例 #1
0
        // 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;
            }
        }
コード例 #2
0
        // 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);
            }
        }
コード例 #3
0
        public override void Tick(float currentTime, float dt, GameLogic.AddNewObjectDelegate fnAddNew)
        {
            int fireBallSpeed;

            fireBallSpeed = 100;

            x += dt * fireBallSpeed;
        }
コード例 #4
0
        public override PlayerObject setupLevel(GameLogic.AddNewObjectDelegate addNew)
        {
            PlayerObject player = new PlayerObject();

            addNew(new Enemy(player, null));

            return(player);
        }
コード例 #5
0
 // 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;
     }
 }
コード例 #6
0
 public override void Tick(float currentTime, float dt, GameLogic.AddNewObjectDelegate fnAddNew)
 {
 }
コード例 #7
0
 public abstract void Tick(float currentTime, float dt, GameLogic.AddNewObjectDelegate fnAddNew);
コード例 #8
0
 public abstract PlayerObject setupLevel(GameLogic.AddNewObjectDelegate addNew);