![]() |
Simple Movement
Here is a good way to move your object in all directions very easily.
PHP Code:
|
Hmm, there's a problem with this.
One, there's no loop, you're calling it on keypressed(unless you want it to be a more systematic movement than fluid). As I believe, keypressed is called when the key is first pressed, then the repeat(which is defined personally in the keyboard properties, so this will react very slowly if the person has the key repeat very low). Also, I think it'd be better if you used keydown(0-3), they're the default keys for arrow movement, and are also compatible with gamepads. |
Update
PHP Code:
|
Do you want to add some onwall checks later? :]
|
Disable is one word -.-
disableDefMovement(); instead of disAbleDefMovement(); |
Quote:
Quote:
|
Quote:
Anyways, I think you should add the checks, just for the sake of it. May help out some peeps. |
Quote:
update PHP Code:
|
I would atleast define the middle of the player ;P
PHP Code:
|
| All times are GMT +2. The time now is 10:12 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.