public PlayerUI( RoundUI roundUIContext, int levelTexture, int nbSprite, int spriteWidth, int spriteHeight, Vector playerPlace, uint mapWidth, uint mapHeight, Map ctxMap ) { _roundUIContext = roundUIContext; _player = _roundUIContext.RoundHandlerContext.RoundObject.Player; this._playerTexture = new Texture("../../../../Images/sprite_panda_lv" + levelTexture.ToString() + ".png"); this._playerSprite = new Sprite(_playerTexture); this._nbSprite = nbSprite; this._spriteWidth = spriteWidth; this._spriteHeight = spriteHeight; this._playerSprite.Position = new Vector2f((float)playerPlace.X * (mapWidth / 2), (float)playerPlace.Y * (mapHeight / 2)); _animFrames = 0; // Basically, the player is not moving _direction = 2; _animStop = 0; _ctxMap = ctxMap; _hitBoxPlayer = _playerSprite.GetGlobalBounds(); }
public InputHandler(RoundUI roundUIContext) { _roundUIContext = roundUIContext; _bulletTexture = new Texture("../../../../Images/fireball.png"); _bulletSound = new Music("../../../../Images/" + _roundUIContext.RoundHandlerContext.RoundObject.Player.CurrentWeapon.Name + "bullet.ogg"); _zawarudo = new Music("../../../../Images/ZA WARUDO.ogg"); _shoot = false; putPortal = 0; }
public override void Initialize() { gameOver = new GameOver(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT, _gameHandlerCtx); if (gameOver.ReturnOrNot == false) { gameOver = new GameOver(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT, _gameHandlerCtx); menu.OpenGame(Window); } _view = new View(new FloatRect(0, 0, DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT)); _viewATH = new View(Window.GetView()); _roundUI = new RoundUI(_gameHandlerCtx, this, 3168, 3168, _gameHandlerCtx.Map, DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT, _view, _viewATH); _playerInput = new InputHandler(_roundUI); _camera = new Camera(); //_view.Zoom(4f); _mainMusic.Play(); _mainMusic.Loop = true; }
public WeaponUI(RoundUI roundUIContext, Texture weaponTexture, Texture bulletTexture, Vector weaponPlace, uint mapWidth, uint mapHeight) { _roundUIContext = roundUIContext; _weaponTexture = new Texture("../../../../Images/" + this._roundUIContext.RoundHandlerContext.RoundObject.Player.CurrentWeapon.Name + ".png"); _weaponSprite = new Sprite(_weaponTexture); _bulletTexture = bulletTexture; _bulletSprite = new Sprite(_bulletTexture); _nbSprite = 3; _animFrames = 0; // Basically, the player is not moving _direction = 2; _animStop = 0; _weaponSprite.Position = new Vector2f(((float)_roundUIContext.RoundHandlerContext.RoundObject.Player.Place.X + 3) * (mapWidth / 2), (float)_roundUIContext.RoundHandlerContext.RoundObject.Player.Place.Y * (mapHeight / 2)); _bulletBoundingBox = new List <FloatRect>(); _bossBulletBoundingBox = new List <FloatRect>(); }
//Color colorCharacters = new Color(255, 255, 255, 255); public EnemiesUI(RoundUI roundUIContext, Texture texture, int nbSprite, int spriteWidth, int spriteHeight, Enemies enemy, uint mapWidth, uint mapHeight, Map ctxMap) { _roundUIContext = roundUIContext; _enemy = enemy; this._enemyTexture = texture; this._enemySprite = new Sprite(texture); this._nbSprite = nbSprite; this._spriteWidth = spriteWidth; this._spriteHeight = spriteHeight; this._enemySprite.Position = new Vector2f((float)enemy.Place.X * (mapWidth / 2), (float)enemy.Place.Y * (mapHeight / 2)); _animStop = 0; _animFrames = 0; // Basically, the player is not moving _direction = 0; _ctxMap = ctxMap; _hitBoxEnnemi = _enemySprite.GetGlobalBounds(); }
public override void Update(GameTime gameTime) { if (_gameHandlerCtx.RoundObject.GameState == true) { gameOver = new GameOver(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT, _gameHandlerCtx); Window.Clear(); _roundUI.EffectMusic.Stop(); this.MusicMain.Stop(); if (_gameHandlerCtx.RoundObject.GameWin == true) { gameOver.WinGame(Window, this, menu, _gameHandlerCtx); } else { gameOver.EndGame(Window, this, menu, _gameHandlerCtx); } Window.Clear(); } _gameHandlerCtx.RoundObject.Update(); if (_gameHandlerCtx.HasLeft == true) { _roundUI.EffectMusic.Stop(); this.MusicMain.Stop(); this.MusicMain = new Music("../../../../Images/stage" + _gameHandlerCtx.RoundObject.Level + "-" + _gameHandlerCtx.RoundObject.Stage + "OST.ogg"); this.MusicMain.Play(); _mainMusic.Loop = true; _roundUI = new RoundUI(_gameHandlerCtx, this, 3168, 3168, _gameHandlerCtx.Map, DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT, _view, _viewATH); _playerInput = new InputHandler(_roundUI); _gameHandlerCtx.HasLeft = false; } _camera.CameraPlayerUpdate(_roundUI.PlayerUI.PlayerPosition.X, _roundUI.PlayerUI.PlayerPosition.Y, 3168, 3168, _view); _playerInput.Handle(); _roundUI.Update(); }
public ATH(Round Context, float width, float height, View View, RoundUI ctxUI) { _ctx = Context; _ctxUI = ctxUI; _life = _ctx.Player.LifePlayer; _ammo = _ctx.Player.CurrentWeapon.Ammo; _lvl = _ctx.Player.Level; _galaxCoin = _ctx.Player.Points; _xp = _ctx.Player.Experience; _effect = _ctx.Player.Effect; _level = _ctx.Level; _stage = _ctx.Stage; _athLifeBar = new Texture("../../../../Images/HUD/LifeBar.png"); _athLifeSprite = new Sprite(_athLifeBar); _athGun = new Texture("../../../../Images/HUD/" + this._ctx.Player.CurrentWeapon.Name + ".png"); _athGunSprite = new Sprite(_athGun); _athBossLifeBar = new Texture("../../../../Images/HUD/boss.png"); _athBossBarsprite = new Sprite(_athBossLifeBar); _HPbar = new RectangleShape(new Vector2f(271, 40)); _HPbar.FillColor = _couleur; _XPbar = new RectangleShape(new Vector2f(271, 30)); _XPbar.FillColor = Color.Blue; _HPboss = new RectangleShape(new Vector2f(300, 40)); _HPboss.FillColor = _couleur; Text LifeBar = new Text { Font = _font, Color = Color.White, }; _athList.Add(LifeBar); Text AmmoBar = new Text { Font = _font, Color = Color.White, }; _athList.Add(AmmoBar); Text GalaxCoinBar = new Text { Font = _font, Color = Color.Green, DisplayedString = "Points:" + _galaxCoin.ToString(), }; _athList.Add(GalaxCoinBar); Text LvlBar = new Text { Font = _font, Color = Color.White, DisplayedString = "Lvl: " + _lvl.ToString(), }; _athList.Add(LvlBar); Text XPBar = new Text { Font = _font, Color = Color.White, DisplayedString = "XP: " + _xp.ToString(), CharacterSize = 25 }; _athList.Add(XPBar); Text EffectBar = new Text { Font = _font, Color = Color.White, DisplayedString = "Effect: " + _effect, CharacterSize = 25 }; _athList.Add(EffectBar); Text StageBar = new Text { Font = _font, Color = Color.White, DisplayedString = "Stage: " + _stage.ToString() + "-" + _level.ToString(), CharacterSize = 40 }; _athList.Add(StageBar); Text PackageBar = new Text { Font = _font, Color = Color.White, DisplayedString = "Package: " + _stage.ToString() + "-" + _level.ToString(), CharacterSize = 20 }; _athList.Add(PackageBar); }