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 pong : PhysicsGame |
---|
10 | { |
---|
11 | PhysicsObject pallo; |
---|
12 | |
---|
13 | |
---|
14 | |
---|
15 | public override void Begin() |
---|
16 | { |
---|
17 | LuoKentta(); |
---|
18 | AloitaPeli(); |
---|
19 | PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); |
---|
20 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
21 | } |
---|
22 | void LuoKentta() |
---|
23 | { |
---|
24 | pallo = new PhysicsObject(40.0, 40.0); |
---|
25 | Add(pallo); |
---|
26 | pallo.Shape = Shape.Circle; |
---|
27 | pallo.X = -200.0; |
---|
28 | pallo.Y = 0.0; |
---|
29 | Vector impulssi = new Vector(500.0, 0.0); |
---|
30 | pallo.Hit(impulssi); |
---|
31 | Level.CreateBorders(); |
---|
32 | pallo.Restitution = 1.0; |
---|
33 | Level.BackgroundColor = Color.Black; |
---|
34 | Camera.ZoomToLevel(); |
---|
35 | PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0); |
---|
36 | maila.Shape = Shape.Rectangle; |
---|
37 | maila.X = Level.Left + 20.0; |
---|
38 | maila.Y = 0.0; |
---|
39 | maila.Restitution = 1.0; |
---|
40 | Add(maila); |
---|
41 | } |
---|
42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.