View previous topic :: View next topic |
Author |
Message |
djfenix

Joined: 12 Mar 2003 Posts: 359
|
Posted: Fri Feb 02, 2007 8:58 pm Post subject: Lagged Movement |
|
|
Generally what I'm trying to do is disable menus so i can make a custom menu. If anyone has any suggestions or better ideas, please help me out!
Code: |
suspend player
while (true) do(
if(keyispressed(key:up)) then(
walk hero (me, up, 1)
wait for hero
)
if(keyispressed(key:left)) then(
walk hero (me, left, 1)
wait for hero
)
#etc
#etc
)
|
The only way i can think of doing this is suspending the player, then just making the hero move whenever the key is pressed. Without the wait for hero command, the player can just move about tile by tile in any direction, and eventually doesnt stop on the tile properly and also passing walls via the corners.
So, any suggestions, or better ideas? I'm all ears (or, well, in this case, eyes) |
|
Back to top |
|
 |
Iblis Ghost Cat

Joined: 26 May 2003 Posts: 1233 Location: Your brain
|
Posted: Fri Feb 02, 2007 9:39 pm Post subject: |
|
|
What does moving the hero around like that have to do with making a custom menu? _________________ Locked
OHR Piano |
|
Back to top |
|
 |
Rimudora Psychopath yandere Halloween 2006 Creativity Winner


Joined: 26 May 2005 Posts: 335
|
Posted: Fri Feb 02, 2007 9:49 pm Post subject: |
|
|
He's trying to make the menu not come up when the player presses Esc, and the best idea he's come up with so far is using suspending the hero's movement and have the player control him with a script.
I think someone once posted a really simple solution involving a keypress script here before, but I can't find it.
EDIT: Found it.
The Mad Cacti wrote: | Actually, it's not necessary to script anything yourself that you might disable with suspend player. Because the script interpreter runs before anything else, you can selectively block any key you want:
Code: | script, onkeypress handler, begin
if (key is pressed(key:esc), or, key is pressed(key:alt)) then (
suspend player
wait(1)
resume player
)
end |
|
|
|
Back to top |
|
 |
djfenix

Joined: 12 Mar 2003 Posts: 359
|
Posted: Fri Feb 02, 2007 10:32 pm Post subject: |
|
|
wow.. that is simple...
works for me! thanks! |
|
Back to top |
|
 |
|