Hi Again.
I'm trying to work out if its possible to use a region to disable a keycode....or if its even possible to disable a keycode at all.
In the game I'm working on, my character has the ability to enter crawl mode by toggling the C key.
(http://img177.imageshack.us/img177/1989/crawl01ar0.png)
Now as you can see...the movement and crawling animation, walk behinds and key pressing is working splendidly.
(http://img122.imageshack.us/img122/9004/crawl02jk6.png)
However, of course, while being under the "little tunnel", I could easily STILL press the C key, and stand back up.
This is obviously a problem, I don't want my character to toggle back to standing position WHILE under the tunnel. If he stands while under the tunnel, the walk-behinds set for this "little tunnel" will disable, and the character will unfortunately appear like in the bottom picture:
(http://img229.imageshack.us/img229/6131/crawl3ayo7.png)
My thoughts to this problem could be the use of Regions. Where, if my character were to be crawling on a region, the C Keycode would be disabled. If this command exists, then it would make things more easier. With regions, it would be helpful when my character would encounter a wall.
So, is this actually possible? Can this be done? Is my solution wrong, or is there a better way?
Thanks. I'll appreciate any comments and help.
Presumably you have some script in on_key_press like this:
if (keycode == 'C')
{
// do standing up stuff
}
you can simply change it to something like:
if ((keycode == 'C') && (Region.GetAtRoomXY(player.x, player.y) == region[0]))
{
// do standing up stuff ONLY if not on a region
}
that code will disable the C key if the player is on any region, so you'd probably want to customize it for your needs -- but hopefully that gives you the general idea.
Wow, it works. Thanks.
I was about to post a message about why it wasn't working when I applied the code. I waited a bit, try to configure things a bit, and then it worked.
Thanks alot mate, I appreciate it.