source: 2012/26/TuomasL/PhysicsManipulator/PhysicsManipulator/PhysicsManipulator/PhysicsManipulator.cs @ 3293

Revision 3293, 1.4 KB checked in by tusalain, 9 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
9//Lisätyt aliohjelmat: GetAllObjects, GetShapedObjects, GetObjectsByType,
10//MakeTransparent, DestroyAll, DestroyShaped, Destroy
11
12public class PhysicsManipulator : PhysicsGame {
13
14    public override void Begin() {
15
16       
17
18        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli");
19        Mouse.Listen(MouseButton.Left, ButtonState.Pressed, Hiiren1Painettu, "Painetaan hiiren vasenta nappia");
20        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");
21    }
22
23    Shape RandomShape() {
24
25        int ShapeValue = RandomGen.NextInt(0, 6);
26
27        switch (ShapeValue) {
28
29            case 0:
30
31                return Shape.Circle;
32            case 1:
33
34                return Shape.Diamond;
35            case 2:
36
37                return Shape.Heart;
38            case 3:
39
40                return Shape.Star;
41            default:
42
43                return Shape.CreateRegularPolygon(RandomGen.NextInt(0, 10));
44        }
45    }
46   
47    PhysicsObject NewObject(double sX, double sY, Shape shape) {
48       
49        PhysicsObject obj = new PhysicsObject(sX, sY);
50        obj.Shape = shape;
51        Add(obj);
52
53        return obj;
54    }
55
56    void Hiiren1Painettu() {
57
58
59    }
60}
Note: See TracBrowser for help on using the repository browser.