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 | |
---|
12 | int luku = 1; |
---|
13 | PhysicsObject pallo; |
---|
14 | |
---|
15 | public override void Begin() |
---|
16 | { |
---|
17 | // TODO: Kirjoita ohjelmakoodisi tähän |
---|
18 | PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); |
---|
19 | //Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
20 | LuoKentta(); |
---|
21 | } |
---|
22 | |
---|
23 | void |
---|
24 | |
---|
25 | |
---|
26 | void LuoKentta() { |
---|
27 | |
---|
28 | pallo = new PhysicsObject(100, 100, Shape.Circle); |
---|
29 | pallo.Color = Color.Beige; |
---|
30 | this.Add(pallo); |
---|
31 | Level.BackgroundColor = Color.AshGray; |
---|
32 | Mouse.IsCursorVisible = true; |
---|
33 | Vector sijainti = Mouse.PositionOnScreen; |
---|
34 | Level.CreateBorders(1.0, false); |
---|
35 | Vector impulssi = new Vector(0, -250); |
---|
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 | PhysicsObject maila2 = PhysicsObject.CreateStaticObject(20.0, 100.0); |
---|
45 | maila2.Shape = Shape.Rectangle; |
---|
46 | maila2.X = Level.Right - 20.0; |
---|
47 | maila2.Y = 0.0; |
---|
48 | maila2.Restitution = 1.0; |
---|
49 | Add(maila2); |
---|
50 | |
---|
51 | } |
---|
52 | |
---|
53 | |
---|
54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.