Changing characters

Started by pheeph, Sun 01/02/2009 06:04:01

Previous topic - Next topic

pheeph

I'm trying to do a script where one character will change into a different character.  What I'm trying to explain is that a new character sprite replaces the current character sprite.  The manual doesn't seem to mention that part.  How do I do this?

ThreeOhFour

This is as simple as making a new view and then placing:

Code: ags

cCharacter.ChangeView(2);


in your script, at the part where you want the character to change.

In the manual, have a look under the Character.ChangeView and Character.LockView entries :).

Ghost

Alternatively, if you really want to SWITCH two existing characters, you would need two different characters, place the new one at the position of the old one, and make the new one the player character. As I write this it sounds hilariously complicated... but basically you would

Code: ags

cNewCharacter.ChangeRoom(RoomNr, player.X, player.Y);
cNewCharacter.SetAsPlayer();
cOldCharacter.ChanceRoom(-1);


I'm not entirely sure, but the last command may not work with -1. In that case, just supply any other room- preferrable one you create just for storage (Like an empy Room100).
To play it safe, look up the commands in the manual, I have a habit of ignoring capitals when typing from the top of my head.

SMF spam blocked by CleanTalk