public override void Tick(GameInput input) { if (Open) { if (openHeight < Position.Y) { if (Position.Y - openHeight < 2) { MoveVerticalTo(openHeight); } else { MoveVerticalBy(-2); } } } else { if (Position.Y < closeHeight) { if (closeHeight - Position.Y < 2) { MoveVerticalTo(closeHeight); } else { MoveVerticalBy(2); } } } }
public override void Tick(GameInput input) { if (falling) { Velocity.Y += 0.25; if (Velocity.Y > 4.0) { Velocity.Y = 4.0; } MoveVerticalBy(Velocity.Y); } else { if (type == Map.SPIKE_DOWN) { if (Math.Abs(Game.Player.Position.X - Position.X) < 16) { int playerRow = Game.Player.TopRow; int limit = 0; for (int row = BottomRow; row < playerRow; row++) { if (limit < 16) { limit++; } else { return; } if (Game.Map.IsObstacle(this, row, LeftCol)) { return; } } falling = true; fallSound = true; } } } }
public override void Tick(GameInput input) { }
public override void Tick(GameInput input) { Position.X += speed * Math.Cos(Math.PI * direction / 4); Position.Y += speed * Math.Sin(Math.PI * direction / 4); life--; if (life == 0) { Remove(); } }
public override void Tick(GameInput input) { animation = (animation + 1) % 16; }
public int Tick(GameInput input) { if (gameTimer == 0) things.Initialize(); int result = NONE; things.BeforeTick(); things.Tick(input); things.AddThingList(addThings); addThings.Tick(input); addThings.Clear(); things.AfterTick(); Camera = (player.Focus - new Vector(Mafia.SCREEN_WIDTH / 2, Mafia.SCREEN_HEIGHT / 2)) * 0.125 + camera * 0.875; gameTimer++; if (player.Missed) { if (missTimer < 180) { missTimer++; } else { result = RESET_GAME; } } else if (currentNumCoins == 0) { if (clearTimer < 180) { clearTimer++; } else { result = CLEAR_GAME; } } if (input.GotoSelect) { result = SELECT; } if (input.GotoTitle) { result = GOTO_TITLE; } return result; }
public abstract void Tick(GameInput input);
public override void Tick(GameInput input) { MoveBy(Velocity); moveCount = (moveCount + 1) % 32; }
public void Tick(GameInput input) { foreach (Thing thing in list) { thing.Tick(input); } RemoveThings(); }
public override void Tick(GameInput input) { left = input.Left; up = input.Up; right = input.Right; down = input.Down; if (!missed) { if (input.GotoSelect) Damaged(null); #region ���E�̓��� { if (!left && !right || left && right) { if (LandState == IN_AIR) { if (Math.Abs(Velocity.X) > 0.0625) { Velocity.X -= Math.Sign(Velocity.X) * 0.0625; } else { Velocity.X = 0; } } else if (LandState == ON_GROUND) { if (Math.Abs(Velocity.X) > 0.25) { Velocity.X -= Math.Sign(Velocity.X) * 0.25; } else { Velocity.X = 0; } } } else if (left && !right) { Direction = LEFT; if (LandState == IN_AIR) { Velocity.X -= 0.25; } else if (LandState == ON_GROUND) { Velocity.X -= 0.5; Animation = (Animation + 1) % 8; } } else if (right && !left) { Direction = RIGHT; if (LandState == IN_AIR) { Velocity.X += 0.25; } else if (LandState == ON_GROUND) { Velocity.X += 0.5; Animation = (Animation + 1) % 8; } } if (Math.Abs(Velocity.X) > 2) Velocity.X = Math.Sign(Velocity.X) * 2; MoveHorizontalBy(Velocity.X); } #endregion #region �W�����v���㉺�̓��� { Velocity.Y += 0.25; if (Velocity.Y > 4) { Velocity.Y = 4; } if (LandState == ON_GROUND) { if (up) { if (JumpTick != -1) { Animation = (Animation + 4) % 8; LandState = IN_AIR; JumpTick = 14; jumpSound = true; } } else { JumpTick = 0; } } if (LandState == IN_AIR) { if (JumpTick > 0) { if (up) { Velocity.Y = -4; JumpTick--; } else { JumpTick = -1; } } else { if (Velocity.Y < 0) { JumpTick = -1; } else if (!up) { JumpTick = 0; } } } LandState = IN_AIR; MoveVerticalBy(Velocity.Y); } #endregion foreach (Thing thing in Game.ThingList) { if (thing is Coin) { if (Overlapped(thing, 4)) { ((Coin)thing).KiraKira(); Game.GetCoin((Coin)thing); coinSound = true; } } } #region �J�����ʒu�̕ { switch (Direction) { case LEFT: focus.X -= 0.5; break; case RIGHT: focus.X += 0.5; break; } if (Math.Abs(focus.X) > 64) focus.X = Math.Sign(focus.X) * 64; if (Center.X + focus.X < Mafia.SCREEN_WIDTH / 2) { focus.X = Mafia.SCREEN_WIDTH / 2 - Center.X; } else if (Center.X + focus.X > Game.Map.Width - Mafia.SCREEN_WIDTH / 2) { focus.X = Game.Map.Width - Mafia.SCREEN_WIDTH / 2 - Center.X; } if (down) { focus.Y += 0.5; } else { focus.Y -= 0.5; } if (Math.Abs(focus.Y) > 32) focus.Y = Math.Sign(focus.Y) * 32; if (Center.Y + focus.Y < Mafia.SCREEN_HEIGHT / 2) { focus.Y = Mafia.SCREEN_HEIGHT / 2 - Center.Y; } else if (Center.Y + focus.Y > Game.Map.Height - Mafia.SCREEN_HEIGHT / 2) { focus.Y = Game.Map.Height - Mafia.SCREEN_HEIGHT / 2 - Center.Y; } } #endregion } }
public override void Tick(GameInput input) { Velocity.Y += 0.25; if (Velocity.Y > 4) { Velocity.Y = 4; } LandState = IN_AIR; MoveVerticalBy(Velocity.Y); }
public override void Tick(GameInput input) { left = input.Left; up = input.Up; right = input.Right; down = input.Down; if (!missed) { if (input.GotoSelect) { Damaged(null); } #region 左右の動き { if (!left && !right || left && right) { if (LandState == IN_AIR) { if (Math.Abs(Velocity.X) > 0.0625) { Velocity.X -= Math.Sign(Velocity.X) * 0.0625; } else { Velocity.X = 0; } } else if (LandState == ON_GROUND) { if (Math.Abs(Velocity.X) > 0.25) { Velocity.X -= Math.Sign(Velocity.X) * 0.25; } else { Velocity.X = 0; } } } else if (left && !right) { Direction = LEFT; if (LandState == IN_AIR) { Velocity.X -= 0.25; } else if (LandState == ON_GROUND) { Velocity.X -= 0.5; Animation = (Animation + 1) % 8; } } else if (right && !left) { Direction = RIGHT; if (LandState == IN_AIR) { Velocity.X += 0.25; } else if (LandState == ON_GROUND) { Velocity.X += 0.5; Animation = (Animation + 1) % 8; } } if (Math.Abs(Velocity.X) > 2) { Velocity.X = Math.Sign(Velocity.X) * 2; } MoveHorizontalBy(Velocity.X); } #endregion #region ジャンプ&上下の動き { Velocity.Y += 0.25; if (Velocity.Y > 4) { Velocity.Y = 4; } if (LandState == ON_GROUND) { if (up) { if (JumpTick != -1) { Animation = (Animation + 4) % 8; LandState = IN_AIR; JumpTick = 14; jumpSound = true; } } else { JumpTick = 0; } } if (LandState == IN_AIR) { if (JumpTick > 0) { if (up) { Velocity.Y = -4; JumpTick--; } else { JumpTick = -1; } } else { if (Velocity.Y < 0) { JumpTick = -1; } else if (!up) { JumpTick = 0; } } } LandState = IN_AIR; MoveVerticalBy(Velocity.Y); } #endregion foreach (Thing thing in Game.ThingList) { if (thing is Coin) { if (Overlapped(thing, 4)) { ((Coin)thing).KiraKira(); Game.GetCoin((Coin)thing); coinSound = true; } } } #region カメラ位置の補正 { switch (Direction) { case LEFT: focus.X -= 0.5; break; case RIGHT: focus.X += 0.5; break; } if (Math.Abs(focus.X) > 64) { focus.X = Math.Sign(focus.X) * 64; } if (Center.X + focus.X < Mafia.SCREEN_WIDTH / 2) { focus.X = Mafia.SCREEN_WIDTH / 2 - Center.X; } else if (Center.X + focus.X > Game.Map.Width - Mafia.SCREEN_WIDTH / 2) { focus.X = Game.Map.Width - Mafia.SCREEN_WIDTH / 2 - Center.X; } if (down) { focus.Y += 0.5; } else { focus.Y -= 0.5; } if (Math.Abs(focus.Y) > 32) { focus.Y = Math.Sign(focus.Y) * 32; } if (Center.Y + focus.Y < Mafia.SCREEN_HEIGHT / 2) { focus.Y = Mafia.SCREEN_HEIGHT / 2 - Center.Y; } else if (Center.Y + focus.Y > Game.Map.Height - Mafia.SCREEN_HEIGHT / 2) { focus.Y = Game.Map.Height - Mafia.SCREEN_HEIGHT / 2 - Center.Y; } } #endregion } }