public void TickPlayer(long deltaTime, KeyWrapper wrapper) { if (Keyboard.GetState().IsKeyDown(Keys.W)) { VelY -= (1.1f + VelY) / 15; } if (Keyboard.GetState().IsKeyDown(Keys.S)) { VelY += (1.1f - VelY) / 15; } if (Keyboard.GetState().IsKeyDown(Keys.A)) { VelX -= (1.1f + VelX) / 15; } if (Keyboard.GetState().IsKeyDown(Keys.D)) { VelX += (1.1f - VelX) / 15; } if ((wrapper.State & KeyState.Space) > 0) { //DropBomb(X / 30, Y / 30); } //Lights[0].Rotation = (float)Math.Atan2(Mouse.GetState().Position.Y - Y * Map.TileWidth / Map.EntityPixelPerCase, // Mouse.GetState().Position.X - X * Map.TileWidth / Map.EntityPixelPerCase); }
public void TickPlayer(int idPlayer, GameTime gameTime, KeyWrapper wrapper) { if (!Joueur.IsDead) { Joueur.TickPlayer((int)gameTime.ElapsedGameTime.TotalMilliseconds, wrapper); } }
public JeuMenu() { StartTime = 0; Game1.Penumbra.Lights.Clear(); Game1.Penumbra.Hulls.Clear(); Game1.Penumbra.AmbientColor = Color.Black; _hud = new Hud(Game1.Screen); Map = new Map(45, Game1.Screen.ClientBounds); // m_Joueur = null; System.Random r = new System.Random(); Point p; bool ShouldRun = true; do { p = new Point(r.Next() % Map.Width, r.Next() % Map.Height); if (!Map[p.X, p.Y].IsSolid) { if (m_Joueur?.Weapon == null) { m_Joueur = new Joueur(p.X * Map.EntityPixelPerCase, p.Y * Map.EntityPixelPerCase, Map); ShouldRun = false; } else { /*Joueur tempJ = new Joueur(p.X * Map.EntityPixelPerCase, p.Y * Map.EntityPixelPerCase, Map); * for (int i = 0; i < m_Joueur.Weapon.Length; i++) * { * switch (m_Joueur.Weapon[i].WeaponType) * { * case WeaponType.Pistol: * tempJ.Weapon[i] = new Pistol(tempJ); * break; * case WeaponType.AssaultRifle: * tempJ.Weapon[i] = new AssaultRifle(tempJ); * break; * case WeaponType.Shotgun: * tempJ.Weapon[i] = new Shotgun(tempJ); * break; * case WeaponType.SemiAutoSniper: * tempJ.Weapon[i] = new SemiAutomaticSniper(tempJ); * break; * } * } * m_Joueur = tempJ;*/ ShouldRun = false; } } }while (ShouldRun); EntityManager.InitInstance(m_Joueur, Map, 0); /*Enemy e; * for (int i = 0; i < 10; i++) * Enemy e; * for (int i = 0; i < 10; i++) * { * * p = new Point(r.Next() % Map.Width, r.Next() % Map.Height); * if (!Map[p.X, p.Y].IsSolid) * { * e = new KamikazeRobot(p.X * Map.EntityPixelPerCase, p.Y * Map.EntityPixelPerCase, Map); * EntityManager.Instance.Add(e); * } * * * } */ _wrapper = new KeyWrapper(0, 0, 0); }