1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using Jypeli; |
---|
4 | using Jypeli.Assets; |
---|
5 | using Jypeli.Controls; |
---|
6 | using Jypeli.Effects; |
---|
7 | |
---|
8 | |
---|
9 | public class JHaapaduuuuuuuuuuuu__________________ : PhysicsGame |
---|
10 | { |
---|
11 | PhysicsObject olio; |
---|
12 | Image olionKuva = LoadImage("BatleAxe"); |
---|
13 | Image lattiankuva = LoadImage("Floor"); |
---|
14 | Image seinankuva = LoadImage("Wall"); |
---|
15 | Image vihukuva = LoadImage("Spear"); |
---|
16 | public override void Begin() |
---|
17 | { |
---|
18 | // TODO: Kirjoita ohjelmakoodisi tähän |
---|
19 | |
---|
20 | Level.Width = Screen.Width; |
---|
21 | Surfaces reunat = Level.CreateBorders(0, true, Color.Gray); |
---|
22 | reunat.Top.Image = seinankuva; |
---|
23 | reunat.Bottom.Image = seinankuva; |
---|
24 | |
---|
25 | PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); |
---|
26 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
27 | olio = new PhysicsObject(100, 100); |
---|
28 | olio.MaxVelocity = 300; |
---|
29 | olio.CanRotate = false; |
---|
30 | olio.Image = olionKuva; |
---|
31 | Add(olio); |
---|
32 | Vector impulssi = new Vector(500.0, 0.0); |
---|
33 | olio.Hit(impulssi); |
---|
34 | Level.BackgroundColor = Color.Black; |
---|
35 | Level.Background.Image = lattiankuva; |
---|
36 | Level.Background.ScaleToLevelByWidth(); |
---|
37 | |
---|
38 | Keyboard.Listen(Key.Left, ButtonState.Down, |
---|
39 | LiikutaPelaajaa, null, new Vector(-1000, 0)); |
---|
40 | Keyboard.Listen(Key.Right, ButtonState.Down, |
---|
41 | LiikutaPelaajaa, null, new Vector(1000, 0)); |
---|
42 | Keyboard.Listen(Key.Up, ButtonState.Down, |
---|
43 | LiikutaPelaajaa, null, new Vector(0, 1000)); |
---|
44 | Keyboard.Listen(Key.Down, ButtonState.Down, |
---|
45 | LiikutaPelaajaa, null, new Vector(0, -1000)); |
---|
46 | |
---|
47 | LuoVihu(new Vector(-200, 100)); |
---|
48 | } |
---|
49 | |
---|
50 | void LiikutaPelaajaa(Vector vektori) |
---|
51 | { |
---|
52 | olio.Angle = vektori.Angle; |
---|
53 | olio.Push(vektori); |
---|
54 | } |
---|
55 | |
---|
56 | void LuoVihu(Vector vektori) |
---|
57 | { |
---|
58 | |
---|
59 | PhysicsObject vihunkuva = new PhysicsObject(40.0, 40.0); |
---|
60 | vihunkuva.Position = vektori; |
---|
61 | vihunkuva.Restitution = 1.0; |
---|
62 | vihunkuva.Image = vihukuva; |
---|
63 | Add(vihunkuva); |
---|
64 | } |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | } |
---|
69 | |
---|