Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: manny.p on Tue 14/06/2005 17:50:46

Title: Just use left and right sprites not up and down
Post by: manny.p on Tue 14/06/2005 17:50:46
I want to use sonic the hedgehog sprites, but don't want to use up and down ones.

I want it so if he goes down and the direction he's going is left, that is displays the left loop, or if hes going up and rigt, it just displays the right loop.

I get errors when he goes directly up or down, can anyone help me with this without actually putting sprites in the loop but instead him using a left or right sprite?
Title: Re: Just use left and right sprites not up and down
Post by: ilSilente on Tue 14/06/2005 18:03:17
Check this: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=20808.0
Title: Re: Just use left and right sprites not up and down
Post by: manny.p on Tue 14/06/2005 18:26:00
Thnx m8, that guys script worked perfectly (even though i don't know how to use scripts i figured it out).

Here's his script:
if ((GetCursorMode() == 0)&&(button==LEFT))  {
    if (mouse.x>character[EGO].x){
      SetCharacterView(TIM, 3);
      MoveCharacter(TIM, mouse.x, mouse.y);
      }
    else {
      SetCharacterView(TIM, 6); 
      MoveCharacter(TIM, mouse.x, mouse.y);
      }
    }
Title: Re: Just use left and right sprites not up and down
Post by: Gilbert on Wed 15/06/2005 02:31:15
Actually since V2.6 of AGS:
Quote
- Added ability to have only left/right walking frames for
   characters (just delete all frames in loop 0).

You don't actually need any scriptings to disable the up/down loops.
Title: Re: Just use left and right sprites not up and down
Post by: ilSilente on Wed 15/06/2005 10:19:38
WHAT? I'm quite sure it didn't work with AGS2.6 O_o O_o
Anyway, it works fine with 2.7 :D

--edit--
It works but when I open the "Characters" section in AGSEdit, an error message says: "The editor attemped to display sprite -1" etc etc. And it's right because loop 0 is empty; anyway the editor should prevent this error displaying the first frame of loop 1 (in fact, the editor just hang up now). :-\
Title: Re: Just use left and right sprites not up and down
Post by: manny.p on Wed 15/06/2005 12:01:53
He's right it doesn't work in ags 2.6, i always get that error, "cannot find loop 0 in view x".

I thought ags 2.6 was the latest one out, better go download me a new copy.
Title: Re: Just use left and right sprites not up and down
Post by: manny.p on Wed 15/06/2005 20:52:27
I get all these errors when going up and down, andthere are no fames in loop 0, just  loop1 + 2, can't they get this one thing right. ::)
Title: Re: Just use left and right sprites not up and down
Post by: Gilbert on Thu 16/06/2005 02:33:53
What about V2.62?

It's not advisible to change to V2.7 if you had started your game already, since there're lots of changes in V2.7 that you may need some conversion for your files.

Edit:
I just create a test game with V2.6, I deleted all frames from loop0 of View1 and Roger walks without any problem for me, are you sure you're using the final version V2.6, not a beta version?

Go to the docs folder (if this folder doesn't exists it's definitely a beta version) and read changes.txt, find the section about V2.6, you shall find that quoted lines I posted earlier.
Title: Re: Just use left and right sprites not up and down
Post by: ilSilente on Thu 16/06/2005 09:18:40
@Gil:
The game runs correctly, but the editor give me error when i select the character in the "characters" entry in the tree on the left.
I'm using AGS 2.70.601
Title: Re: Just use left and right sprites not up and down
Post by: Gilbert on Thu 16/06/2005 09:45:42
Odd, never crash for me using V2.7 or V2.62.
And right, V2.70.601 is already newest version (not coutning V2.71 betas).

maybe you can try zipping your game (no room file needed) and upload it so we can investigate on the problem.

Edit:Ah ha!
I had just checked, and I can now confirm that there're lots of crashes using this feature, I'll inform chris about this in the technical forum.

Okay, I think I found out the cause now.
The offending part is that if the option "Characters turn before moving" is checked the game will crash, so all you have to do is to disable that option.
However, since it's not very friendly and I'll consider it as a bug, I'll report it to Chris anyway.

EDIT:reported (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=21360)
Title: Re: Just use left and right sprites not up and down
Post by: manny.p on Wed 22/06/2005 18:52:31
is there any way i can disable turning and the re-enable it in the script?

or for just one roomk disable it?
Title: Re: Just use left and right sprites not up and down
Post by: strazer on Wed 22/06/2005 19:21:32
Check out the SetGameOption function (OPT_TURNBEFOREWALK) and the Character.TurnBeforeWalking property.
Title: Re: Just use left and right sprites not up and down
Post by: manny.p on Wed 22/06/2005 20:46:44
Well i tried both, putting them in befoe fade in, and right before the walk function which it crashs on, no luck.

I even tried both together.

This is a bug they'll just have to fix
Title: Re: Just use left and right sprites not up and down
Post by: manny.p on Thu 23/06/2005 01:10:19
Can anyone tell me where to put them functions, because this is really bugging the hell out of me.
Title: Re: Just use left and right sprites not up and down
Post by: Ashen on Thu 23/06/2005 01:28:44
Which version are you using? (I know you where using 2.6, but have you updated yet?)
SetGameOption(OPT_TURNBEFOREWALK, 0); is for 2.62, and I think it affects all characters, while character[CHARID].TurnBeforeWalking = 0; is the 2.7 usage, and has to be set indicidually - could you be calling it for the wrong character?.

Either of those places should work. What exactly is the crash, and what are you doing/trying to do when it occurs?
Title: Re: Just use left and right sprites not up and down
Post by: strazer on Thu 23/06/2005 01:38:41
Quotecharacter[CHARID].TurnBeforeWalking = 0; is the 2.7 usage

Yes, in AGS v2.62 you have to use the SetCharacterProperty function to change it for specific characters.
Title: Re: Just use left and right sprites not up and down
Post by: manny.p on Thu 23/06/2005 01:53:58
What about turn when facing? << This was the real problem not turn while walking

SetGameOption (OPT_TURNWHENFACING, 0);


I've got the global function but don't know where to put it where it has effect?