public void Simulate(SpaceGame g)
 {
     timer--;
     loc += moving;
     if (timer <= 0)
     {
         g.Blast(this);
     }
 }
Esempio n. 2
0
        public override void Simulate(SpaceGame g)
        {
            prev.X = upperLeft.X;
            prev.Y = upperLeft.Y;
            // Had to grab this from the base class
            // because I want to do a check and cancel the way
            // I get the line from it for the current frame.
            // This prevents teleporting bullets from killing everything between teleportation spots.

            this.upperLeft += this.moving;
            if (upperLeft.X < 0)
            {
                upperLeft.X = g.ScreenDim.X;
                prev.X      = upperLeft.X;
                prev.Y      = upperLeft.Y;
            }
            if (upperLeft.X > g.ScreenDim.X)
            {
                upperLeft.X = 0;
                prev.X      = upperLeft.X;
                prev.Y      = upperLeft.Y;
            }
            if (upperLeft.Y < 0)
            {
                upperLeft.Y = g.ScreenDim.Y;
                prev.X      = upperLeft.X;
                prev.Y      = upperLeft.Y;
            }
            if (upperLeft.Y > g.ScreenDim.Y)
            {
                upperLeft.Y = 0;
                prev.X      = upperLeft.X;
                prev.Y      = upperLeft.Y;
            }
            timer--;
            if (timer <= 0)
            {
                g.Blast(this);
            }
            //MessageBox.Show("sim");
        }