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 | Image olionKuva = LoadImage("ufo"); |
---|
12 | |
---|
13 | public override void Begin() |
---|
14 | { |
---|
15 | PhysicsObject UFO = new PhysicsObject(30.0, 30.0); |
---|
16 | Add(UFO); |
---|
17 | UFO.Image = olionKuva; |
---|
18 | UFO.X = Level.Left + 100; |
---|
19 | UFO.Y = 0.0; |
---|
20 | Vector impulssi = new Vector(500.0, 0.0); |
---|
21 | //UFO.Hit(impulssi); |
---|
22 | UFO.Restitution = 1.0; |
---|
23 | Level.BackgroundColor = Color.White; |
---|
24 | Camera.ZoomToLevel(); |
---|
25 | Level.CreateBorders(true); |
---|
26 | |
---|
27 | Timer ajastin = new Timer(); |
---|
28 | ajastin.Interval = 1.5; |
---|
29 | ajastin.Trigger += LuoSatunnainenEste; |
---|
30 | ajastin.Start(); |
---|
31 | |
---|
32 | } |
---|
33 | |
---|
34 | void LuoSatunnainenEste(Timer sender) |
---|
35 | { |
---|
36 | double y = RandomGen.NextDouble(Level.Bottom, Level.Top); |
---|
37 | PhysicsObject Este = PhysicsObject.CreateStaticObject(35.0, 300.0); |
---|
38 | Add(Este); |
---|
39 | Este.X = Level.Left + RandomGen.NextDouble(800, 1200); |
---|
40 | Este.Y = y; |
---|
41 | Este.Color = Color.Brown; |
---|
42 | Este.Velocity = new Vector (-200, 0.0); |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | } |
---|
47 | |
---|
48 | |
---|
49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.