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 kaksintastelut : PhysicsGame |
---|
10 | { |
---|
11 | PhysicsObject pelaaja1; |
---|
12 | PhysicsObject pelaaja2; |
---|
13 | |
---|
14 | |
---|
15 | public override void Begin() |
---|
16 | { |
---|
17 | Gravity = new Vector(0, -100); |
---|
18 | // pelaaja1 = new PhysicsObject( 40, 40 ); |
---|
19 | //Add( pelaaja1 ); |
---|
20 | //pelaaja2 = new PhysicsObject( 40, 40 ); |
---|
21 | //Add( pelaaja2 ); |
---|
22 | |
---|
23 | ControllerOne.Listen( Button.DPadLeft, ButtonState.Down, |
---|
24 | LiikutaPelaajaa, null, new Vector( -1000, 0 ), pelaaja1 ); |
---|
25 | ControllerOne.Listen( Button.DPadRight, ButtonState.Down, |
---|
26 | LiikutaPelaajaa, null, new Vector( 1000, 0 ), pelaaja1 ); |
---|
27 | ControllerOne.Listen( Button.DPadUp, ButtonState.Down, |
---|
28 | LiikutaPelaajaa, null, new Vector( 0, 1000 ), pelaaja1 ); |
---|
29 | ControllerOne.Listen( Button.DPadDown, ButtonState.Down, |
---|
30 | LiikutaPelaajaa, null, new Vector( 0, -1000 ), pelaaja1 ); |
---|
31 | |
---|
32 | ControllerTwo.Listen( Button.DPadLeft, ButtonState.Down, |
---|
33 | LiikutaPelaajaa, null, new Vector( -1000, 0 ), pelaaja2 ); |
---|
34 | ControllerTwo.Listen( Button.DPadRight, ButtonState.Down, |
---|
35 | LiikutaPelaajaa, null, new Vector( 1000, 0 ), pelaaja2 ); |
---|
36 | ControllerTwo.Listen( Button.DPadUp, ButtonState.Down, |
---|
37 | LiikutaPelaajaa, null, new Vector( 0, 1000 ), pelaaja2 ); |
---|
38 | ControllerTwo.Listen( Button.DPadDown, ButtonState.Down, |
---|
39 | LiikutaPelaajaa, null, new Vector( 0, -1000 ), pelaaja2 ); |
---|
40 | |
---|
41 | |
---|
42 | } |
---|
43 | |
---|
44 | void LuoPelaaja1(Vector paikka, double leveys, double korkeus, PhysicsObject pelaaja) |
---|
45 | { |
---|
46 | pelaaja1 = new PhysicsObject(40, 20); |
---|
47 | pelaaja1.Shape = Shape.Rectangle; |
---|
48 | pelaaja1.Mass = 10.0; |
---|
49 | pelaaja1.Position = paikka; |
---|
50 | Add(pelaaja1); |
---|
51 | } |
---|
52 | |
---|
53 | |
---|
54 | void LuoKentta() |
---|
55 | { |
---|
56 | //1. Luetaan kuva uuteen ColorTileMappiin, kuvan nimen perässä ei .png-päätettä. |
---|
57 | ColorTileMap ruudut = ColorTileMap.FromLevelAsset("kaksintaistelu"); |
---|
58 | ruudut.SetTileMethod("55FF11", LuoPelaaja1, pelaaja1); |
---|
59 | ruudut.SetTileMethod("FF000C", LuoPelaaja2, pelaaja2); |
---|
60 | ruudut.SetTileMethod("FF6A00", LuoTaso); |
---|
61 | ruudut.Execute(40, 40); |
---|
62 | |
---|
63 | } |
---|
64 | void LuoTaso(Vector paikka, double leveys, double Korkerus) |
---|
65 | { |
---|
66 | } |
---|
67 | void LiikutaPelaajaa(Vector paikka, PhysicsObject Pelaaja ) |
---|
68 | { |
---|
69 | Pelaaja.Push(paikka); |
---|
70 | } |
---|
71 | void LuoPelaaja2(Vector paikka, double leveys, double korkeus, PhysicsObject pelaaja) |
---|
72 | { |
---|
73 | } |
---|
74 | } |
---|