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 Hounted_Hause : PhysicsGame |
---|
10 | { |
---|
11 | Image PelaajaKuva = LoadImage("Char"); |
---|
12 | |
---|
13 | public override void Begin() |
---|
14 | { |
---|
15 | PhysicsObject pelaaja = new PhysicsObject(40, 40); |
---|
16 | pelaaja.Image = PelaajaKuva; |
---|
17 | pelaaja.Shape = Shape.Rectangle; |
---|
18 | Add(pelaaja); |
---|
19 | |
---|
20 | Camera.Follow(pelaaja); |
---|
21 | Camera.ZoomFactor = 4.0; |
---|
22 | |
---|
23 | ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-1000, 0), pelaaja); |
---|
24 | ControllerOne.Listen(Button.DPadRight, ButtonState.Down, LiikutaPelaajaa, null, new Vector(1000, 0), pelaaja); |
---|
25 | ControllerOne.Listen(Button.DPadUp, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 1000), pelaaja); |
---|
26 | ControllerOne.Listen(Button.DPadDown, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -1000), pelaaja); |
---|
27 | |
---|
28 | PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); |
---|
29 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
30 | } |
---|
31 | |
---|
32 | void LiikutaPelaajaa(Vector vektori, PhysicsObject pelaaja) |
---|
33 | { |
---|
34 | pelaaja.Push(vektori); |
---|
35 | } |
---|
36 | } |
---|