Game Development Community

Multiplayer(co-op) gamepad support?

by Ian Newland · in Torque Game Engine Advanced · 04/30/2008 (12:08 am) · 0 replies

Hi all,
I have gotten my gamepads/joysticks working in my game and now I need to put them to use. I have spent several hours diving into the code trying to figure out how to designate gamepad1 to work with my second created player(player2) in my game.

I have successfully created 2 players in the game, and I can see both on spawn. Gamepad0 controls my current player, and so can gamepad1.

How do I map my gamepad1 controller to move "player2"??

So far i've only been able to use the setVelocity function to move player2.

Heres a bit of code I used to setup player2;

// player 2 test
%player2 = new Player() {
dataBlock = %this.playerDB;
client2 = %this;
};
MissionCleanup.add(%player2);
%player2.setTransform(%spawnPoint);
%player2.setShapeName(%this.name);
%this.player2 = %player2;

$player2 = %player2;
// end player 2

...and my movement code is mapped to my joystick like so;
$player2.setVelocity("-7 -6 0");

Any help would be appreciated!!