source: 2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/Player.cs @ 2252

Revision 2252, 1.1 KB checked in by teeevasa, 8 years ago (diff)

Talletus.

Line 
1using System;
2using Jypeli;
3using Jypeli.Assets;
4using Jypeli.Controls;
5using Jypeli.Effects;
6using Jypeli.Widgets;
7
8public class Player : GenCharacter
9{
10    int speed = 200;
11    const int jumpSpeed = 1000;
12
13    // Miten voidaan viitata Contentiin?
14    //Image portrait = Game.LoadImage("character");
15
16        public Player(double width, double height, Shape shape)
17        : base(width, height, shape)
18        {
19        hitPoints = 100;
20        AddedToGame += addControls;
21        //this.Image = portrait;
22        }
23
24    public void addControls()
25    {
26        Game.Keyboard.Listen(Key.Right, ButtonState.Down, moveRight, "Moves right", speed);
27        Game.Keyboard.Listen(Key.Left, ButtonState.Down, moveLeft, "Moves left", speed);
28        Game.Keyboard.Listen(Key.Up, ButtonState.Down, jump, "Jumps", jumpSpeed);
29    }
30
31    public void moveRight(int speed)
32    {
33        this.Walk(speed);
34    }
35
36    public void moveLeft(int speed)
37    {
38        this.Walk(-speed);
39    }
40
41    public void jump(int jumpSpeed)
42    {
43        this.Jump(jumpSpeed);
44    }
45
46}
Note: See TracBrowser for help on using the repository browser.