Tile-Based movement
Displaying 1-7 of 7 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Gayo

OK, I have been trying to figure out a way to get the player-controlled character to move one tile at a time (vertically or horizontally; basically the way it worked in V2) without hiijacking the entire movement system.

My first idea was to make the "player" character an ordinary NPC and have it moved around through movescripts. I bound the directional keys to functions that assigned a one-tile movescript to the entity if the current movecode was 0 -- for example, if movecode is 0, the "PressDown" function changes the pseudo-player's movescript to "D1." This works nicely enough, but you have to press the button again every tile -- you can't just hold it down and keep moving in that direction. Then I tried HookTimering a function that checked what directional buttons you were using, but my HookTimered "if (key[SCAN_DOWN] == TRUE)" (and others) always returned false for some reason. So that's a no go. Can anyone think of another way for me to do this? I'd really like to avoid just taking control of the entity processing entirely.

Posted on 2004-04-25 09:02:13 (last edited on 2004-04-25 09:07:46)

Gayo

...well, I found out why my key[SCAN_DOWN] wasn't equalling 1, anyway...for some reason it was going to -128 when pressed, so changing that to "is not equal to 0" fixes that much at least. Let's see if this works now..

[later] Yep, that does the trick. The problem is that for each brief instant that the character "stops", he resets to idle, so he has a stuttering walk. Better solutions (or at least a way to solve the walk problem) would still be highly appreciated, though.

Posted on 2004-04-25 09:13:27 (last edited on 2004-04-25 09:24:56)

el_desconocido

Maybe tell them to walk 20 steps. Then stop them at the next availiable tile boundry when the button gets released.

And loading movecodes into strings (to then pass to ents) for walking, etc is easier than it seems.

Hope that helps.
El

Posted on 2004-04-25 11:10:38

ThinIce

bleh; unless you REALLY need that tile based movement it'll be a pain to put in, because you also need to check for obstructions

Posted on 2004-04-25 12:21:52

Gayo

Obstruction-checking is easy; I already have it in. Checking for obstructiony entities will be a touch more work, but nothing traumatic.

As for the moving 20 steps, it seems like that system might have problems with stopping at the right time, but I suppose it's worth a look. I tried setting it to moving one step and repeating the movestring (R1B for right, and so on), but this actually causes the stuttery walk also, which surprised me. Vecna, any way to avoid that?

Posted on 2004-04-25 19:41:32

rpgking

I remember back in the day when people were trying to hijack the tile-based movement to hack in pixel-perfect movement. Never thought I'd see it the other way around :P

Posted on 2004-04-26 01:35:56

Gayo

Got it.

Posted on 2004-04-26 03:35:06


Displaying 1-7 of 7 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.