Jibble

Author Topic: SOLVED: AddWaypoint different speeds  (Read 1072 times)

Slasher

  • slasher
    • I can help with AGS tutoring
    • Lifetime Achievement Award Winner
    • I can help with scripting
    • I can help with story design
    • Slasher worked on a game that was nominated for an AGS Award!
SOLVED: AddWaypoint different speeds
« on: 26 Jan 2015, 19:52 »
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: Adventure Game Studio
  1. function room_RepExec()
  2. {
  3.   if (cTiger.Moving == false){
  4.   cTiger.AddWaypoint(670, 367); // loop 2
  5.   cTiger.AddWaypoint(458, 367);// loop 1
  6. }
  7. }
  8.  

« Last Edit: 28 Jan 2015, 14:09 by slasher »

Re: AddWaypoint different speeds
« Reply #1 on: 27 Jan 2015, 01:55 »
You are running in RepExec(). Why?
That code is run every frame. So you are setting the way points over and over again.

Slasher

  • slasher
    • I can help with AGS tutoring
    • Lifetime Achievement Award Winner
    • I can help with scripting
    • I can help with story design
    • Slasher worked on a game that was nominated for an AGS Award!
Re: AddWaypoint different speeds
« Reply #2 on: 27 Jan 2015, 05:03 »
Because it is patrolling.

Even this has the same result:
Code: Adventure Game Studio
  1.  if (cTiger.Moving ==false){
  2.  cTiger.Walk(670, cTiger.y);
  3.  cTiger.AddWaypoint(458,  cTiger.y);
  4. }
  5. }
  6.  
  7.  
« Last Edit: 27 Jan 2015, 05:08 by slasher »

Gilbert

  • Local Moderator
  • * KILL* * KILL * * KILL *
    • Lifetime Achievement Award Winner
Re: AddWaypoint different speeds
« Reply #3 on: 27 Jan 2015, 05:51 »
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.

Slasher

  • slasher
    • I can help with AGS tutoring
    • Lifetime Achievement Award Winner
    • I can help with scripting
    • I can help with story design
    • Slasher worked on a game that was nominated for an AGS Award!
Re: AddWaypoint different speeds
« Reply #4 on: 27 Jan 2015, 08:02 »
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: Adventure Game Studio
  1.  cTiger.MovementLinkedToAnimation = false; // does not cure the different speed issues.
  2.  

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


RetroJay

  • Frankly, my dear, I'm a Kerbal and Proud of it.
    • RetroJay worked on a game that was nominated for an AGS Award!
Re: AddWaypoint different speeds
« Reply #5 on: 28 Jan 2015, 05:59 »
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)   
  Master Decorator

Mandle

  • NO PIXEL LEFT BEHIND!!!
    • Mandle worked on a game that was nominated for an AGS Award!
Re: AddWaypoint different speeds
« Reply #6 on: 28 Jan 2015, 13:08 »
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?

Slasher

  • slasher
    • I can help with AGS tutoring
    • Lifetime Achievement Award Winner
    • I can help with scripting
    • I can help with story design
    • Slasher worked on a game that was nominated for an AGS Award!
SOLVED Re: AddWaypoint different speeds
« Reply #7 on: 28 Jan 2015, 14:00 »
Hi,

from Mandle
Quote
Does 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: Adventure Game Studio
  1.  
  2. function room_RepExec()
  3. {
  4.  if (cTiger.Moving ==false && cTiger.Room==11)
  5.  
  6.  if(cTiger.Loop==1){
  7.  cTiger.StopMoving();
  8.  cTiger.SetWalkSpeed(8, 8);
  9.  cTiger.Walk(680, cTiger.y);
  10.  cTiger.Loop=2;
  11. }
  12.  else if(cTiger.Loop==2){
  13.  cTiger.StopMoving();
  14.  cTiger.SetWalkSpeed(7, 7);
  15.  cTiger.AddWaypoint(458,  cTiger.y);
  16.  cTiger.Loop=1;
  17. }
  18. }
  19.  

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

Happy days.. I think (laugh)

cheers ;)


« Last Edit: 28 Jan 2015, 15:23 by slasher »

Mandle

  • NO PIXEL LEFT BEHIND!!!
    • Mandle worked on a game that was nominated for an AGS Award!
Re: SOLVED: AddWaypoint different speeds
« Reply #8 on: 01 Feb 2015, 14:33 »
Awesome...kind of a bandaid fix rather than a real one I guess...But whatever works eh?

MiteWiseacreLives!

  • Hold onto your Fossils!
Re: SOLVED: AddWaypoint different speeds
« Reply #9 on: 01 Feb 2015, 15:09 »
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?)

Slasher

  • slasher
    • I can help with AGS tutoring
    • Lifetime Achievement Award Winner
    • I can help with scripting
    • I can help with story design
    • Slasher worked on a game that was nominated for an AGS Award!
Re: SOLVED: AddWaypoint different speeds
« Reply #10 on: 01 Feb 2015, 15:19 »
Hi,

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