source: 2011/24/MiskaK/Sniper/Sniper/Sniper/Peli.cs @ 1979

Revision 1979, 1.7 KB checked in by mikrkana, 12 years ago (diff)
Line 
1using System;
2using System.Collections.Generic;
3using Jypeli;
4using Jypeli.Assets;
5using Jypeli.Controls;
6using Jypeli.Effects;
7using Jypeli.Widgets;
8
9public class Sniper : PhysicsGame
10{
11   
12    PhysicsObject maalitaulu;
13
14    PhysicsObject tähtäin;
15
16    Image taulunKuva = LoadImage("maalitaulu");
17    Image tähtäimenKuva = LoadImage("tähtäin2");
18
19    public override void Begin()
20    {
21        LuoTähtäin();
22        AsetaOhjaimet();
23        LuoKenttä();
24        LuoMaalitaulu(200.0, 200.0);
25    }
26
27    void LuoTähtäin()
28    {
29        tähtäin = new PhysicsObject(100, 100);
30        tähtäin.Image = tähtäimenKuva;
31        Mouse.ListenMovement(0.1, LiikutaTähtäintä, null);
32        tähtäin.IgnoresGravity = true;
33        tähtäin.IgnoresCollisionResponse = true;
34        tähtäin.CanRotate = false;
35
36        Add(tähtäin, 1);
37    }
38
39    void LuoKenttä()
40    {
41        Level.BackgroundColor = Color.Black;
42        Gravity = new Vector(0.0, -80.0);
43    }
44
45    void AsetaOhjaimet()
46    {
47        Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu");
48        //Mouse.ListenOn(maalitaulu, MouseButton.Left, ButtonState.Down, Ammu, null);
49 
50
51 
52
53
54    }
55
56    void Ammu()
57    {
58
59    }
60
61    void LuoMaalitaulu( double x, double y)
62    {
63        maalitaulu = new PhysicsObject(100, 100);
64        maalitaulu.Image = taulunKuva;
65        maalitaulu.X = x;
66        maalitaulu.Y = y;
67        Add(maalitaulu);
68    }
69
70    void LiikutaTähtäintä(AnalogState hiirenTila)
71    {
72        tähtäin.X = Mouse.PositionOnWorld.X;
73        tähtäin.Y = Mouse.PositionOnWorld.Y;
74
75        Vector hiirenLiike = hiirenTila.MouseMovement;
76
77    }
78
79
80
81}
82
Note: See TracBrowser for help on using the repository browser.