source: 2011/26/OttoS/Space Race/Space Race/Space Race/Peli.cs @ 2236

Revision 2236, 1.2 KB checked in by oteeansa, 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    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.