source: 2011/31/TeemuT/Diamond TD/Diamond TD/Diamond TD/Peli.cs @ 2500

Revision 2500, 1.3 KB checked in by tenituun, 12 years ago (diff)

Talletus.

Line 
1using System;
2using System.Collections.Generic;
3using Jypeli;
4using Jypeli.Assets;
5using Jypeli.Controls;
6using Jypeli.Effects;
7using Jypeli.Widgets;
8
9public 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.