source: 2015/24/LeeviK/AS Bandit Experience/AS Bandit Experience/AS Bandit Experience/AS_Bandit_Experience.cs @ 5921

Revision 5921, 1.9 KB checked in by mikrkana, 4 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 AS_Bandit_Experience : PhysicsGame
10{
11    AssaultRifle banditAse;
12   
13    public override void Begin()
14    {
15        Level.BackgroundColor = Color.HotPink;
16        //ANUUUUU CHEEKI BREEKI IV DAMKE
17        IsFullScreen = true;
18        //MediaPlayer.Play(""); //CHEEKI BREEKI ATMOSFEARIC MUSIC
19       
20        PhysicsObject bandit = new PhysicsObject(40, 40);
21        bandit.Shape = Shape.Circle;
22        bandit.Mass = 8.0;
23        Image PelaajanKuva = LoadImage("bandit");
24        bandit.LinearDamping = 0.75;
25        bandit.Image = PelaajanKuva;
26        Add(bandit);
27        banditAse = new AssaultRifle(30, 10);
28        banditAse.Ammo.Value = 30;
29        bandit.Add(banditAse);
30
31        //Camera.Follow( bandit );
32        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");
33        Keyboard.Listen(Key.A, ButtonState.Down, LiikutaBandit, null, new Vector(-1000, 0), bandit);
34        Keyboard.Listen(Key.D, ButtonState.Down, LiikutaBandit, null, new Vector(1000, 0), bandit);
35        Keyboard.Listen(Key.W, ButtonState.Down, LiikutaBandit, null, new Vector(0, 1000), bandit);
36        Keyboard.Listen(Key.S, ButtonState.Down, LiikutaBandit, null, new Vector(0, -1000), bandit);
37        Keyboard.Listen(Key.Space, ButtonState.Pressed, bandit.Destroy, null); //Tuhoaa Pelaajan testinä
38        Mouse.Listen(MouseButton.Left, ButtonState.Down, AmmuAseella, "Ammu", banditAse);
39
40    }   
41
42    void LiikutaBandit(Vector vektori, PhysicsObject bandit)
43    {
44        vektori *= 10;
45        bandit.Push(vektori);
46
47    }
48     
49    void AmmuAseella(AssaultRifle ase)
50    {
51        PhysicsObject ammus = ase.Shoot();
52
53        if (ammus != null)
54        {   
55        }
56    }
57
58}
59
60
61
62
63
64
65
66
67
68
69
70
Note: See TracBrowser for help on using the repository browser.