All pastes #373812 Raw Edit

Mine

public text v1 · immutable
#373812 ·published 2007-02-27 00:55 UTC
rendered paste body
#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
#endregion

namespace pong
{
    class player
    {
        public bool pause;
        public bool play;
        public bool exit;
        public int playerPos;
        public void updatePos(gamestate state)
        {
            KeyboardState newState = Keyboard.GetState();
            //if (newState.IsKeyDown(Keys.A))
            //{
            //    if (playerPos > 1)
            //    {
            //        playerPos = playerPos - 10;
            //    }

            //}
            //if (newState.IsKeyDown(Keys.D))
            //{
            //    if (playerPos < 661)
            //    {
            //        playerPos = playerPos + 10;
            //    }

            //}

            //if (newState.IsKeyDown(Keys.Escape))
            //{
            //    exit = true;
            //}
            //if (newState.IsKeyDown(Keys.Enter))
            //{
            //    play = true;
            //}

            //if (newState.IsKeyDown(Keys.P))
            //{
            //    if (state != gamestate.pause)
            //    {
            //        pause = true;
            //    }
            //    else
            //        pause = false;
            //}
            if (GamePad.GetState(PlayerIndex.One).DPad.Left == ButtonState.Pressed)
           
            {
                if (playerPos > 1)
                {
                    playerPos = playerPos - 10;
                }

                if (GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed)
                {
                    if (playerPos < 661)
                    {
                        playerPos = playerPos + 10;
                    }

                }

                if (newState.IsKeyDown(Keys.Enter))
                {
                    play = true;
                }

                if (newState.IsKeyDown(Keys.P))
                {
                    if (state != gamestate.pause)
                    {
                        pause = true;
                    }
                    else
                        pause = false;

                }


            }
        }
    }
}