Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Update (GamePadData gamePadData, long deltaT)
- {
- frameTime += deltaT;
- if (frameTime > FRAME_DURATION) {
- frameTime = 0;
- if (pid == 1) {
- if ((gamePadData.Buttons & GamePadButtons.Left) != 0)
- {
- pos.X -= vel;
- currentDir = Direction.Left;
- activeFrame += 1;
- }
- if ((gamePadData.Buttons & GamePadButtons.Right) != 0)
- {
- pos.X += vel;
- currentDir = Direction.Right;
- activeFrame += 1;
- }
- if ((gamePadData.Buttons & GamePadButtons.Up) != 0)
- {
- pos.Y -= vel;
- currentDir = Direction.Up;
- activeFrame += 1;
- }
- if ((gamePadData.Buttons & GamePadButtons.Down) != 0)
- {
- pos.Y += vel;
- currentDir = Direction.Down;
- activeFrame += 1;
- }
- }
- if (pid == 2) {
- if ((gamePadData.Buttons & GamePadButtons.Square) != 0)
- {
- pos.X -= vel;
- currentDir = Direction.Left;
- activeFrame += 1;
- }
- if ((gamePadData.Buttons & GamePadButtons.Circle) != 0)
- {
- pos.X += vel;
- currentDir = Direction.Right;
- activeFrame += 1;
- }
- if ((gamePadData.Buttons & GamePadButtons.Triangle) != 0)
- {
- pos.Y -= vel;
- currentDir = Direction.Up;
- activeFrame += 1;
- }
- if ((gamePadData.Buttons & GamePadButtons.Cross) != 0)
- {
- pos.Y += vel;
- currentDir = Direction.Down;
- activeFrame += 1;
- }
- }
- if (activeFrame > 3)
- activeFrame = 0;
- sprite.Position = pos;
- //Keeping the sprite on screen
- Lock ();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement