Game Development Community

Shooting multiple projectiles

by Chris Everhart · in Torque Game Engine · 05/30/2010 (4:50 pm) · 1 replies

Hello again!

I'm trying to have my player shoot 3 projectiles at the same time but have them spread out so that they aren't on top of each other. By spread out, I mean seperated in space, not in time. Here's what I have :
// Create the projectile objects
  %p = new Projectile() {
     dataBlock        = %projectile;
     initialVelocity  = %muzzleVector;
     initialPosition  = %spell.caster.getMuzzlePoint(0);
     sourceObject     = %spell.caster;
     sourceSlot       = 0;
     client           = %spell.caster.client;
  };
  
    %p = new Projectile() {
     dataBlock        = %projectile;
     initialVelocity  = %muzzleVector;
     initialPosition  = %spell.caster.getMuzzlePoint(0);
     sourceObject     = %spell.caster;
     sourceSlot       = 0;
     client           = %spell.caster.client;
  };
  
    %p = new Projectile() {
     dataBlock        = %projectile;
     initialVelocity  = %muzzleVector;
     initialPosition  = %spell.caster.getMuzzlePoint(0);
     sourceObject     = %spell.caster;
     sourceSlot       = 0;
     client           = %spell.caster.client;
  };

I'm pretty sure that I need to alter the initialPosition of two of them but I'm not sure how. Also, I'm using this spell system if that matters. http://www.torquepowered.com/community/resources/view/8621

About the author

I used to work in the auto racing industry, but I got tired of it. I'm going to college to learn more about game and simulation design. Hopefully someday, I'll land a job with a game company.


#1
05/30/2010 (5:30 pm)
Check out this resource, it works pretty well... shouldnt be hard to setup for your project.
http://www.torquepowered.com/community/resources/view/1714

P.S. the default 12 projectile count is too much and doesnt look instantaneous, if you using only 3 then it should work perfect as I have even lowered my shotguns to only three shellcount for optimization.