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 Peli : PhysicsGame |
---|
10 | { |
---|
11 | List<Vector> polku = new List<Vector>(); |
---|
12 | |
---|
13 | |
---|
14 | |
---|
15 | public override void Begin() |
---|
16 | { |
---|
17 | TeeKentta(); |
---|
18 | LuoPolku(); |
---|
19 | LahetaViholline(); |
---|
20 | |
---|
21 | } |
---|
22 | |
---|
23 | void TeeKentta() |
---|
24 | { |
---|
25 | Level.BackgroundColor = Color.DarkGreen; |
---|
26 | } |
---|
27 | void LuoPolku() |
---|
28 | { |
---|
29 | polku.Add(new Vector (-200, 200)); |
---|
30 | polku.Add(new Vector(-200, 0)); |
---|
31 | polku.Add(new Vector( 200, 0)); |
---|
32 | polku.Add(new |
---|
33 | RoadMap tie = new RoadMap(polku.ToArray()); |
---|
34 | tie.DefaultWidth = 100.0; |
---|
35 | tie.Insert(); |
---|
36 | |
---|
37 | |
---|
38 | |
---|
39 | |
---|
40 | for (int i = polku.Count-1; i > -1; i--) |
---|
41 | { |
---|
42 | polku.Add(polku[i]); |
---|
43 | } |
---|
44 | } |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | void LahetaViholline() |
---|
50 | { |
---|
51 | PhysicsObject vih = new PhysicsObject(20, 20); |
---|
52 | vih.Position = polku[0]; |
---|
53 | |
---|
54 | PathFollowerBrain testiaivot = new PathFollowerBrain(); |
---|
55 | testiaivot.Path = polku; |
---|
56 | testiaivot.Speed = 100; |
---|
57 | testiaivot.Loop = true; |
---|
58 | vih.Brain = testiaivot; |
---|
59 | Add(vih); |
---|
60 | vih.Color = Color.Red |
---|
61 | ; |
---|
62 | vih.Shape = Shape.Circle; |
---|
63 | |
---|
64 | } |
---|
65 | |
---|
66 | |
---|
67 | } |
---|
68 | |
---|
Note: See
TracBrowser
for help on using the repository browser.