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 ThePenaltyKick : PhysicsGame |
---|
10 | { |
---|
11 | PhysicsObject pelaaja; |
---|
12 | Image taustaKuva = LoadImage("kentta"); |
---|
13 | |
---|
14 | public override void Begin() |
---|
15 | { |
---|
16 | SetWindowSize(800,600); |
---|
17 | Level.Size = new Vector(800, 600); |
---|
18 | Image pelaajakuva = LoadImage("ihminen"); |
---|
19 | Image maalivahtikuva = LoadImage("maalivahti"); |
---|
20 | |
---|
21 | pelaaja = new PhysicsObject(70, 300); |
---|
22 | pelaaja.Image = pelaajakuva; |
---|
23 | pelaaja.CollisionIgnoreGroup = 1; |
---|
24 | Add(pelaaja); |
---|
25 | |
---|
26 | PhysicsObject Valdes = new PhysicsObject(200, 200); |
---|
27 | Valdes.Image = maalivahtikuva; |
---|
28 | Valdes.Y = -60; |
---|
29 | Valdes.CollisionIgnoreGroup = 1; |
---|
30 | Add(Valdes); |
---|
31 | |
---|
32 | Level.Background.Image = LoadImage("kentta"); |
---|
33 | Level.Background.ScaleToLevelFull(); |
---|
34 | Peliohjaimet(); |
---|
35 | |
---|
36 | } |
---|
37 | void Peliohjaimet() |
---|
38 | { |
---|
39 | |
---|
40 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
41 | Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-100, 0)); |
---|
42 | Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaa, null, new Vector(100, 0)); |
---|
43 | Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 100)); |
---|
44 | Keyboard.Listen(Key.Down, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -100)); |
---|
45 | } |
---|
46 | |
---|
47 | void LiikutaPelaajaa(Vector vektori) |
---|
48 | { |
---|
49 | pelaaja.Push(vektori); |
---|
50 | } |
---|
51 | |
---|
52 | |
---|
53 | } |
---|
54 | |
---|
55 | |
---|
56 | |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | |
---|
69 | |
---|
70 | |
---|
71 | |
---|
72 | |
---|