Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Lagged Movement

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
djfenix




Joined: 12 Mar 2003
Posts: 359

PostPosted: Fri Feb 02, 2007 8:58 pm    Post subject: Lagged Movement Reply with quote

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
View user's profile Send private message
Iblis
Ghost Cat




Joined: 26 May 2003
Posts: 1233
Location: Your brain

PostPosted: Fri Feb 02, 2007 9:39 pm    Post subject: Reply with quote

What does moving the hero around like that have to do with making a custom menu?
_________________
Locked
OHR Piano
Back to top
View user's profile Send private message Send e-mail
Rimudora
Psychopath yandere
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 26 May 2005
Posts: 335

PostPosted: Fri Feb 02, 2007 9:49 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
djfenix




Joined: 12 Mar 2003
Posts: 359

PostPosted: Fri Feb 02, 2007 10:32 pm    Post subject: Reply with quote

wow.. that is simple...

works for me! thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group