-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGame.java
More file actions
32 lines (30 loc) · 978 Bytes
/
Game.java
File metadata and controls
32 lines (30 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// This file is the starting point of the game
import java.util.Scanner;
/**
* The entry point of the game
*/
public class Game
{
public static void main(String[] args)
{
System.out.println("Welcome to JSpaceInvader!");
System.out.println("Please enter a level of difficulty: 0 (easy), 1 (middle), 2 (hard), 3 (extremely hard)");
Scanner scanner = new Scanner(System.in);
int level = -1;
do
{
int input = scanner.nextInt();
if(input < 0 || input > 3)
System.out.println("Please enter a value in [0, 1, 2, 3]:");
else
level = input;
}while(level < 0);
scanner.close();
Renderer myRenderer = new Renderer(level);
myRenderer.loop();
String summary = myRenderer.close();
System.out.println("\nThanks for playing JSpaceInvader!");
System.out.println(summary);
System.out.println();
}
}