changeCharacterView wont do what I want (solved)

Started by spook1, Tue 07/02/2006 21:15:55

Previous topic - Next topic

spook1

I hvae a caterpillarvehicle, with many views (one headlight lit, two heqadlights lit, on headlight dimmed, the other bright etc. etc.etc.)
I made a charater for this vehicle, and called it FF11. It has three loops: straight, right and left.

Depending of a GI (nr 50) I set the view of this vehicle called FF11.
Now the right views won't show, no matter what I try.

Any suggestions??

Code: ags

// script for Room: Player enters room (after fadein)
....
Ã,  if (GetGlobalInt(50)==1) {Ã,  //aa
Ã,  Ã,  Ã,  Ã, // ChangeCharacterView(FF11, 45);
Ã,  Ã,  Ã,  Ã,  character[EGO].loop=0;
Ã,  Ã,  Ã,  Ã,  character[FF11].Walk(160, 100,eBlock);
Ã,  Ã,  Ã,  Ã, Display("Here will start the MiniGame");Ã,  

// script for Room: Player enters room (before fadein)

Ã,  if (GetGlobalInt(50)==1) {Ã,  //aa
Ã,  Ã,  Ã,  Ã,  character[FF11].FaceLocation(160, -1000);
Ã,  Ã,  Ã,  Ã,  ChangeCharacterView(FF11, 45);




DoorKnobHandle

You need to close your curly brackets too!

Example:

Code: ags

if ( something == something_else )
// if something equals something_else
{ // open curly bracket
   // then do something
   do_something ( bla bla bla );
} // close the curly bracket again


I don't know if that solves your problem but it definitely is a "big" mistake (I wonder that your source code actually compiled)...

Ashen

Well, they ARE from different parts of the room script, so the missing braces could just be a copy-paste thing.

spook1:
Try using Character.ChangeView(...) instead (i.e. cFf11.ChangeView(45)).
(I'm assuming you knew the first ChangeView has been commented out.)
Does everything else in the condition run (Display, FaceLocation etc)?
I know what you're thinking ... Don't think that.

spook1

yeah, indeed evrything else runs.
The commented-out-lines are on purpose. I have been trying quite a bit lately ;-)

I'll get back at this later...

Martijn

Khris

Does the caterpillar actually move to the right?
If yes, how's it animated while moving?

spook1

it moves straight up, to the top of the screen, therefore I would expect the engine to use the first view

Khris

A view usually holds all four directions. If you look at the loops of a view, you'll see that the loops are named "down", "left", "right" and so on.
So create one view (consisting of four loops for all four directions) for every look your caterpillar is meant to have. (I don't even think you'll need more than one view, cause you seem to have totally misunderstood the whole way AGS uses Views)

To clarify: one view is enough to display movement in all four directions.
You can add diagonal walk-cycles, check the Ben Jordan games to see it in action. (But you still add those diagonal-loops to your original view.)

If you want to be able to display the caterpillars movement from more than 8 angles, you'd have to code an appropriate walking routine yourself. IIRC, this has been done already, too, there should be a thread hidden deeply in the tech archive explaining how to use 16 directions.

spook1

Quote
it moves straight up, to the top of the screen, therefore I would expect the engine to use the first view

You're right, I meant first loop of the view.
i change view when the vehicle takes different "outfits", like one headlight, two headlights etc.

Khris

Ok then, does the caterpillar actually move to the right?
The right side walk-cycle won't be displayed unless it moved a greater distance to the right than up.

I'm afraid I'dont really understand your problem.

spook1

hehe, neither do I.
The caterpillar move straight up.
I'll look into it again in thew weekend and get back with a precise observation.
Thanks for thinking along.

Martijn

Khris

Well, did you TELL it to move up?

The command is character[FF11].Walk(160, 100,eBlock);, so where's the starting point of the char?
To clarify, the parameters are absolute room-coordinates, in this case the center of a 320x200 screen. So if the char is starting at 0;100, it should move to the right. Is the walkable area big enough?

I'm really confused, because your original problem was:
QuoteNow the right views won't show, no matter what I try.
Of course they won't show, if the char is moving UP. So the actual problem seems to be the char not moving to the right, correct?

Please try to be clear about what exactly your problem is, it's quite frustrating for me to keep explaining while I'm not even sure that I'm adressing the actual problem.

spook1

To be precise:
When on entering the room I call:

Code: ags

  // script for Room: Player enters room (before fadein)
  PlayAmbientSound(1, 4, 100, 0, 0);
  
  character[FF11].x = 160;
  character[FF11].y = 227;


  if (GetGlobalInt(50)==2) { //ff
 
		 }
  if (GetGlobalInt(50)==1) {  //aa
        character[FF11].FaceLocation(160, -1000);
        ChangeCharacterView(FF11, 45);
 
		 }


and then:
Code: ags

 // script for Room: Player enters room (after fadein)
  if (GetGlobalInt(50)==2) { //ff
        character[EGO].loop=0;
        character[FF11].Walk(160, 100 ,eBlock,eWalkableAreas);
				Display("StartMiniGame");  
		 }


strange huh?

spook1

#12

:'( :o :'( :o
Me very stupid.
First loop down, not up (bang head bang head)
Now made loop up and everything runs fine. Sorry for your time, me not worthy :-(

Yet :-) that it is solved.

martijn



SMF spam blocked by CleanTalk