source: 2014/27/JouniP_esimerkki/Pongpeli/Pongpeli/Pongpeli/Pongpeli.cs @ 5192

Revision 5192, 989 bytes checked in by jotapoti, 7 years ago (diff)

Lisätty esimerkki-Pong-peli, jossa yksi pallo ja maila.

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