Game Development Community

dev|Pro Game Development Curriculum

Twin Stick Shooter for iT2D

by Andy Hawkins · 10/13/2012 (10:21 pm) · 8 comments

Unpack the resource here.
drewfx.com/Torque/iPhone/TwinStickShooter.zip

This is based on the code created by Paul Jan from this thread...
www.garagegames.com/community/forums/viewthread/131693/1#comment_form

I've done everything for you, so replace with your art, but follow the tut below to see how I've made it. You won't need to do anything, just click on the objects on the screen to see how I've done it. It's been tested in XCode and runs on a iPhone.

Also I've written this tut/resource in such a way that you could well have never used iTorque2D before.

Open the folder called "projectFiles" and find the file called "project.it2dProj". Double click on this and as along as iTorque is not running it will load the project. Press F5, select iPhone and you will see this...

To configure it, I created new image maps for
a background
a player
a joystick
a laser ball (mines a pinball from TurboFlick - an awesome iOS game!!!!)

The background is set to the back by clicking on Edit tab at the top right, and scrolling down to Scene Object then changing the layer to 30.

The player is set to STICK under WorldObjectLimit, and the limit is set by selecting the player, waving the mouse just above their head and selecting the World Limit button and setting to look like this.
drewfx.com/Torque/iPhone/worldLimitPlayer.png

Next name them player in Edit->Scripting->Name.
drewfx.com/Torque/iPhone/scriptPlayer.png

The left joystick is the DPad. Drag in the joystick sprite and name it joystick under Edit->Scripting->Name.
drewfx.com/Torque/iPhone/scriptDPad.png

Then click on Create->Scene Object and drag a scene object around the joystick. This is the extents of the movement for the joystick and also receives the behavior called "D Pad". So once in place, from the Edit->Behaviors section add D Pad as shown. The thumbDisk object is joystick and targetObject is player.
drewfx.com/Torque/iPhone/behaviorDPad.png

Next from the Create tab drag in another joystick and place it at the bottom right. Under Edit->Scripting name it joystickFire.
drewfx.com/Torque/iPhone/scriptJoystickObject.png

Finally add another scene object to surround this new joystick. Add the Firing Pad behavior to it, set the targetObject to player so the bullets fly from the player's middle, and set the thumbDisk to joystickFire. You can also change the speed of the bullets and the firing rate.
drewfx.com/Torque/iPhone/addFirePad.png

Running it, you can only control the movement or firing with the mouse, but if you load it up into XCode and push to the iPhone you'll have twin stick control. Awwwright!

#1
10/14/2012 (5:35 am)
Nice resource! Thanks Andy.
#2
10/14/2012 (5:47 am)
No worries. Glad to be back helping out again. To make it a complete resource if I find the time, I'll add how to take it from iTorque into XCode and onto the iPhone to help out people just getting started.
#3
10/14/2012 (5:48 am)
Oh, what's the tag to embed vimeo and youtube clips please?
#4
10/14/2012 (6:32 am)
{youtube=NfxzuyWnRjU width=640 height=480}
{vimeo=1054612 width=640 height=480}

Just replace the { } with [ ]
#5
10/14/2012 (10:58 pm)
Very nice resource Andy!
#6
10/15/2012 (4:43 am)
Thanks Chip!
#7
10/17/2012 (9:22 am)
Awesome resource!
#8
11/12/2012 (7:32 pm)
Thanks Dave.