public override void Update() { float vertical = InputManager.GetAxis("Vertical"); float horizontal = InputManager.GetAxis("Horizontal"); _pc._forces.Add(new Vector2(50000 * horizontal, 0)); // hozitontal move if (_canJump && vertical < 0) { // Jump up _pc._forces.Add(new Vector2(0, 50000000 * vertical)); _canJump = false; _actionManager.ActionPlaySound("playerJump.wav"); } else if (vertical > 0) { // Jump down _pc._forces.Add(new Vector2(0, 10000000 * vertical)); } if (!_canBeHurt) { _recoveryCurent++; if (_recoveryCurent >= _recoveryNumberFrames) { ((RenderComponent)GetEntity().GetComponentOfType(typeof(RenderComponent))).image = "mario.png"; _recoveryCurent = 0; _canBeHurt = true; } } }
public override void Update() { _numberFrameFireballCurrent++; if (_numberFrameFireballCurrent >= _numberFrameFireball) { _numberFrameFireballCurrent = 0; _numberFrameFireball = 50 + new Random().Next(1, 30); Entity fireball = CreateFireball(); _actionManager.ActionAddEntity(fireball); _actionManager.ActionPlaySound("fireball.wav"); } }
public override void Update() { float vertical = InputManager.GetAxis("Vertical"); float horizontal = InputManager.GetAxis("Horizontal"); _pc._forces.Add(new Vector2(50000 * horizontal, 0)); // hozitontal move if (_canJump && vertical < 0) { _pc._forces.Add(new Vector2(0, 50000000 * vertical)); _canJump = false; _actionManager.ActionPlaySound("playerJump.wav"); } else if (vertical > 0) { _pc._forces.Add(new Vector2(0, 10000000 * vertical)); } }