FIFE forums

Please login or register.

Login with username, password and session length
Advanced search  


FIFE 0.4.0 has been released on 15th of January, 2017!

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Toetag

Pages: [1]
Game creators corner / Keyboard Movement
« on: April 05, 2013, 05:57:34 pm »
I want to make the player character from tutorial1d movable by using WASD-keys. I have come pretty far but now I am a bit stuck. I could not find an Instance.move()-method only taking direction and speed as arguments, but one working with a target-location, as used in the tutorial.
I actually got it working but it is a poor workaround.

In case there is no such method somewhere under the hood I will explain what I have got so far:
I cloned the player-instance's Location, moved it relatively up/down the x/y axis and made the player character move to this location as long as the corresponding keys are pressed. As supposed to, the player character moves up while pressing W, down on S and so on, even the animations are acceptable. BUT... if I stop the character between two cells and then change direction, the character first slides sideways until it snaps on a cell-row or a diagonal. In a mouse-controlled context the pathing system is a huge advantage but for "direct" key-control it feels kinda squishy.
What I would expect for the final result is either the character to not stop between two cells and keep walking until the next one or (preferably) to just go straight ahead even between cell-rows.
I would appreciate any hint on this.

Many thanks in advance!

Pages: [1]