source: 2015/koodauskerho/ValtteriV/Dealer_Warfare/Dealer_Warfare/Dealer_Warfare/Dealer_Warfare.cs @ 7068

Revision 7068, 1.2 KB checked in by empaheik, 6 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 Dealer_Warfare : PhysicsGame
10{
11    Vector tavoitepaikka;
12    PhysicsObject player;
13    Image playerimage = LoadImage("PlayerWithShoes");
14    static Image[] PlayerImages = LoadImages(new string[] { "PlayerWithShoes2", "PlayerWithShoes3" } );
15    Animation PlayerAnim = new Animation(PlayerImages);
16    int pelaajanNopeus = 250;
17
18    public override void Begin()
19    {
20        IsMouseVisible = true;
21        SmoothTextures = false;
22
23        Player();
24        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Quit");
25        Mouse.Listen(MouseButton.Left, ButtonState.Pressed, Moveplayer, "Move Player");
26    }
27    void Player()
28    {
29        player = new PhysicsObject(125, 250);
30        player.Image = playerimage;
31        player.Animation = PlayerAnim;
32        player.Animation.Start();
33        player.Animation.FPS = 5;
34        Add(player);
35
36    }
37
38    void Moveplayer()
39    {
40        tavoitepaikka = Mouse.PositionOnWorld;
41        player.MoveTo(tavoitepaikka, pelaajanNopeus);
42
43    }
44
45}
Note: See TracBrowser for help on using the repository browser.