possible Glitch involving followCharacter

Started by Dave Gilbert, Thu 18/05/2006 21:37:12

Previous topic - Next topic

Dave Gilbert

Either it's a glitch or I'm doing something stupid.  Probably the later.

from the manual:
QuoteThere is also another special use for this command. You can pass the special value FOLLOW_EXACTLY as the DIST parameter rather than passing a number. If you do this, then CHARID will always remain at exactly the same X and Y co-ordinates as CHARTOFOLLOW. This might be useful for effects such as a temporary halo over the character and so forth.

I am using this quite nifty feature to put different heads on different body models.  It works perfectly in theory.  The head pops right on the body and follows it normally.  However, when the body turns the head doesnt turn with it.

The head has it's own up,down,left and right loops.  It seems like the head should "turn" when the body character turns, but that doesn't seem to be happening. 

I know that it's possible to set the loops equal to each other in repeatedly_execute, but I will be doing this with nearly every character in the game so that could get really messy. 

Any advice/help/scornful accusations appreciated!

Gilbert

Hmmm would it be possible that the "Do not turn before walking" option wasn't set consistently for the head and the body?
Say if you checked this for the head but not the body, when the character was originally facing left and turned to walk to the right, the body will turn to the right, cycling the views but the head won't, until the character moves.

Also, if you're using functions like FaceLocation(), etc. which don't move the character, I think you need to do it manually for BOTH parts.

SSH

For an alternative solution:

With the 2.72 beta you can reassign the graphics of frames at runtime, so you could use
dynamic sprites to superimpose heads on to the sprites of a view and then set the frames of your character to be the dynamic sprite...
12

edmundito

Still, these solutions don't answer the question of what's going on. I thought FOLLOW_EXACTLY was supposed to do exactly what it says... follow the player character exactly as it is, meaning directions and frames. ???

Gilbert

I don't think so, it's probably what I described, though it's just my guess.

Pumaman

FOLLOW_EXACTLY simply makes sure that the character's x, y and z co-ordinates are always identical to each other. It doesn't do anything with loops or frames, so the best bet is to put something into repeatedly_execute_always.

It's a good suggestion though for FOLLOW_EXACTLY to do this, however it would have to be a different option since a lot of the time it's used in a context where you don't want the characters loops and frames to be linked to each other.


Gilbert

Check this thread.

I think this is worthy of being implemented in future releases (maybe we can define another FOLLOW_EXACTLY_WITH_FRAMES constant, or use 2 and 3 for eagerness which represent 'match frames on top' and 'match frames at bottom' respectively), since I made a small testing with a blank game, with a second character having all setting with Ego roger and do the repeatedly_execute_always() trick:

cCopy.Loop=cEgo.Loop;
cCopy.Frame=cEgo.Frame;

but so far it seems the two rogers' frame didn't match exactly, I think it's probably true that cCopy's frame is lagging by one game loop. So there's currentlyÃ,  no direct easy way to do perfect synchronization.

GarageGothic

Yes, there is a lag between the loops - and for some reason it's not always exactly one frame, which would have made it easy to compensate for. My solution is to hide the player character and then have a dummy character which animates the same way as the follow sprite - i.e.:

Code: ags

player.Transparency = 100; //not in every loop of course, just for the example
cPlayerdummy.View = player.View;
cPlayerdummy.Loop = player.Loop;
cPlayerdummy.Frame = player.Frame;
cFollowsprite.Loop = player.Loop;
cFollowsprite.Frame = player.Frame;

Gilbert

Yeah, seems that this is a workaround, it's a bit of waste as we need to use one more character, but I think there aren't much better way against it at the moment.

Things are becoming complicated, hope the related feature gets implemented soon.

Pumaman

Actually, I don't really like the way FollowCharacter is hijacked for this, it should probably be moved out into a separate Character.StickToCharacter or something.

SMF spam blocked by CleanTalk