Line | |
---|
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 Kuumailmapallolento : PhysicsGame |
---|
10 | { |
---|
11 | Image pallo = LoadImage("Kuumailmapallo"); |
---|
12 | PhysicsObject pelaaja; |
---|
13 | public override void Begin() |
---|
14 | |
---|
15 | { |
---|
16 | AsetaOhjaimet(); |
---|
17 | // TODO: Kirjoita ohjelmakoodisi tähän |
---|
18 | |
---|
19 | PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); |
---|
20 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
21 | pelaaja = new PhysicsObject(pallo); |
---|
22 | pelaaja.X = (-500); |
---|
23 | |
---|
24 | Add(pelaaja); |
---|
25 | |
---|
26 | } |
---|
27 | void AsetaOhjaimet() |
---|
28 | { |
---|
29 | Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaa, "Pelaaja liikkuu ylös",new Vector (0, 330)); |
---|
30 | Keyboard.Listen(Key.Up, ButtonState.Released, PysaytaPelaaja, "Pelaaja pysähtyy"); |
---|
31 | Keyboard.Listen(Key.Down, ButtonState.Down, LiikutaPelaajaa, "Pelaaja liikkuu alas", new Vector (0, -330)); |
---|
32 | Keyboard.Listen(Key.Down, ButtonState.Released, PysaytaPelaaja, "Pelaaja pysähtyy"); |
---|
33 | } |
---|
34 | |
---|
35 | void LiikutaPelaajaa(Vector suunta) |
---|
36 | { |
---|
37 | pelaaja.Velocity = suunta; |
---|
38 | } |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | void PysaytaPelaaja() |
---|
43 | { |
---|
44 | pelaaja.Stop(); |
---|
45 | } |
---|
46 | } |
---|
47 | |
---|
Note: See
TracBrowser
for help on using the repository browser.