Game Development Community

Control more than one character

by Alexandre Ribeiro de Sa · in Torque Game Builder · 09/14/2010 (4:53 am) · 1 replies

Hello everyone,

I'd like to know if someone know how can I control more than one character, I've set the behavior controls like this:


UP - UP
DOWN - DOWN
LEFT - LEFT
RIGHT - RIGHT
JUMP - SPACE
ATTACK - X
NEXT - TAB (Go to the another character)


My first idea and the very easy was, set everyone with the same behavior input then set a flag in the active character... But I can't use the same input in more than one object, anyone know another way!?


All the best!
Alexandre

#1
09/14/2010 (5:57 am)
Your idea is correct.

[EDIT]Bind functions to your keys (up,down etc) instead of using behaviours.

Have a list of the objects that you want to control in a simset. When you hit the TAB key, set $active = <obj> where obj is the active character.

In your up/down and other binded functions, just use $active e.g.$active.setPosition etc.