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 FysiikkaPeli1 |
---|
20 | { |
---|
21 | public class Peli : PhysicsGame |
---|
22 | { |
---|
23 | PhysicsObject pallo; |
---|
24 | |
---|
25 | protected override void LoadContent() |
---|
26 | { |
---|
27 | |
---|
28 | |
---|
29 | |
---|
30 | Level = LuoKentta(); |
---|
31 | |
---|
32 | AloitaPeli(); |
---|
33 | |
---|
34 | } |
---|
35 | |
---|
36 | |
---|
37 | Level LuoKentta() |
---|
38 | { // LuoKentta-aliohjelman sisältö... |
---|
39 | Level kentta = new Level( this ); |
---|
40 | kentta.BackgroundColor = Color.Purple; |
---|
41 | |
---|
42 | IShape ympyra = Shapes.CreateCircle( 20.0 ); |
---|
43 | pallo = new PhysicsObject(10.0, ympyra); |
---|
44 | |
---|
45 | pallo.X = -200.0; |
---|
46 | pallo.Y = 0.0; |
---|
47 | pallo.Restitution = 1.0; |
---|
48 | kentta.Objects.Add( pallo ); |
---|
49 | |
---|
50 | |
---|
51 | IShape suorakulmio = Shapes.CreateRectangle( 20.0, 100.0 ); |
---|
52 | PhysicsObject maila = PhysicsObject.CreateStaticObject( suorakulmio ); |
---|
53 | maila.X = kentta.Left + 20.0; |
---|
54 | maila.Y = 0.0; |
---|
55 | maila.Restitution = 1.0; |
---|
56 | kentta.Objects.Add( maila ); |
---|
57 | |
---|
58 | kentta.CreateBorder( 1.0, false ); |
---|
59 | |
---|
60 | return kentta; |
---|
61 | } |
---|
62 | |
---|
63 | |
---|
64 | void AloitaPeli() |
---|
65 | { |
---|
66 | Vector2D impulssi = new Vector2D(2000.0, 0.0); |
---|
67 | pallo.Hit(impulssi); |
---|
68 | } |
---|
69 | |
---|
70 | |
---|
71 | } |
---|
72 | } |
---|
73 | |
---|
74 | |
---|
75 | |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | |
---|
80 | |
---|
81 | |
---|
82 | |
---|
Note: See
TracBrowser
for help on using the repository browser.