Exemplo n.º 1
0
 public StarmanSprite(int positionX, int positionY, StarmanFrame starmanFrame)
 {
     Location     = new Vector2(positionX, positionY);
     WidthHeight  = new Vector2(ItemSpriteFactory.ITEM_WIDTH, ItemSpriteFactory.ITEM_HEIGHT);
     Boundary     = new Rectangle((int)Location.X, (int)Location.Y, (int)WidthHeight.X, (int)WidthHeight.Y);
     frame        = starmanFrame;
     currentFrame = ItemSpriteFactory.Starman(frame);
     EntityType   = TileMapInterpreter.Entities.STAR;
     IsBounded    = false;
 }
Exemplo n.º 2
0
        public static Rectangle Starman(StarmanFrame frame)
        {
            Rectangle rectangle = new Rectangle();

            if (frame == StarmanFrame.FirstFrame)
            {
                rectangle = new Rectangle(0, ITEM_HEIGHT * 3, ITEM_WIDTH, ITEM_HEIGHT);
            }
            else if (frame == StarmanFrame.Flash1)
            {
                rectangle = new Rectangle(ITEM_WIDTH, ITEM_HEIGHT * 3, ITEM_WIDTH, ITEM_HEIGHT);
            }
            else if (frame == StarmanFrame.Flash2)
            {
                rectangle = new Rectangle(ITEM_WIDTH * 2, ITEM_HEIGHT * 3, ITEM_WIDTH, ITEM_HEIGHT);
            }
            else if (frame == StarmanFrame.Flash3)
            {
                rectangle = new Rectangle(ITEM_WIDTH * 3, ITEM_HEIGHT * 3, ITEM_WIDTH, ITEM_HEIGHT);
            }

            return(rectangle);
        }
Exemplo n.º 3
0
 public void Update(GameTime gameTime)
 {
     elapsedFrames += (float)gameTime.ElapsedGameTime.TotalSeconds * 60;
     if (WasHit)
     {
         if (elapsedFrames > 5)
         {
             WasHit        = false;
             elapsedFrames = 0;
         }
     }
     if (elapsedFrames > 5 && frame == StarmanFrame.FirstFrame)
     {
         frame         = StarmanFrame.Flash1;
         currentFrame  = ItemSpriteFactory.Starman(frame);
         elapsedFrames = 0;
     }
     else if (elapsedFrames > 5 && frame == StarmanFrame.Flash1)
     {
         frame         = StarmanFrame.Flash2;
         currentFrame  = ItemSpriteFactory.Starman(frame);
         elapsedFrames = 0;
     }
     else if (elapsedFrames > 5 && frame == StarmanFrame.Flash2)
     {
         frame         = StarmanFrame.Flash3;
         currentFrame  = ItemSpriteFactory.Starman(frame);
         elapsedFrames = 0;
     }
     else if (elapsedFrames > 5 && frame == StarmanFrame.Flash3)
     {
         frame         = StarmanFrame.FirstFrame;
         currentFrame  = ItemSpriteFactory.Starman(frame);
         elapsedFrames = 0;
     }
 }