Game Development Community

Tractor Beam?

by Chris Jorgensen · in Torque Game Builder · 06/27/2006 (2:22 pm) · 7 replies

Has anyone done a tractor beam device in a game? I've got a couple ships in a top-down view space combat game. I wanted one ship to have a tractor beam that could latch onto another object and suck it in. But when I tried it last night, I had a major problem. That is, the collision between the effect and the sprites superceded the "onCollision" function that did the sucking. So what happened, was that the beam would just push the target ship out of the way, rather than suck it in.

Any ideas on how to get around this?

Right now, i'm thinking about turning off collision and doing a function with pickline somehow.

#1
06/27/2006 (11:58 pm)
What are you using for your tractor beam's collision?
#2
06/28/2006 (5:08 am)
Just a thought: Could you use something like pickLine() in the direction of the tractor beam, and if any ship is found - mount it to your ship with a rather light force to make it slowly come towards you?
Don't know if this helps but it might give you some inspiration at the least... ;)
#3
06/28/2006 (11:27 am)
You dont want to mount it unless you wan tthe ships with the tractor beams to be able to carry you away.

It would be much better to just apply appropriate forces (and would probably look more realistic).
#4
06/28/2006 (1:49 pm)
Well, I got something to work last night using pickrect, but then I couldn't get a particle effect to sync up with it correctly. But it worked. Right now I have a pickradius going with a circle of "charge" particle effect around the ship. When anything goes within the circle, it gets sucked toward the ship. I turned collsion off for the effect.

I think I might switch back to a line/rectangle though. The circle I don't think works as well strategically.

On a side note, my other ship's "special power" is that it forms a bubble around itself. After the bubble is shot a few times, it pops, and the ship is vulnerable again. :)
#5
06/29/2006 (2:20 am)
You could use a circle and just check if the ship is within a sub-section of the circle in front of the ship (Galaga style).
#6
06/29/2006 (11:48 am)
Actually, I went back to the ring-style. I'm not sure of its strategic value yet though. What I need to do is sit down and play against some people again. I've been VERY focused on gameplay/balancing for this project. I know I'm not going to wow people with graphics, so I've got to wow 'em with creativity and fun. :)
#7
01/17/2009 (10:03 am)
You know, I forgot about this thread. But it popped up in my watched list, which is a bit more prominent now. I know this thread is 3 years old, but this is actually something I revisited and solved the other day!

I did end up writing a good tractor beam the other day. I use a trigger with an onStay that applies a impulse force the the object inside. It works super well.

I've discovered that triggers are fabulous ways to get things done. I've been using 'em all over the place. :)