Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: NiksterG on Mon 14/08/2006 21:51:23

Title: Need character to walk backwards [SOLVED]
Post by: NiksterG on Mon 14/08/2006 21:51:23
In my game, the main character climbs up a ladder, and then back down again later. The going up part is easy; I just have cplayer.walk(...) and he goes the right way. But when he comes down again, he's not facing the ladder. I tried using FaceLocation before he moves, and I also tried animate the character and move him at the same time. These didn't work. Any suggestions?
Title: Re: Need character to walk backwards
Post by: Arcangel on Mon 14/08/2006 23:27:21
Character.FaceLocation(int x, int y, optional BlockingStyle)

If need to look some object before (your ladder)
Character.FaceObject(Object* object, optional BlockingStyle)


Down the ladder (Character back) maybe you need to change the view
Character.ChangeView(int view)

Or move the animation in (Backwards)
Character.Animate(int loop, int delay, optional RepeatStyle,
                  optional BlockingStyle, optional Direction)
Title: Re: Need character to walk backwards
Post by: NiksterG on Tue 15/08/2006 01:15:05
I tried to do what you suggested, changing the blockingstyle and objects, and I tried having it in repeat, among other things. They don't work. The only thing I can think of doing is making a whole new view, but I don't want to do that unless absolutely necessary. Isn't there some way I can change the character.x value or something while he's moving to make him face a certain direction? The best way I can describe it is having the character do a moonwalk.

Also, i have a question about blinking views. I want there to be a bird which is always in the air. In other words, when the bird is not moving anywhere (standing), I want him to be flapping his wings repeatedly. I tried to use blinking view and the blinkinterval property, but it doesn't make the player do anything. Is that because the blinking view can't be the same as the normal view?

Thanks for any help.
Title: Re: Need character to walk backwards
Post by: Alynn on Tue 15/08/2006 05:55:46
Not tested but this should work... or at least point you in the right direction

player.Animate(3, 1, eRepeat, eNoBlock);
while (player.y < yValueYouWantToMoveTo) {
Ã,  Ã, player.y++;
Ã,  Ã, Wait(1);
}


You may or may not need the wait there to make it look right, and you will most likely have to play with the start and end y values to get him centered, but it should work. Just make sure the player isn't moving before you do this.

EDIT:

Also for your question about blinking view,  use the idle view instead and set the idle interval to 0. The bird will now constantly flap his wings.
Title: Re: Need character to walk backwards
Post by: Ishmael on Tue 15/08/2006 06:52:01
Just create a new view where the loop you're now see as the backward one is the same, but flipped, and change to that view before he climbs down the ladder, and back when he's down.
Title: Re: Need character to walk backwards
Post by: SSH on Tue 15/08/2006 09:32:52
What Ishmael said
Title: Re: Need character to walk backwards
Post by: Arcangel on Tue 15/08/2006 22:59:26
lol

What AGS version u use?
Its possible to view part of your code. (Character down ladder)
Title: Re: Need character to walk backwards
Post by: NiksterG on Tue 15/08/2006 23:25:09
Thanks alynn, I tried your code, and after a little bit of editing (adding a lockview to stop animation) I got it to work perfectly. And thanks for the idleview help, too... I wouldn't have checked there  :P

Thanks everyone else for your help!