Revision 519,
1.2 KB
checked in by teematma, 12 years ago
(diff) |
melkein valmis vihreätaustainen pong
|
Line | |
---|
1 | using System; |
---|
2 | using Jypeli; |
---|
3 | using Jypeli.ScreenObjects; |
---|
4 | using Jypeli.Assets; |
---|
5 | |
---|
6 | namespace Pong |
---|
7 | { |
---|
8 | public class Peli : PhysicsGame |
---|
9 | { |
---|
10 | PhysicsObject Pallo; |
---|
11 | |
---|
12 | protected override void Begin() |
---|
13 | { |
---|
14 | LuoKentta(); |
---|
15 | AloitaPeli(); |
---|
16 | } |
---|
17 | |
---|
18 | void LuoKentta() |
---|
19 | { |
---|
20 | Pallo = new PhysicsObject( 25.0, 25.0 ); |
---|
21 | Pallo.Shape = Shapes.Circle; |
---|
22 | Pallo.Restitution = 1.0; |
---|
23 | Pallo.KineticFriction = 0.0; |
---|
24 | Add ( Pallo ); |
---|
25 | Pallo.X = -200; |
---|
26 | Pallo.Y = 0; |
---|
27 | |
---|
28 | PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0); |
---|
29 | maila.Shape = Shapes.Rectangle; |
---|
30 | maila.X = Level.Left + 20.0; |
---|
31 | maila.Y = 0.0; |
---|
32 | maila.Restitution = 1.0; |
---|
33 | Add(maila); |
---|
34 | |
---|
35 | Level.CreateBorders( 1.0, false); |
---|
36 | Level.BackgroundColor = Color.YellowGreen; |
---|
37 | |
---|
38 | Camera.StayInLevel = true; |
---|
39 | |
---|
40 | } |
---|
41 | void AloitaPeli() |
---|
42 | { |
---|
43 | Vector impulssi = new Vector(500.0, 0.0); |
---|
44 | Pallo.Hit(impulssi); |
---|
45 | } |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | |
---|
Note: See
TracBrowser
for help on using the repository browser.