public void Update(UserCommand command) { if (command.Button1) { returnToTitle = true; } for (int i = 0; i < CIRCLE_COUNT; i++) { circleVX[i] += 2 * random.NextDouble() - 1; circleVY[i] += 2 * random.NextDouble() - 1; if (Math.Abs(circleVX[i]) > CIRCLE_MAX_SPEED) { circleVX[i] = Math.Sign(circleVX[i]) * CIRCLE_MAX_SPEED; } if (Math.Abs(circleVY[i]) > CIRCLE_MAX_SPEED) { circleVY[i] = Math.Sign(circleVY[i]) * CIRCLE_MAX_SPEED; } circleX[i] += circleVX[i]; circleY[i] += circleVY[i]; if (circleX[i] < -CIRCLE_RADIUS) { circleX[i] = 640 + CIRCLE_RADIUS; } else if (circleX[i] > 640 + CIRCLE_RADIUS) { circleX[i] = -CIRCLE_RADIUS; } if (circleY[i] < -CIRCLE_RADIUS) { circleY[i] = 480 + CIRCLE_RADIUS; } else if (circleY[i] > 480 + CIRCLE_RADIUS) { circleY[i] = -CIRCLE_RADIUS; } } if (ticks < 450) { ticks++; } if (ticks == 450) { returnToTitle = true; } }
public void Update(UserCommand command) { ClearSounds(); if (nameEntry) { if (!nameEntryFinished) { if (command.Left != command.Right) { if (command.Left) { if (selectedCol > 0) { selectedCol--; PlaySound(Sound.CursorMove); } } if (command.Right) { if (selectedCol < 9) { selectedCol++; PlaySound(Sound.CursorMove); } } } if (command.Up != command.Down) { if (command.Up) { if (selectedRow > 0) { selectedRow--; PlaySound(Sound.CursorMove); } } if (command.Down) { if (selectedRow < 3) { selectedRow++; PlaySound(Sound.CursorMove); } } } if (command.Button1) { if (selectedRow == 3) { if (selectedCol == 8) { if (name.Length > 0) { name = name.Substring(0, name.Length - 1); PlaySound(Sound.Select); } } else if (selectedCol == 9) { nameEntryFinished = true; PlaySound(Sound.Enter); } else { if (name.Length < 8) { name += CHARACTERS[selectedRow * 10 + selectedCol]; PlaySound(Sound.Select); } else { selectedRow = 3; selectedCol = 9; } } } else { if (name.Length < 8) { name += CHARACTERS[selectedRow * 10 + selectedCol]; PlaySound(Sound.Select); } else { selectedRow = 3; selectedCol = 9; } } } } selectorX = ((Game.FieldWidth - (32 * 10 - 16)) / 2 + selectedCol * 32) * 0.5 + selectorX * 0.5; selectorY = (176 + selectedRow * 32) * 0.5 + selectorY * 0.5; } else { if (command.Button1) { returnToTitle = true; } } ticks++; if (nameEntryFinished) { if (nameEntryEndTicks < 120) { if (nameEntryEndTicks >= 30) { if (command.Button1) { returnToTitle = true; } } nameEntryEndTicks++; } else { returnToTitle = true; } } if (!nameEntry) { if (ticks >= 90) { returnToTitle = true; } } }
public void Update(UserCommand command) { if (command.Exit) { exitGame = true; } else if (command.Button1) { startGame = true; } if (startGame) { if (startCount < 9) { startCount++; } } for (int i = 0; i < NUM_STARS / 4; i++) { starY[i] += 3; if (starY[i] > 480 + 2) { starX[i] = random.Next(-2, 640 + 2 + 1); starY[i] = -2; } } for (int i = NUM_STARS / 4; i < NUM_STARS / 2; i++) { starY[i] += 2; if (starY[i] > 480 + 2) { starX[i] = random.Next(-2, 640 + 2 + 1); starY[i] = -2; } } for (int i = NUM_STARS / 2; i < NUM_STARS; i++) { starY[i] += 1; if (starY[i] > 480 + 2) { starX[i] = random.Next(-2, 640 + 2 + 1); starY[i] = -2; } } ticks++; }