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 ball; |
---|
12 | public override void Begin() |
---|
13 | { |
---|
14 | |
---|
15 | // TODO: Kirjoita ohjelmakoodisi tähän |
---|
16 | LuoKentta(); |
---|
17 | Vector impulssi = new Vector(500.0, 0.0); |
---|
18 | ball.Hit(impulssi); |
---|
19 | |
---|
20 | Level.Background.CreateGradient(Color.Black,Color.Blue); |
---|
21 | PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); |
---|
22 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
23 | Camera.ZoomToLevel(); |
---|
24 | |
---|
25 | } |
---|
26 | void LuoKentta() |
---|
27 | { |
---|
28 | ball = new PhysicsObject(50, 50); |
---|
29 | ball.Shape = Shape.Circle; |
---|
30 | ball.Color = Color.Black; |
---|
31 | Add(ball); |
---|
32 | |
---|
33 | ball.X = -200.0; |
---|
34 | ball.Restitution = 1.0; |
---|
35 | Level.CreateBorders(1.0, false); |
---|
36 | |
---|
37 | PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0); |
---|
38 | maila.Shape = Shape.Rectangle; |
---|
39 | maila.X = Level.Left + 20.0; |
---|
40 | maila.Y = 0.0; |
---|
41 | maila.Restitution = 1.0; |
---|
42 | Add(maila); |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | |
---|
47 | } |
---|
48 | |
---|
49 | void AloitaPeli() |
---|
50 | { |
---|
51 | |
---|
52 | } |
---|
53 | } |
---|
54 | |
---|
55 | |
---|
56 | |
---|
57 | |
---|
Note: See
TracBrowser
for help on using the repository browser.