Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Update(GameTime theGameTime)
- {
- Size.X = (int)Position.X;
- Size.Y = (int)Position.Y;
- base.Update(theGameTime, mSpeed, mDirection);
- if (Position.X + FrameSize > graphicsDevice.Viewport.Width)
- {
- Position.X = graphicsDevice.Viewport.Width - FrameSize;
- Position.Y += 50;
- if (mDirection.X == -1)
- {
- mDirection.X = 1;
- }
- else if (mDirection.X == 1)
- {
- mDirection.X = -1;
- }
- }
- if (Position.X < 0)
- {
- Position.X = 0;
- Position.Y += 50;
- if (mDirection.X == -1)
- {
- mDirection.X = 1;
- }
- else if (mDirection.X == 1)
- {
- mDirection.X = -1;
- }
- }
- if (Position.Y + Size.Height > graphicsDevice.Viewport.Height)
- {
- Position.Y = graphicsDevice.Viewport.Height - Size.Height;
- }
- if (Position.Y < 0)
- {
- Position.Y = 0;
- }
- FrameTimer += theGameTime.ElapsedGameTime;
- if (FrameTimer >= FrameLength)
- {
- FrameTimer = TimeSpan.Zero;
- FrameNum = (FrameNum + 1) % FRAME_COUNT;
- }
- if (FrameNum >= FRAME_COUNT)
- FrameNum = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement