Line | |
---|
1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using System.Text; |
---|
5 | using Jypeli; |
---|
6 | using Jypeli.Assets; |
---|
7 | using Jypeli.Controls; |
---|
8 | using Jypeli.Effects; |
---|
9 | using Jypeli.Widgets; |
---|
10 | |
---|
11 | public class Pang : PhysicsGame |
---|
12 | { |
---|
13 | |
---|
14 | PhysicsObject pallo; |
---|
15 | |
---|
16 | public override void Begin() |
---|
17 | { |
---|
18 | LuoKentta(); |
---|
19 | AloitaPeli(); |
---|
20 | |
---|
21 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
22 | } |
---|
23 | |
---|
24 | void LuoKentta() |
---|
25 | { |
---|
26 | pallo = new PhysicsObject(40.0, 40.0); |
---|
27 | pallo.Shape = Shape.Circle; |
---|
28 | pallo.X = -200.0; |
---|
29 | pallo.Y = 0.0; |
---|
30 | pallo.Restitution = 1.0; |
---|
31 | Add(pallo); |
---|
32 | |
---|
33 | LuoMaila(Level.Left + 20.0, 0.0); |
---|
34 | LuoMaila(Level.Right - 20.0, 0.0); |
---|
35 | |
---|
36 | Level.CreateBorders(1.0, false); |
---|
37 | Level.Background.Color = Color.Black; |
---|
38 | |
---|
39 | Camera.ZoomToLevel(); |
---|
40 | } |
---|
41 | |
---|
42 | void AloitaPeli() |
---|
43 | { |
---|
44 | Vector impulssi = new Vector(500.0, 0.0); |
---|
45 | pallo.Hit(impulssi); |
---|
46 | } |
---|
47 | |
---|
48 | void LuoMaila(double x, double y) |
---|
49 | { |
---|
50 | PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0); |
---|
51 | maila.Shape = Shape.Rectangle; |
---|
52 | maila.X = x; |
---|
53 | maila.Y = y; |
---|
54 | maila.Restitution = 1.0; |
---|
55 | Add(maila); |
---|
56 | } |
---|
57 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.