public override void LoadContent(ContentManager content) { _spriteBatch = new SpriteBatch(graphicsDevice); //_backgroundTexture = content.Load<Texture2D>("image/background"); _paddles = new Paddles( new[] { content.Load <Texture2D>("tile/l_paddle"), content.Load <Texture2D>("tile/r_paddle") }, graphicsDevice ); _ball = new Ball( content.Load <Texture2D>("tile/ball"), new[] { content.Load <SoundEffect>("sound/hit"), content.Load <SoundEffect>("sound/wall"), content.Load <SoundEffect>("sound/miss1"), content.Load <SoundEffect>("sound/miss2") }, graphicsDevice, content.Load <SpriteFont>("font/consolas_16") ); _debug = new Debug(content.Load <SpriteFont>("font/consolas_16"), graphicsDevice); _score = new Score( content.Load <SpriteFont>("font/consolas_32"), new[] { content.Load <SoundEffect>("sound/background"), content.Load <SoundEffect>("sound/winner") }, graphicsDevice ); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); /* life = Content.Load<Texture2D> ("spr_Life"); background = Content.Load<Texture2D> ("spr_Background"); Gamover = Content.Load<Texture2D>("spr_GameOver"); * player2wins= Content.Load<Texture2D> ("spr_P2wins") * player1wins= Content.Load<Texture2D> ("spr_P1wins") */ paddle = Content.Load<Texture2D> ("spr_paddle"); ball = Content.Load<Texture2D> ("spr_ball"); paddle1 = new Paddles(); velocity = 200; paddle1.position = new Vector2(0, GraphicsDevice.Viewport.Height / 2 - paddle.Height / 2); paddle1.velocity = velocity; paddle2 = new Paddles(); paddle2.position = new Vector2(GraphicsDevice.Viewport.Width - paddle.Width, GraphicsDevice.Viewport.Height / 2 - paddle.Height / 2); paddle2.velocity = velocity; Ball = new Ball(); Ball.position = new Vector2(GraphicsDevice.Viewport.Bounds.Width / 2 - ball.Width / 2, GraphicsDevice.Viewport.Bounds.Height / 2 - ball.Height / 2); Ball.velocity = velocity; gamestate = 0; acceleration = 1.07f; color = Color.White; angle = new Vector2(1,0); player1lives = 3; player2lives = 3; }
public void Reset() { _gameLoop.Stop(); Balls.Clear(); Paddles.Clear(); ScoreLeft = 0; ScoreRight = 0; }
public void GetAll() { Paddles.Clear(); SelectedPaddle = null; foreach (var item in context.GetAll()) { Paddles.Add(item); } }
// Start is called before the first frame update void Start() { bottomLeft = Camera.main.ScreenToWorldPoint(new Vector2(0, 0)); topRight = Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, Screen.height)); Instantiate(pong); Paddles paddle1 = Instantiate(paddles) as Paddles; Paddles paddle2 = Instantiate(paddles) as Paddles; paddle1.Init(true); //Player 1: right paddle2.Init(false); //Player 2: left }
public PongPlayer( IPlayerController player, Paddles position, IParticleEngine particleEngine, PlayerName playerName, Goal?goal = null, Paddles?statsPosition = null, PongPlayerState?state = null) { State = state ?? new PongPlayerState(); _statsPosition = statsPosition; State.Position = position; Paddle = new Paddle(player, particleEngine, State.PaddleState) { PlayerName = playerName, Speed = 300 }; Goal = goal ?? new Goal(State.GoalState); PlayerStats = new PlayerStats(State.StatsState); PlayerStats.State.PlayerName = playerName; }
private void _gameLoop_Process(object sender, EventArgs e) { Paddles.AsParallel().ForAll(p => p.Move()); Balls.AsParallel().ForAll(b => b.Move()); OnUpdated(); }
public void AddPaddle(Paddle.Side _side, bool isComputerControlled, int kinectUserId) { var x = new Paddle(_side, isComputerControlled, kinectUserId); Paddles.Add(x); }