Rev | Line | |
---|
[3227] | 1 | using System; |
---|
| 2 | using System.Collections.Generic; |
---|
| 3 | using Jypeli; |
---|
| 4 | using Jypeli.Assets; |
---|
| 5 | using Jypeli.Controls; |
---|
| 6 | using Jypeli.Effects; |
---|
| 7 | using Jypeli.Widgets; |
---|
| 8 | |
---|
[3293] | 9 | //Lisätyt aliohjelmat: GetAllObjects, GetShapedObjects, GetObjectsByType, |
---|
| 10 | //MakeTransparent, DestroyAll, DestroyShaped, Destroy |
---|
| 11 | |
---|
[3227] | 12 | public class PhysicsManipulator : PhysicsGame { |
---|
| 13 | |
---|
| 14 | public override void Begin() { |
---|
[3293] | 15 | |
---|
[3227] | 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) { |
---|
[3244] | 48 | |
---|
[3227] | 49 | PhysicsObject obj = new PhysicsObject(sX, sY); |
---|
| 50 | obj.Shape = shape; |
---|
[3293] | 51 | Add(obj); |
---|
[3227] | 52 | |
---|
| 53 | return obj; |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | void Hiiren1Painettu() { |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | } |
---|
| 60 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.