Game Development Community

Adding custom 'armor' and 'gear' to a 2D object

by Jeffrey Sweeney · in Torque Game Builder · 06/11/2009 (12:38 pm) · 3 replies

It certainly has been awhile since I've used TGB. I've recently been inspired (and had the time) to start making a 2D platformer RPG. The basic scripting is coming along nicely so far, but there's one dilemma I'm facing: how am I going to make customizable armor and weapons?

I have figured two ways of doing this, and I'm not liking either of them. Either I make tons and tons of separate animation sequences, or I make the player a complex of mounted body parts. The former would take forever and waste recourses, and the latter would probably cause lag (since not only the player is wearing and wielding things) and take a long time to set up for different enemies.

Is there a way to make a 'movable' mount point of sorts, ie make an object move and rotate so much relative to the player?


Edit: another idea I had was to make custom animations for each item. I'm hoping this isn't necessary either.

#1
06/16/2009 (4:09 pm)
You definately can. It would be all in script and it's not particularly clean. Essentially, when you change the animation frame, you would need to call a function that makes the adjustments. That's probably even more complex than the other methods.

I would suggest separating the character into peices, a solid body (that doesn't rotate), an arm with sword, and legs that actually animate.

Unfortunately, there isn't a method that won't mean lots of work.
#2
06/17/2009 (3:13 pm)
Oh well. Thanks Nikos, I'll just try mounting a bunch of objects together and use an invisible collision object for a mask. The complex animation sequences can probably be reused anyway.
#3
06/21/2009 (4:27 am)
Eureka!

%this.setLinkPoint();

With this function, you can make multiple LinkPoints, plus change an existing linkpoint's location. It seems to work in code.


I'll post a sample code once I work some stuff out.