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 FysiikkaPeli3 : PhysicsGame |
---|
10 | { |
---|
11 | PlatformCharacter pelaaja1; |
---|
12 | Image[] pictures = LoadImages("ff", "stand 2", "stand 3", "stand 4"); |
---|
13 | public override void Begin() |
---|
14 | { |
---|
15 | // TODO: Kirjoita ohjelmakoodisi tähän |
---|
16 | LuoPelaaja(); |
---|
17 | keyboard(); |
---|
18 | PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); |
---|
19 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
20 | } |
---|
21 | void LuoPelaaja() |
---|
22 | { |
---|
23 | pelaaja1 = new PlatformCharacter(83.0, 94.0); |
---|
24 | Add(pelaaja1); |
---|
25 | pelaaja1.Animation = new Animation(pictures); |
---|
26 | pelaaja1.Animation.Start(); |
---|
27 | pelaaja1.Animation.FPS = 5; |
---|
28 | } |
---|
29 | |
---|
30 | void keyboard() |
---|
31 | { |
---|
32 | Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, null, pelaaja1); |
---|
33 | //.Listen(Key.Left, ButtonState.Released, LiikutaPelaajaa, null); |
---|
34 | |
---|
35 | } |
---|
36 | void LiikutaPelaajaa(PlatformCharacter pelaaja) |
---|
37 | |
---|
38 | { |
---|
39 | pelaaja.Walk(20.0); |
---|
40 | |
---|
41 | |
---|
42 | } |
---|
43 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.