source: 2016/27/ohjaajat/VenienteFragore/VenienteFragore/VenienteFragore/SimplePlatformCharacter.cs @ 7826

Revision 7826, 928 bytes checked in by sieerinn, 3 years ago (diff)

Luomismetodit siirretty LevelCreationMethods?.cs tiedostoon ja kaikenlaista koodin siistimistä tehty

Line 
1using Jypeli;
2using System;
3using System.Collections.Generic;
4using System.Linq;
5using System.Text;
6
7namespace VenienteFragore
8{
9    class SimplePlatformCharacter : InteractableObject
10    {
11        public bool IsGrounded { get; private set; }
12
13        public Direction FacingDirection { get; private set; }
14
15        public SimplePlatformCharacter(double width, double height) : base(width, height)
16        {
17            FacingDirection = Direction.Right;
18        }
19
20        public void Walk(double speed)
21        {
22            if (speed > 0) FacingDirection = Direction.Right;
23            if (speed < 0) FacingDirection = Direction.Left;
24            Velocity = new Vector(speed, Velocity.Y);
25        }
26
27        public override void Update(Time time)
28        {
29            base.Update(time);
30            IsGrounded = Game.Collisions(this, new Vector(0, -2), true).Count > 0;
31        }
32    }
33}
Note: See TracBrowser for help on using the repository browser.