source: zhipeng_j/pong/Peli.cs @ 214

Revision 214, 1.7 KB checked in by zhjiang, 14 years ago (diff)
Line 
1#region Usings
2using System;
3using System.Collections.Generic;
4using System.Linq;
5using Microsoft.Xna.Framework;
6using Microsoft.Xna.Framework.Audio;
7using Microsoft.Xna.Framework.Content;
8using Microsoft.Xna.Framework.Graphics;
9using Microsoft.Xna.Framework.Input;
10using Microsoft.Xna.Framework.Media;
11using Jypeli;
12using Jypeli.ScreenObjects;
13using Jypeli.Assets;
14using AdvanceMath;
15using Physics2DDotNet;
16using Physics2DDotNet.Shapes;
17#endregion
18
19namespace 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.