Adventure Game Studio | Forums

AGS Support => Beginners' Technical Questions => Topic started by: Slasher on Mon 26/01/2015 19:52:57

Title: SOLVED: AddWaypoint different speeds
Post by: Slasher on Mon 26/01/2015 19:52:57
Hi,

Loop 1 and 2: same amount of frames, same sprite numbers (flipped for view 1) but loop 2 is slower than loop 1.

Code (ags) Select

function room_RepExec()
{
  if (cTiger.Moving == false){
  cTiger.AddWaypoint(670, 367); // loop 2
  cTiger.AddWaypoint(458, 367);// loop 1
}
}


Title: Re: AddWaypoint different speeds
Post by: cadeultra3 on Tue 27/01/2015 01:55:05
You are running in RepExec(). Why?
That code is run every frame. So you are setting the way points over and over again.
Title: Re: AddWaypoint different speeds
Post by: Slasher on Tue 27/01/2015 05:03:13
Because it is patrolling.

Even this has the same result:
Code (ags) Select

if (cTiger.Moving ==false){
cTiger.Walk(670, cTiger.y);
cTiger.AddWaypoint(458,  cTiger.y);
}
}

Title: Re: AddWaypoint different speeds
Post by: Gilbert on Tue 27/01/2015 05:51:26
Just a random idea. Check whether there are delays set for the walking frames and whether these values match up in both loops, and also whether anti-glide mode is on. As when anti-glide mode is on, the character will only move when the animation frame changes, so if one of the loops has more delays than the other the character will walk slower in that direction.
This is what I can think of at the moment.
Title: Re: AddWaypoint different speeds
Post by: Slasher on Tue 27/01/2015 08:02:41
Hi Iceboty V7000a,

There are no loop frame delays, only an overall delay of 4 for all.

In show preview the animation speed looks the same for both loops 1 and 2.

Anti-Glide is removed in 3.2.1 .
Code (ags) Select

cTiger.MovementLinkedToAnimation = false; // does not cure the different speed issues.


It's not a real major issues but it is niggling.

Title: Re: AddWaypoint different speeds
Post by: RetroJay on Wed 28/01/2015 05:59:19
Hi Slasher.

The problem you are having is exactly what I have come across and I don't know why it does it.:(
I set a character to Walk to coords and then add a waypoint to make him come back.
He always walks faster going and slower coming back... Pixelated little pillock.(laugh)   
Title: Re: AddWaypoint different speeds
Post by: Mandle on Wed 28/01/2015 13:08:31
Quote from: RetroJay on Wed 28/01/2015 05:59:19
Hi Slasher.

The problem you are having is exactly what I have come across and I don't know why it does it.:(
I set a character to Walk to coords and then add a waypoint to make him come back.
He always walks faster going and slower coming back... Pixelated little pillock.(laugh)   

Does upping the character's walk speed on the way back compensate for the problem or does it change nothing?
Title: SOLVED Re: AddWaypoint different speeds
Post by: Slasher on Wed 28/01/2015 14:00:45
Hi,

from Mandle
QuoteDoes upping the character's walk speed on the way back compensate for the problem or does it change nothing?

well, after your suggestion about speed Mandle I did this and it seems ok now:

Code (ags) Select


function room_RepExec()
{
if (cTiger.Moving ==false && cTiger.Room==11)

if(cTiger.Loop==1){
cTiger.StopMoving();
cTiger.SetWalkSpeed(8, 8);
cTiger.Walk(680, cTiger.y);
cTiger.Loop=2;
}
else if(cTiger.Loop==2){
cTiger.StopMoving();
cTiger.SetWalkSpeed(7, 7);
cTiger.AddWaypoint(458,  cTiger.y);
cTiger.Loop=1;
}
}


This is something that should be looked into in future editions.

Happy days.. I think (laugh)

cheers ;)


Title: Re: SOLVED: AddWaypoint different speeds
Post by: Mandle on Sun 01/02/2015 14:33:11
Awesome...kind of a bandaid fix rather than a real one I guess...But whatever works eh?
Title: Re: SOLVED: AddWaypoint different speeds
Post by: MiteWiseacreLives! on Sun 01/02/2015 15:09:11
Hi Slasher.
It looks like your missing a bracket in there, {
Does that work in game? Looks like to me the Tiger will never get to (680, cTiger.y).
(maybe you just snipped it off when copying?)
Title: Re: SOLVED: AddWaypoint different speeds
Post by: Slasher on Sun 01/02/2015 15:19:30
Hi,

Quote(maybe you just snipped it off when copying?)
It's just one part of the script and it does it well enough ;)