1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using Jypeli; |
---|
4 | using Jypeli.Assets; |
---|
5 | using Jypeli.Controls; |
---|
6 | using Jypeli.Effects; |
---|
7 | using Jypeli.Widgets; |
---|
8 | |
---|
9 | public class LABYRINTTI : PhysicsGame |
---|
10 | { |
---|
11 | PhysicsObject pelaaja1; |
---|
12 | Image olionKuva = LoadImage("labyrinttipelihahmo2015"); |
---|
13 | |
---|
14 | public override void Begin() |
---|
15 | { |
---|
16 | pelaaja1 = new PhysicsObject(200, 200); |
---|
17 | Add(pelaaja1); |
---|
18 | pelaaja1.Image = olionKuva; |
---|
19 | Shape muoto = Shape.FromImage(olionKuva); |
---|
20 | pelaaja1.Shape = muoto; |
---|
21 | |
---|
22 | |
---|
23 | Level.Background.Color = Color.Maroon; |
---|
24 | |
---|
25 | |
---|
26 | Keyboard.Listen(Key.D, ButtonState.Down, |
---|
27 | LiikutaPelaajaa, null, new Vector(1000, 0)); |
---|
28 | Keyboard.Listen(Key.A, ButtonState.Down, |
---|
29 | LiikutaPelaajaa, null, new Vector(-1000, 0)); |
---|
30 | Keyboard.Listen(Key.W, ButtonState.Down, |
---|
31 | LiikutaPelaajaa, null, new Vector(0, 1000)); |
---|
32 | Keyboard.Listen(Key.S, ButtonState.Down, |
---|
33 | LiikutaPelaajaa, null, new Vector(0, -1000)); |
---|
34 | |
---|
35 | |
---|
36 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
37 | } |
---|
38 | |
---|
39 | void LiikutaPelaajaa(Vector vektori) |
---|
40 | { |
---|
41 | |
---|
42 | pelaaja1.Push(vektori); |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | } |
---|
49 | // TODO: Kirjoita ohjelmakoodisi tähän |
---|
50 | |
---|
51 | |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | |
---|