Hi
I have two questions
1) when we have cycle walking, AGS ignore frame 0 and repeat it and back to frame 1. Is it possible back to frame 3 or another frame?
2)After finish walking and when character is stop ,I want make a small animate for stop character instead freeze in frame 0 . Is it possible too?
1) No, the behavior is hard-coded. The only way around this is writing custom walk code.
2) You can do this by tracking player.Moving:
// above repeatedly_execute
bool playerWasMoving;
// inside repeatedly_execute
if (!player.Moving && playerWasMoving) {
// player has stopped moving as of this frame
// animate character stopping
}
playerWasMoving = player.Moving;
Thanks a lot Khris . I put this code into the condition.
if((VIEW1==true)&&(cEgo.Loop==2)){cEgo.Animate(8, 0, eOnce, eNoBlock, eForwards); // 8 is animate stop loop for Right
And it's seems works fine. Is that your mean? or there is another way...
That should be:
if (cEgo.View == VIEW1 && cEgo.Loop == 2) cEgo.Animate(8, 0, eOnce, eNoBlock);
If you use the same order for your additional loops, you can use cEgo.Animate(cEgo.Loop + 6, 0, eOnce, eNoBlock);
Great!!
Thanks so much Khris
Edit : Sorry I find a problem . i write this two code :
if (cEgo.View == VIEW1 && cEgo.Loop == 2) cEgo.Animate(8, 0, eOnce, eNoBlock);// for Right
if (cEgo.View == VIEW1 && cEgo.Loop == 0) cEgo.Animate(9, 0, eOnce, eNoBlock);// for Downn
After play line one , If I click down of player It didn't show down walking.And play same stop walking for right with reverse play!!!.Where is my wrong?
I was concerned about this, but since you reported this to work, didn't mention it; usually you have to call player.LockView() first, then .Animate(), then .UnlockView().
Since the animation is non-blocking though, implementing this properly will get A LOT more complicated.
You basically need to run non-blocking rep-exe code that will manually change the Frame of the character but stops and resets as soon as another walk command is called.
Since coding this requires setting up a test game and at least an additional half hour of work, I'll have to pass on this for now.
I tried "player.LockView() first, then .Animate(), then .UnlockView()" and had same problem.
I'll try your suggestion although I'm not professional in coding.
Thanks
Like I said, you USUALLY would call LockView and UnlockView, but your animation is NON-BLOCKING, which means that won't work here.
What you want cannot be achieved with two or three well-placed lines; it requires much more work.
This is probably a stupid question, but...
Any special reason for not creating the Views with the exact frames you need? Then it would start and end exactly where you want them to. ???
I assume the first two frames of the animation are the "start walking" bits which shouldn't repeat.
Mehrdad has asked essentially this same question several times before: http://www.adventuregamestudio.co.uk/forums/index.php?topic=51837.0
Did you try my suggestion? (Keep the start/stop animations in a separate view, which you play before the character starts walking/after it stops?) If you did, why didn't it work? If not, why are you asking again?
Quote from: Cassiebsg on Wed 16/09/2015 17:05:03
This is probably a stupid question, but...
Any special reason for not creating the Views with the exact frames you need? Then it would start and end exactly where you want them to. ???
I wish it were that simple.
Quote from: Snarky on Wed 16/09/2015 18:18:21
I assume the first two frames of the animation are the "start walking" bits which shouldn't repeat.
Mehrdad has asked essentially this same question several times before: http://www.adventuregamestudio.co.uk/forums/index.php?topic=51837.0
Did you try my suggestion? (Keep the start/stop animations in a separate view, which you play before the character starts walking/after it stops?) If you did, why didn't it work? If not, why are you asking again?
AGS ignore frame 0 only in per view and repeat animations as cycle and it's not enough for me because I have more than 2 frames for anticipation before walking.
That old topic was about turning animation before walking with a module by Ali.That had a main problem that used TWO LOOPS for Down to Up for example while I want ONE LOOP for turning and go straight a head.
Snarky, I read your suggestion before.unfortunately I didn't understand exactly what is your mean. Did you mean is Lock../Animate../Unlock.. for a separate view? if it's right , how can I write it for stop player in any direction?
Anyway I skip question 2 , As Question 1 is more important for me at the moment.
Thanks a lot guys
Quote from: Mehrdad on Thu 17/09/2015 06:17:30
Quote from: Snarky on Wed 16/09/2015 18:18:21
I assume the first two frames of the animation are the "start walking" bits which shouldn't repeat.
Mehrdad has asked essentially this same question several times before: http://www.adventuregamestudio.co.uk/forums/index.php?topic=51837.0
Did you try my suggestion? (Keep the start/stop animations in a separate view, which you play before the character starts walking/after it stops?) If you did, why didn't it work? If not, why are you asking again?
AGS ignore frame 0 only in per view and repeat animations as cycle and it's not enough for me because I have more than 2 frames for anticipation before walking.
That old topic was about turning animation before walking with a module by Ali.That had a main problem that used TWO LOOPS for Down to Up for example while I want ONE LOOP for turning and go straight a head.
I don't understand what you're objecting to. Are you saying you don't like that the animation is split across different loops? Well, that's the way it's got to be if you want some parts to loop and others not to.
Or are you saying that this question is different from the last one because it's not about turning, but about a "start walking" animation when you're going straight ahead? But this seems trivial: have the animations in separate loops again; if necessary, turn, then play the "start walking animation", then walk.
QuoteSnarky, I read your suggestion before.unfortunately I didn't understand exactly what is your mean. Did you mean is Lock../Animate../Unlock.. for a separate view? if it's right , how can I write it for stop player in any direction?
Basically what Khris wrote, with a small extension. I essentially feel like most of the steps have been explained, and you're very vague about what problems you're having, so it's tough to comment.
For now, I'll assume that the "turn on start walking" has been solved, and only deal with the stop animation:
// (Create a separate view that has the stop animation for the character, for all the different directions, and name it VSTOP)
bool playerWasMoving;
bool playerWasStopping;
// inside repeatedly_execute_always
{
if (!player.Moving && playerWasMoving)
{
// player has stopped moving as of this frame
// animate character stopping
cEgo.LockView(VSTOP);
cEgo.Animate(cEgo.Loop, 0, eOnce, eNoBlock);
playerWasStopping=true;
}
else if(!player.Animating && playerWasStopping)
{
cEgo.UnlockView();
playerWasStopping=false;
}
playerWasMoving = player.Moving;
}
You might also want to add a check in the on_mouse_click code, so that if the player tries to walk somewhere else while the stop moving animation is playing, this either gets ignored (easy but unresponsive, should be fine as long as the stop moving animation is short), unlocks the view before the walk starts (easy and responsive, but animation might glitch), or queues the walk until the stop animation has completed (slightly more work, might feel a bit unresponsive). That's up to you to decide what sort of behavior you want in this edge case.
Snarky, My explain for loops and straight ahead was about Ali's module turning character.This module have a big problem for use loops that it takes long speak.I can send PM for you If you want .And it's not important for me at the moment.
Your codes works perfect .Thanks so much for it. I have stand animate character with your codes now.Or I have FINISH TO WALKING.
Now I want similar to this code for START TO WALKING.It will be help for solve to start walking too. If it's still not clear please let me know.
Ah, we seem to be having a bit more of a language barrier than I realized. Sorry I snapped at you.
If you don't need the character to turn, start walking is very simple:
// Again, create a view with the "start walking" animations in each of the different directions, call it VSTART
void playerStartWalking(int x, int y)
{
player.LockView(VSTART);
player.Animate(player.Loop, 0, eOnce, eBlock);
player.UnlockView();
player.Walk(x,y);
}
And now you can just call playerStartWalking() instead of player.Walk(). If you need it non-blocking it's a bit more work, but can be done similarly to the last example.
If you need it to turn first it gets significantly more complicated, and you should probably use Ali's module as a starting point. I'm still not clear on what problem you're having with it, so I can't really help.
Sorry for stupid question : Where do I put this function? And Is it use automatically before walking or I have to write it for any walk?
I send for you problem of Ali's module now
You'd put it in the global script, or if you want in a script module. In order to call it from room scripts, you also need to add an import line to the globalscript header:
import void playerStartWalking(int x, int y);
And yes, you have to call this function instead of the regular walk function when you want to use it.
Ok. Thanks you very much.And Sorry for bad English