[SOLVED] Animated climbing changing the player's end position

Started by De-Communizer, Wed 19/11/2008 00:16:55

Previous topic - Next topic

De-Communizer

Hopefully I can try to make this one a bit clearer by bringing a picture into it...




My character, upon using the edge of the ledge (in picture 1) performs an animation (picture 2), and the end of the animation is designed to segue into a standing animation once the climbing has finished (picture 3). I'm well aware however, that once the animation finishes and the view returns to the normal walking view, the player's position will be right back where they started, on the lower level (B).

One way I'd thought of sorting this would have been to tell it to then move the player to player.x-60 and player.y-20, but I can't think how that would be done. Doing it through changeroom, after all, would result in the room reloading. Can anyone suggest a way in which I might end up with the character standing on the ledge's walkable area after the animation has finished?

Thanks in advance :3

densming

You can directly set the character's x and y values in the script, like this:

Code: ags

cEgo.x = cEgo.x - 60;
cEgo.y = cEgo.y - 20;

Ghost

The easiest way is to replace the player's walk animation with the special "climb" animation and then simply MOVE the player:

int targetX = player.x -60;
int targetY = player.y -20;
player.move(targetX, targetY, eBlock, eAnywhere)

This will automatically create a fluid, animated movement; you may need to tweak the animation a bit to fit into the time needed to move from a to b.

De-Communizer

Quote from: densming on Wed 19/11/2008 00:25:18
You can directly set the character's x and y values in the script, like this:

Code: ags

cEgo.x = cEgo.x - 60;
cEgo.y = cEgo.y - 20;


Ah, I knew it would be something simple like that. Many thanks!

Khris

Ghost, using a moving reference point during an animation is probably the hardest way to solve this.
Think of how "hard" it is already to create a walk-cycle that won't make the feet slide. And that's not even diagonal movement.

Displacing the player after the animation is much easier.

SMF spam blocked by CleanTalk