source: 2013/27/Emil-AleksiK/dp1/dp1/dp1/dp1.cs @ 4376

Revision 4376, 1.3 KB checked in by juiitamm, 6 years ago (diff)

Talletus.

Line 
1using System;
2using System.Collections.Generic;
3using Jypeli;
4using Jypeli.Assets;
5using Jypeli.Controls;
6using Jypeli.Effects;
7using Jypeli.Widgets;
8
9public class dp1 : PhysicsGame
10{
11    PhysicsObject dp;
12    public override void Begin()
13    {
14        dp = new PhysicsObject(60,60,Shape.Circle);
15        Add(dp);
16        Level.CreateBorders(0, false);
17        Camera.ZoomToLevel();
18
19        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli");
20        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");
21        Keyboard.Listen(Key.Right, ButtonState.Down, liiku, null, 500.0, 0.0);
22        Keyboard.Listen(Key.Right, ButtonState.Released, liiku, null, 0.0, 0.0);
23        Keyboard.Listen(Key.Left, ButtonState.Down, liiku, null, -500.0, 0.0);
24        Keyboard.Listen(Key.Left, ButtonState.Released, liiku, null, 0.0, 0.0);
25        Keyboard.Listen(Key.Up, ButtonState.Down, liiku, null, 0.0, 500.0);
26        Keyboard.Listen(Key.Up, ButtonState.Released, liiku, null, 0.0, 0.0);
27        Keyboard.Listen(Key.Down, ButtonState.Down, liiku, null, 0.0, -500.0);
28        Keyboard.Listen(Key.Down, ButtonState.Released, liiku, null, 0.0, 0.0);
29       
30    }
31
32    void liiku(double X,double Y)
33    {
34        dp.Velocity = new Vector(X,Y);
35
36    }
37}
Note: See TracBrowser for help on using the repository browser.