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 Pixels : PhysicsGame |
---|
10 | { |
---|
11 | Image taustakuva = LoadImage("Taustakuva"); |
---|
12 | Image tasokuva = LoadImage("Maa"); |
---|
13 | |
---|
14 | public override void Begin() |
---|
15 | { |
---|
16 | |
---|
17 | LisaaPelaaja(); |
---|
18 | LuoKentta(); |
---|
19 | |
---|
20 | |
---|
21 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
22 | } |
---|
23 | |
---|
24 | void LuoKentta() |
---|
25 | { |
---|
26 | Level.Background.CreateGradient(Color.White, Color.Red); |
---|
27 | |
---|
28 | ColorTileMap ruudut = ColorTileMap.FromLevelAsset("Maa"); |
---|
29 | |
---|
30 | ruudut.SetTileMethod(Color.Red, LuoTaso); |
---|
31 | ruudut.SetTileMethod(Color.Gray, LuoTaso); |
---|
32 | ruudut.SetTileMethod(Color.Black, LuoTaso); |
---|
33 | ruudut.SetTileMethod(Color.Blue, LuoTaso); |
---|
34 | |
---|
35 | ruudut.Execute(20, 40); |
---|
36 | } |
---|
37 | |
---|
38 | void LisaaPelaaja() |
---|
39 | { |
---|
40 | PhysicsObject Pixeli = new PhysicsObject(100, 100); |
---|
41 | Pixeli.Shape = Shape.Rectangle; |
---|
42 | Add(Pixeli); |
---|
43 | } |
---|
44 | |
---|
45 | void LuoTaso(Vector paikka, double leveys, double korkeus) |
---|
46 | { |
---|
47 | PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); |
---|
48 | taso.Position = paikka; |
---|
49 | |
---|
50 | taso.CollisionIgnoreGroup = 1; |
---|
51 | |
---|
52 | } |
---|
53 | |
---|
54 | |
---|
55 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.