public void Update(GameTime gameTime) { if (blockManager.PlayerIsDead() == true) { isEndFlag = true; } if (Input.GetKeyTrigger(Keys.Space)) { nextScene = SceneName.GamePlay; isEndFlag = true; } player.Update(gameTime); blockManager.Update(gameTime); #region チュートリアル interval++; if (NowCurrentScene.TutorialState == 0) { if (interval >= 50) { blockManager.Add(new NormalBlock(new Vector2(1280, 300), igameMediator)); interval = 0; } } #endregion #region 背景 back -= 1; if (back <= -1280) { back = 0; } back2 -= 3; if (back2 <= -1280) { back2 = 0; } back3 -= 2; if (back3 <= -1280) { back3 = 0; } back4 -= 1; if (back4 <= 0) { back4 = 1280; } back5 -= 3; if (back5 <= 0) { back5 = 1280; } back6 -= 2; if (back6 <= 0) { back6 = 1280; } #endregion }
public void Update(Game game, GameTime gameTime) { HandleInput(game); if (started == true) { blockManager.Update(gameTime); floor.Update(gameTime); if (blockManager.HasDied == true) { Reset(); } } }
public void Update(GameTime gameTime) { if (Input.GetKeyTrigger(Keys.Space) /* || blockManager.PlayerIsDead()==true*/) { isEndFlag = true; } player.Update(gameTime); if (StaticInt.PlayerPower < 0 && blockManager.PlayerPos() == 100) { score -= StaticInt.PlayerPower / 5; backY -= StaticInt.PlayerPower / 10; #region 背景ゴリラ //if (score > 1000 && score <= 4000) //{ // alpha -= 0.001f; //} //else if (score > 4000 && score <= 7000) //{ // alpha += 0.001f; //} #endregion #region 背景美しいScore //if (score >= 1000 && score <1200) //{ // currentScore = score; // loop = true; //} //if (score - currentScore >= 2000) //{ // currentScore = score; // if (loop == true) // { // loop = false; // } // else if (loop == false) // { // loop = true; // } //} //if (loop == true) //{ // alpha -= 0.004f; //} //else if (loop == false) //{ // alpha += 0.004f; //} #endregion #region 背景美しいseconds seconds += 1; if (seconds == 300) { currentSeconds = seconds; loop = true; } if (seconds - currentSeconds == 300) { currentSeconds = seconds; if (loop == true) { loop = false; } else if (loop == false) { loop = true; } } if (loop == true) { //alpha -= 0.004f; alpha -= 0.01f; } else if (loop == false && seconds >= 300) { //alpha += 0.004f; alpha += 0.01f; } #endregion } //デバック用 if (Input.GetKeyState(Keys.B)) { score += 1; } Console.WriteLine("alpha = " + alpha); Console.WriteLine("loop = " + loop); blockManager.Update(gameTime); #region ランダム生成 if (numbers.Count == 0) { for (int i = -5; i < 12; i++) { numbers.Add(i); } } interval++; if (interval >= rnd.Next(50, 100) && num2 == 0 || interval >= rnd.Next(50, 100) && num2 == 2) { num = numbers[rnd.Next(numbers.Count)]; blockManager.Add(new ThornsBlock(new Vector2(1280, (num * 100)), igameMediator)); if (score < 1000) { blockManager.Add(new ThornsBlock(new Vector2(1100, 550 - rnd.Next(150)), igameMediator)); } else { blockManager.Add(new NormalBlock(new Vector2(1100, 550 - rnd.Next(150)), igameMediator)); } numbers.RemoveAll(c => c.ToString().Contains(num.ToString())); interval = 0; num2 += rnd.Next(0, 2); } if (interval >= rnd.Next(50, 100) && num2 == 1) { num = numbers[rnd.Next(numbers.Count)]; blockManager.Add(new NormalBlock(new Vector2(1280, (num * 100)), igameMediator)); blockManager.Add(new ThornsBlock(new Vector2(1100, 550 - rnd.Next(150)), igameMediator)); numbers.RemoveAll(c => c.ToString().Contains(num.ToString())); interval = 0; num2++; } if (interval >= rnd.Next(50, 100) && num2 == 3) { num = numbers[rnd.Next(numbers.Count)]; blockManager.Add(new GravityBlock(new Vector2(1280, (num * 100)), igameMediator)); numbers.RemoveAll(c => c.ToString().Contains(num.ToString())); interval = 0; num2++; } if (interval >= rnd.Next(20, 60) && num2 == 4) { num = numbers[rnd.Next(numbers.Count)]; blockManager.Add(new SpecialBlock(new Vector2(1280, (num * 100)), igameMediator)); blockManager.Add(new ThornsBlock(new Vector2(1100, 550 - rnd.Next(150)), igameMediator)); numbers.RemoveAll(c => c.ToString().Contains(num.ToString())); num2 = 0; } #endregion #region 背景 back -= 1; if (back <= -1280) { back = 0; } back2 -= 3; if (back2 <= -1280) { back2 = 0; } back3 -= 2; if (back3 <= -1280) { back3 = 0; } back4 -= 1; if (back4 <= 0) { back4 = 1280; } back5 -= 3; if (back5 <= 0) { back5 = 1280; } back6 -= 2; if (back6 <= 0) { back6 = 1280; } #endregion }
public void Update(GameTime gameTime) { if (Input.GetKeyTrigger(Keys.Space)) { isEndFlag = true; } player.Update(gameTime); blockManager.Update(gameTime); #region ランダム生成 if (numbers.Count == 0) { for (int i = 2; i < 6; i++) { numbers.Add(i); } } interval++; if (interval >= rnd.Next(150, 250) && num2 == 0 || interval >= rnd.Next(150, 250) && num2 == 2) { num = numbers[rnd.Next(numbers.Count)]; blockManager.Add(new NormalBlock(new Vector2(1280, (num * 100)), igameMediator)); numbers.RemoveAll(c => c.ToString().Contains(num.ToString())); interval = 0; num2 += rnd.Next(0, 2); } if (interval >= rnd.Next(150, 250) && num2 == 1) { num = numbers[rnd.Next(numbers.Count)]; blockManager.Add(new ThornsBlock(new Vector2(1280, (num * 100)), igameMediator)); numbers.RemoveAll(c => c.ToString().Contains(num.ToString())); interval = 0; num2++; } if (interval >= rnd.Next(150, 250) && num2 == 3) { num = numbers[rnd.Next(numbers.Count)]; blockManager.Add(new GravityBlock(new Vector2(1280, (num * 100)), igameMediator)); numbers.RemoveAll(c => c.ToString().Contains(num.ToString())); interval = 0; num2++; } if (num2 == 4) { num = numbers[rnd.Next(numbers.Count)]; blockManager.Add(new SpecialBlock(new Vector2(1280, (num * 100)), igameMediator)); numbers.RemoveAll(c => c.ToString().Contains(num.ToString())); num2 = 0; } #endregion #region 背景 back -= 1; if (back <= -1280) { back = 0; } back2 -= 3; if (back2 <= -1280) { back2 = 0; } back3 -= 2; if (back3 <= -1280) { back3 = 0; } back4 -= 1; if (back4 <= 0) { back4 = 1280; } back5 -= 3; if (back5 <= 0) { back5 = 1280; } back6 -= 2; if (back6 <= 0) { back6 = 1280; } #endregion }
public void Update(GameTime gameTime) { if (flameTime == 1) { num = 0.4f; if (Input.GetKeyTrigger(Keys.D)) { player.Update(gameTime); flameTime++; num = 0; return; } return; } if (flameTime == 100) { num = 0.4f; if (Input.GetKeyTrigger(Keys.D)) { player.Update(gameTime); flameTime++; num = 0; return; } return; } player.Update(gameTime); blockManager.Update(gameTime); flameTime++; //if (Input.GetKeyTrigger(Keys.D)) //{ // isEndFlag = true; //} if (Input.GetKeyState(Keys.Space)) { interval++; if (interval >= 100) { isEndFlag = true; } } if (Input.GetKeyRelease(Keys.Space)) { interval = 0; } #region 背景 back -= 1; if (back <= -1280) { back = 0; } back2 -= 3; if (back2 <= -1280) { back2 = 0; } back3 -= 2; if (back3 <= -1280) { back3 = 0; } back4 -= 1; if (back4 <= 0) { back4 = 1280; } back5 -= 3; if (back5 <= 0) { back5 = 1280; } back6 -= 2; if (back6 <= 0) { back6 = 1280; } #endregion }
public void Update(GameTime time) { if (!blockManager.Initialized) { int i = Rand.Next(0, terrains.Length); blockManager.SetTerrain(terrains[i]); blockManager.Initialize(); } blockManager.Update(time); for (int i = 0; i < entities.Length; i++) { if (entities[i] == null && !Actions.Gameover) { entities[i] = Egenerators[i].Generate(); } } for (int j = 0; j < objects.Length; j++) { if (objects[j] == null && !Actions.Gameover) { objects[j] = Ogenerators[j].Generate(); } } bool spawnmobs = true; for (int i = 0; i < entities.Length; i++) { if (entities[i] != null) { for (int j = 0; j < entities[i].Length; j++) { entities[i][j].Update(time); entities[i][j].ShiftX(-moveSpeed * Settings.gameSpeed); if (!entities[i][j].Dead()) { spawnmobs = false; } } } } for (int j = 0; j < objects.Length; j++) { if (objects[j] != null) { for (int k = 0; k < objects[j].Length; k++) { objects[j][k].Update(time); objects[j][k].ShiftX(-moveSpeed * Settings.gameSpeed); if (!objects[j][k].Dead()) { spawnmobs = false; } } } } if (spawnmobs) { if (!Actions.Gameover) { for (int i = 0; i < entities.Length; i++) { entities[i] = Egenerators[i].Generate(); } for (int j = 0; j < objects.Length; j++) { objects[j] = Ogenerators[j].Generate(); } waveNumber++; } else { for (int i = 0; i < entities.Length; i++) { entities[i] = null; } for (int j = 0; j < objects.Length; j++) { objects[j] = null; } } } if (blockManager.CurrentTerrain.Ending) { int i = Rand.Next(0, terrains.Length); blockManager.SetTerrain(terrains[i]); } }