Game Development Community

Switching Characters

by Rich Wilson · in Torque X Platformer Kit · 06/22/2008 (8:25 pm) · 5 replies

What's the best way to go about switching the character that the player controls? I've noticed buggyness if I give more than one scene object a playerActor component.

#1
06/23/2008 (5:17 pm)
I'll get the ball rolling here.
I haven't tried this approach yet, due to having little time to sit in front of the machine, but my first inclination is to start with one actorController and then remove it from the first player and attach it to another player. Probably have to rename the new player to "Player" as well, depending on what scripting stuff is tied to that name.
#2
06/23/2008 (7:16 pm)
Rich, can you better describe the game play? Is that you have 2 characters on screen and that you want to bounce between which one is under player control? What happens to the uncontrolled player - does it just sit there until it receives control again? i just need a little more insight.

John K.
#3
06/23/2008 (8:31 pm)
That's basically the scenario. Imagine something like Blaster Master. Guy A deactivates while guy B appears and moves around under player control. When he returns to Guy A, he disappears and Guy A becomes the active character again.
#4
06/25/2008 (2:55 pm)
Another good example is Lost Vikings. I might just have to crack open the component code and see what's going on during initialization to see how I can reattach control to a different character.
#5
06/25/2008 (8:14 pm)
Ok. Figured this one out with some minor digging. All I had to do was set character B to have an ActorComponent instead of a playerActorComponent. Then when I triggered the event, take the controller from the player actor and attach it to the new character as well as mount the scene camera to the new character. Easy enough.