Isometric Walking

Started by Valentine, Wed 10/10/2007 15:35:02

Previous topic - Next topic

Valentine

Hi, I'm making an isometric game, and I want my character to be able to move via the keyboard, but only in the 8 isometric directions (so Up, Down, Left, Right, Upleft, Upright, Downleft, Downright). The problem is AGS's diagonal walkcycles work with actual diagonals (so 45°, 135°, 225° and 315°) whereas I need the diagonal walkcycles to work when the characters moving along an isometric diagonal (60°, 120°, 240° and 300°). Now I did make a workaround in which I used a second character with the appropriate character views, and switched between the two (presenting them as the same character) - one for up, down, left, right, and the other for the isometric diagonals. Unfortunately, my games got more complicated now and this method of doing things is causing me a lot of problems. Is there any way to set the default diagonal angles to work for isometric angles? Or a workaround which doesn't involving a fake second character?

Thanks for any help.

Ashen

#1
No, there's no way to set the angles for the Diagonal loops, although I think it's been on the tracker for some time (assuming that's what this entry means).

Depending on how you've set up the keyboard movement, though, it might be possible to force the character to use a certain Loop in repeatedly_execute, e.g.:
Code: ags

if (IsKeyPressed(372) && IsKeyPressed(375) && player.Moving) player.Loop = 7;
 // Force 'up-left' loop while player is moving up-left


Psuedocode, since I don't know how your movement code works...
I know what you're thinking ... Don't think that.

Valentine

Ah yeah, sorry, my mistake. It wasn't a fake character I used for the diagonals at first, it was a seperate view. The problems I'm having come from having the 'fake view'.

Is there any way to force a Loop?

Ashen

#3
Well, the code I gave above should force the Loop ... kind of why I mentioned it :) But of course it's just a very general example. To get more specific, I'd need to know your Keyboard movement code.

Basically you need some way to check if the character should be moving, and what direction (I used the arrow keys via IsKeyPressed and player.Moving) - I'd guess you've already got something like that in place, so you should be able to add the conditions pretty easily, but if not it shouldn't be too hard to add.
I know what you're thinking ... Don't think that.

LUniqueDan

Same thematic (will probably got the same answer) :

All my playing areas have 128 of height. Is there a way to give AGS a little more attraction toward Loop0 & Loop3 when the player click to walk ? So the way my characters walks are sometimes surrealistic. (It seems that my playing chars. face Left or Right more oftenly than needed.)

I overturned it the way I draw walkable areas (through doorways by example) but it's sometimes problematic (lots of very narrowed W.Areas + places I just can).

thanx.

"I've... seen things you people wouldn't believe. Destroyed pigeon nests on the roof of the toolshed. I watched dead mice glitter in the dark, near the rain gutter trap.
All those moments... will be lost... in time, like tears... in... rain."

Valentine

#5
Oops, I meant some way to lock the loop ::) silly me. I've tried with the code you suggested but it still switches to Up, Down, Left or Right. The code I'm using is like this;

if (keycode==379)                // DOWNLEFT ARROW
  {
player.Loop=6;
player.Walk(player.x-32, player.y+16, eBlock, eAnywhere);   
  }

EDIT;

Just realised this means it switches to the Loop I specify, but then switches back to the standard movement loop straight after. To stop this, I've used the following code;

if (keycode==379)                // DOWNLEFT ARROW
  {
PlayerLoop=6;
player.Walk(player.x-32, player.y+16, eBlock, eAnywhere);   
  }

if (player.Moving) player.Loop=PlayerLoop;

But I'm still not getting anywhere  :-\ Any idea what I'm doing wrong? Thanks again.

Ashen

Where have you get the if (player.Moving) player.Loop=PlayerLoop; line?
I just tested and typed up to post a very similar bit of code, and that worked OK. The only diference was I called the variable Dir, not PlayerLoop - which really doesn't matter. It should be in repeatedly_execute_always (always, because you use blocking movement, which'll pause rep_ex).
I know what you're thinking ... Don't think that.

Valentine

Aha!

It was because I only had it in Repeatedly Execute, not Repeatedly Execute Always. Thankyou very much for that  :) Can I just ask, is there a shudder between the Left Loop, then the Down Loop, before your character goes Downleft? There is in mine, and I'm unsure if this is the engine, or some bad coding on my part?

Thanks again!

Ashen

Do you have 'Characters turn before walking' checked (on the 'General Settings' pane)? I found that that caused a 'flash' of the wrong Loop (i.e. of the one ASG wanted to use) before moving - is that what you mean?
I know what you're thinking ... Don't think that.

Valentine

I'm having the flash of the wrong loop no matter if 'Characters turn before walking' is checked (I've tried them both). Do you not have that flash if that setting is unchecked?

SMF spam blocked by CleanTalk