source: 2017/27/MikaelL/pong/pong/pong/pong.cs @ 8843

Revision 8843, 1.2 KB checked in by npo17_33, 6 years ago (diff)

olen menossa 3ja4 vaihteessa

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    public override void Begin()
13    {
14        LuoKentta();
15        Vector inpulssi = new Vector(500.0, 0.0);
16       
17        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");
18        pallo.Hit(inpulssi);
19
20
21       
22
23
24
25    }
26    void LuoKentta()
27    {
28         pallo = new PhysicsObject(40.0, 40.0);
29        pallo.Shape = Shape.Circle;
30        Add(pallo);
31        pallo.X = -200.0;
32        pallo.Y = 0.0;
33
34        PhysicsObject maila = PhysicsObject.CreateStaticObject(20.0, 100.0);
35        maila.Shape = Shape.Rectangle;
36        maila.X = Level.Left + 20.0;
37        maila.Y = 0.0;
38        maila.Restitution = 1.0;
39        Add(maila);
40        Level.CreateBorders(1.0, false);
41        pallo.Restitution = 1.0;
42        Level.Background.Color = Color.Crimson;
43        Camera.ZoomToLevel();
44
45
46    }
47    void AloitaPeli ()
48    {
49        Vector inpulssi = new Vector(500.0, 0.0);
50        pallo.Hit(inpulssi);
51    }
52}
Note: See TracBrowser for help on using the repository browser.