Game Development Community

Template / Mount / Rotate

by Talcott Langston · in Torque X 2D · 08/01/2008 (11:37 am) · 1 replies

Heya,

Just starting out and I was playing with the Airplane tutorial- thought I'd try extending it as a learning exercise. Here's what I'd like to do: I'd like to modify the ships so that they have rotating gun turrets which aim at the player.

The way I had intended to do this was to set link points for each of the turrets, create turret template objects and mount them on the ship templates. However, I read in another post that you only mount spawners on templates (IIRC, lost the post, I'm afraid). Is this possible or do I need to not use templates for the ships and create each object separately as a sprite?


And in on an unrelated topic, I'd also like to add islands to the map. I'm sure there's a way to detect collisions with certain tile types on a tile map. Can anyone point me in that direction?

Thanks,

#1
08/05/2008 (2:56 pm)
First question... true, you cant mount a sprite to a spawner instance, but you can mount a spawner to a spawner ;) So, try creating two spawners: one for the plane and one for your turret. Then, take the spawner for your turret and mount that to your airplane spawner. It's a lot easier than it sounds in this wordy reply.

Second question... The short answer is yes, but it's pretty complicated. You can set a TorqueObjectType to a specific tile within a tilemap and constantly check for collision. I think that a much-much easier way to do this is to set your tilemap to the background (like Layer 30) and then add separate island scene objects (sprites) on top of the tilemap at a lower layer (like Layer 25). This way, you can get more accurate (even concave) collision polygons (with the help of blank scene objects). You can also easily turn on/off the collision to the island (for example, you shouldnt collide at higher altitude - but maybe collide at lower altitude)

John K.