Line | |
---|
1 | #region Usings |
---|
2 | using System; |
---|
3 | using System.Collections.Generic; |
---|
4 | using System.Linq; |
---|
5 | using Microsoft.Xna.Framework; |
---|
6 | using Microsoft.Xna.Framework.Audio; |
---|
7 | using Microsoft.Xna.Framework.Content; |
---|
8 | using Microsoft.Xna.Framework.Graphics; |
---|
9 | using Microsoft.Xna.Framework.Input; |
---|
10 | using Microsoft.Xna.Framework.Media; |
---|
11 | using Jypeli; |
---|
12 | using Jypeli.ScreenObjects; |
---|
13 | using Jypeli.Assets; |
---|
14 | using AdvanceMath; |
---|
15 | using Physics2DDotNet; |
---|
16 | using Physics2DDotNet.Shapes; |
---|
17 | #endregion |
---|
18 | |
---|
19 | namespace pong |
---|
20 | { |
---|
21 | public class Peli : PhysicsGame |
---|
22 | { |
---|
23 | protected override void LoadContent() |
---|
24 | { |
---|
25 | Level = LuoKentta(); |
---|
26 | |
---|
27 | } |
---|
28 | |
---|
29 | Level LuoKentta() |
---|
30 | { |
---|
31 | Level kentta = new Level(this); |
---|
32 | kentta.BackgroundColor = Color.Black; |
---|
33 | |
---|
34 | IShape ympyra = Shapes.CreateCircle(20.0); |
---|
35 | PhysicsObject pallo = new PhysicsObject(10.0, ympyra); |
---|
36 | pallo.X = -200.0; |
---|
37 | pallo.Y = 0.0; |
---|
38 | pallo.Restitution = 1.0; |
---|
39 | kentta.Objects.Add(pallo); |
---|
40 | |
---|
41 | IShape suorakulmio = Shapes.CreateRectangle(20.0, 100.0); |
---|
42 | PhysicsObject maila = PhysicsObject.CreateStaticObject(suorakulmio); |
---|
43 | maila.X = kentta.Left + 20.0; |
---|
44 | maila.Y = 0.0; |
---|
45 | maila.Restitution = 1.0; |
---|
46 | kentta.Objects.Add(maila); |
---|
47 | return kentta; |
---|
48 | |
---|
49 | |
---|
50 | |
---|
51 | |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | maila.X = kentta.Left + 20.0; |
---|
56 | maila.Y = 0.0; |
---|
57 | maila.Restitution = 1.0; |
---|
58 | kentta.Objects.Add(maila); |
---|
59 | |
---|
60 | Level kentta.CreateBorder(1.0, false); |
---|
61 | |
---|
62 | kentta.BackgroundColor = Color.Black; |
---|
63 | |
---|
64 | |
---|
65 | |
---|
66 | |
---|
67 | } |
---|
68 | } |
---|
69 | |
---|
70 | } |
---|
71 | |
---|
72 | |
---|
73 | |
---|
74 | |
---|
75 | |
---|
76 | |
---|
77 | |
---|
Note: See
TracBrowser
for help on using the repository browser.