public EnemiesMatrix(GameScreen i_GameScreen) : base(i_GameScreen.Game) { m_JumpTwiceMilliSec = 1000; this.r_EnemiesMatrix = new List<List<Enemy>>(); m_JumpDirection = SpriteJump.eJumpDirection.Right; m_GameScreen = i_GameScreen; m_NumberOfColumns = k_StartupNumOfColumns; }
public EnemiesMatrix(GameScreen i_GameScreen) : base(i_GameScreen.Game) { m_JumpTwiceMilliSec = 1000; this.r_EnemiesMatrix = new List <List <Enemy> >(); m_JumpDirection = SpriteJump.eJumpDirection.Right; m_GameScreen = i_GameScreen; m_NumberOfColumns = k_StartupNumOfColumns; }
private void jumpAllAliveEnemies(SpriteJump.eJumpDirection i_JumpDirection, float i_DistanceToJump, bool i_IsJumpingBackwards) { foreach (Enemy enemy in GetEnemysAsList()) { if (!enemy.isDying) { enemy.SpriteJump.Jump(i_JumpDirection, i_DistanceToJump, i_IsJumpingBackwards); } } }
public override void Update(GameTime i_GameTime) { bool isSpeedUp = false, isJumpingBackwards = false; float originalDistanceToJump; int timeToJump; originalDistanceToJump = GetEnemysAsList()[0].Width / 2; randomEnemyShooting(); m_TimeCount += i_GameTime.ElapsedGameTime.Milliseconds; timeToJump = m_JumpTwiceMilliSec / 2; if (m_TimeCount >= timeToJump) { jumpAllAliveEnemies(m_JumpDirection, originalDistanceToJump, isJumpingBackwards); if (m_JumpDirection.Equals(SpriteJump.eJumpDirection.DownAndLeft)) { m_JumpDirection = SpriteJump.eJumpDirection.Left; } else if (m_JumpDirection.Equals(SpriteJump.eJumpDirection.DownAndRight)) { m_JumpDirection = SpriteJump.eJumpDirection.Right; } SpriteJump.SpriteOverJumped enemyOverJumpedData = getEnemyOverJumpedData(); if (enemyOverJumpedData.IsTouchedScreenHorizontalBoundary) { switch (m_JumpDirection) { case SpriteJump.eJumpDirection.Right: isJumpingBackwards = true; jumpAllAliveEnemies(enemyOverJumpedData.DirectionToJumpBackwards, enemyOverJumpedData.DistanceToJumpBackwards, isJumpingBackwards); isSpeedUp = true; m_JumpDirection = SpriteJump.eJumpDirection.DownAndLeft; break; case SpriteJump.eJumpDirection.Left: isJumpingBackwards = true; jumpAllAliveEnemies(enemyOverJumpedData.DirectionToJumpBackwards, enemyOverJumpedData.DistanceToJumpBackwards, isJumpingBackwards); isSpeedUp = true; m_JumpDirection = SpriteJump.eJumpDirection.DownAndRight; break; } } m_TimeCount -= timeToJump; if (isSpeedUp) { SpeedUp(0.95); } } }
public override void Update(GameTime i_GameTime) { bool isSpeedUp = false, isJumpingBackwards = false; float originalDistanceToJump; int timeToJump; originalDistanceToJump = GetEnemysAsList()[0].Width / 2; randomEnemyShooting(); m_TimeCount += i_GameTime.ElapsedGameTime.Milliseconds; timeToJump = m_JumpTwiceMilliSec / 2; if (m_TimeCount >= timeToJump) { jumpAllAliveEnemies(m_JumpDirection, originalDistanceToJump, isJumpingBackwards); if (m_JumpDirection.Equals(SpriteJump.eJumpDirection.DownAndLeft)) { m_JumpDirection = SpriteJump.eJumpDirection.Left; } else if (m_JumpDirection.Equals(SpriteJump.eJumpDirection.DownAndRight)) { m_JumpDirection = SpriteJump.eJumpDirection.Right; } SpriteJump.SpriteOverJumped enemyOverJumpedData = getEnemyOverJumpedData(); if (enemyOverJumpedData.IsTouchedScreenHorizontalBoundary) { switch (m_JumpDirection) { case SpriteJump.eJumpDirection.Right: isJumpingBackwards = true; jumpAllAliveEnemies(enemyOverJumpedData.DirectionToJumpBackwards, enemyOverJumpedData.DistanceToJumpBackwards, isJumpingBackwards); isSpeedUp = true; m_JumpDirection = SpriteJump.eJumpDirection.DownAndLeft; break; case SpriteJump.eJumpDirection.Left: isJumpingBackwards = true; jumpAllAliveEnemies(enemyOverJumpedData.DirectionToJumpBackwards, enemyOverJumpedData.DistanceToJumpBackwards, isJumpingBackwards); isSpeedUp = true; m_JumpDirection = SpriteJump.eJumpDirection.DownAndRight; break; } } m_TimeCount -= timeToJump; if (isSpeedUp) { SpeedUp(0.95); } } }