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 | |
---|
9 | //Lisätyt aliohjelmat: GetAllObjects, GetShapedObjects, GetObjectsByType, |
---|
10 | //MakeTransparent, DestroyAll, DestroyShaped, Destroy, GetButton |
---|
11 | |
---|
12 | public class PhysicsManipulator : PhysicsGame { |
---|
13 | |
---|
14 | public override void Begin() { |
---|
15 | |
---|
16 | Image img = LoadImage("MainWithButtons"); |
---|
17 | Image img2 = LoadImage("MainWithOutButtons"); |
---|
18 | |
---|
19 | ImageButtons button = new ImageButtons(); |
---|
20 | //button.GetB(new Color(255, 255, 255), new Color(250, 250, 250)); |
---|
21 | button.GetButton(img, img2, Color.White, new Color(250, 250, 250)); |
---|
22 | |
---|
23 | GameObject kuva = new GameObject(button.buttons[0]); |
---|
24 | |
---|
25 | PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); |
---|
26 | Mouse.Listen(MouseButton.Left, ButtonState.Pressed, Hiiren1Painettu, "Painetaan hiiren vasenta nappia"); |
---|
27 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
28 | } |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | Shape RandomShape() { |
---|
33 | |
---|
34 | int ShapeValue = RandomGen.NextInt(0, 6); |
---|
35 | |
---|
36 | switch (ShapeValue) { |
---|
37 | |
---|
38 | case 0: |
---|
39 | |
---|
40 | return Shape.Circle; |
---|
41 | case 1: |
---|
42 | |
---|
43 | return Shape.Diamond; |
---|
44 | case 2: |
---|
45 | |
---|
46 | return Shape.Heart; |
---|
47 | case 3: |
---|
48 | |
---|
49 | return Shape.Star; |
---|
50 | default: |
---|
51 | |
---|
52 | return Shape.CreateRegularPolygon(RandomGen.NextInt(0, 10)); |
---|
53 | } |
---|
54 | } |
---|
55 | |
---|
56 | PhysicsObject NewObject(double sX, double sY, Shape shape) { |
---|
57 | |
---|
58 | PhysicsObject obj = new PhysicsObject(sX, sY); |
---|
59 | obj.Shape = shape; |
---|
60 | Add(obj); |
---|
61 | |
---|
62 | return obj; |
---|
63 | } |
---|
64 | |
---|
65 | void Hiiren1Painettu() { |
---|
66 | |
---|
67 | |
---|
68 | } |
---|
69 | } |
---|