source: 2012/JAO/JaakkoSivill/pong/pong/pong/pong.cs @ 2683

Revision 2683, 1.1 KB checked in by anonymous, 11 years ago (diff)
Line 
1using System;
2using System.Collections.Generic;
3using Jypeli;
4using Jypeli.Assets;
5using Jypeli.Controls;
6using Jypeli.Effects;
7using Jypeli.Widgets;
8
9public class pong : PhysicsGame
10{
11    PhysicsObject pallo;
12
13   
14
15    public override void Begin()
16    {
17        LuoKentta();
18        AloitaPeli();
19        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli");
20        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");
21    }
22    void LuoKentta()
23    {
24        pallo = new PhysicsObject(40.0, 40.0);
25        Add(pallo);
26        pallo.Shape = Shape.Circle;
27        pallo.X = -200.0;
28        pallo.Y = 0.0;
29        Vector impulssi = new Vector(500.0, 0.0);
30        pallo.Hit(impulssi);
31        Level.CreateBorders();
32        pallo.Restitution = 1.0;
33        Level.BackgroundColor = Color.Black;
34        Camera.ZoomToLevel();
35        PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0);
36        maila.Shape = Shape.Rectangle;
37        maila.X = Level.Left + 20.0;
38        maila.Y = 0.0;
39        maila.Restitution = 1.0;
40        Add(maila);
41    }
42}
Note: See TracBrowser for help on using the repository browser.