@@ -0,0 +1,83 @@
1+
2+module GameSkeleton where
3+
4+
5+
6+{-- Part 1: Model the user input ----------------------------------------------
7+
8+What information do you need to represent all relevant user input?
9+
10+Task: Redefine `UserInput` to include all of the information you need.
11+ Redifene `userInput` to be a signal that correctly models the user
12+ input as described by `UserInput`.
13+
14+------------------------------------------------------------------------------}
15+
16+data UserInput = UserInput
17+
18+userInput = constant UserInput
19+
20+data Input = Input Float UserInput
21+
22+
23+
24+{-- Part 2: Model the game ----------------------------------------------------
25+
26+What information do you need to represent the entire game?
27+
28+Tasks: Redefine `GameState` to represent your particular game.
29+ Redefine `defaultGame` to represent your initial game state.
30+
31+For example, if you want to represent many objects that just have a position,
32+your GameState might just be a list of coordinates and your default game might
33+be an empty list (no objects at the start):
34+
35+ data GameState = GameState [(Float,Float)]
36+ defaultGame = GameState []
37+
38+------------------------------------------------------------------------------}
39+
40+data GameState = GameState
41+
42+defaultGame = GameState
43+
44+
45+
46+{-- Part 3: Update the game ---------------------------------------------------
47+
48+How does the game step from one state to another based on user input?
49+
50+Task: redefine `stepGame` to use the UserInput and GameState
51+ you defined in parts 1 and 2. Maybe use some helper functions
52+ to break up the work, stepping smaller parts of the game.
53+
54+------------------------------------------------------------------------------}
55+
56+stepGame (Input delta (UserInput)) (GameState) = GameState
57+
58+
59+
60+{-- Part 4: Display the game --------------------------------------------------
61+
62+How should the GameState be displayed to the user?
63+
64+Task: redefine `display` to use the GameState you defined in part 2.
65+
66+------------------------------------------------------------------------------}
67+
68+display (w,h) gameState = asText gameState
69+
70+
71+
72+{-- That's all folks! ---------------------------------------------------------
73+
74+The following code puts it all together and show it on screen.
75+
76+------------------------------------------------------------------------------}
77+
78+delta = fps 60
79+input = sampleOn delta (lift2 Input delta userInput)
80+
81+gameState = foldp stepGame defaultGame input
82+
83+main = lift2 display Window.dimensions gameState