Unwanted moving characters

Started by wtknc, Thu 14/04/2016 15:25:55

Previous topic - Next topic

wtknc

Hi sorry if this question seems really easy to solve,but I am really new to scripting and the ags engine. Now onto the question. I am trying to make an animation between two characters for convenience I thought it would be better to switch the player model to both of the characters. The problem this creates is that the engine shifts the picture away from where they were both standing causing an ugly blink between the two spots. I have tried to have the new player sprite move to the place where the two separate sprites were but there is still that blink caused by the movement command.

Thank you in advanced for helping and if you know how to animate two characters an easier way please let me know. 

Danvzare

You could just offset the sprite image by adding a whole lot of blank space to one of the sides, and experimenting until it's just right.
It's a terrible solution though, so hopefully someone else can come up with something better.

Cassiebsg

#2
Or you can manually adjust the x.y coordinates. ;)
you might have to test try and see when is the best time to change it so it won't end in a "jump".

probably something like
cCharacter.Changeroom(1, 50, 220);

Or you can add a variable to keep track of your current x.y and then just tell it to change to old_X+40, old_Y-10... or whatever the difference from one sprite is to the new one.
There are those who believe that life here began out there...

Mandle

If I understand this right, you are trying to animate an interaction between the two characters? Like one handing something to the other?

The best way I know to get this working flawlessly is to combine both into a single sprite/character and animate the interaction once before switching back to seperate characters.

This is how the tie-grabbing animations were done in the Blackwell games (although Dave admits he cheated because AGS does not allow semi-transparent and solid elements in a single sprite, so he slowly faded Joey solid just before the animation runs :-D )

The same thing can be done by timing both characters to do their thing at exactly the right moments, but this does get very fiddly and perhaps not work fluidly...

Khris

Calling ChangeRoom() is not recommended here (it makes AGS schedule a room change). One can simply change the coordinates directly:
player.x += 20;

Mandle: it sounds like wtknc is already doing what you're suggesting but is having trouble implementing it.

wtknc:
Characters are positioned using their bottom center. Like Danvzare explained, expanding sprites only on one side will shift the x-center and thus shift the character's pixels in-game. You need to count the number of pixels you added to the side of your player sprite to draw in the 2nd char, then add the same amount on the other side (for every frame of the animation).
The only part where you need to experiment a bit is where exactly the 2nd character has to be positioned before you're changing the player character's view.

Or you change the position; doing it like shown above shouldn't cause a blink; the engine will simply draw the character at the new position in the next frame.

Cassiebsg

uhm, wouldn't he still need a changeroom for one of the characters? (maybe an invisible character as alternative?)
If you have one view with 2 characters you only have um AGS character to move, when you move to individual view for each, you'll have a player and NPC, or is this mush simpler than my brain makes it appear?
There are those who believe that life here began out there...

Khris

You need to hide the 2nd character while the animation is running, but you can do that by setting their transparency to 100, or their .y to -1.
ChangeRoom() is only needed if the NPC is supposed to appear in another room.
It sounded like you were suggesting to move the player by using ChangeRoom(), which always schedules a room change afaik (and thus reloads the room), even if you send them to the current room.

SMF spam blocked by CleanTalk