Hi,
so I have a table to hold a set of angles.
I loop through the table and call the angles which are then applied to a *pre loaded array of bullets (* that works fine ).
I have used this method lots in the past for positioning all types of things without issue( maybe a bit rusty though :)) , the commented out math random line works as expected.
substituting this line:
local dx, dy = math.cos(angle) \* speed, math.sin(angle) \* speed
with this:
local dx, dy = math.cos(bulletAngles[i]) \* speed, math.sin(bulletAngles[i]) \* speed
dosnt work either…hmmm
Question: why is the table only applying the last angle to ALL the bullets?
thank you
local bulletAngles = { 130, 120, 110, 100, 90, 80, 70, 60, 50 } for i = 1, 9 do local angle = bulletAngles[i] --math.random(-math.pi, math.pi) local speed = 0.09 local dx, dy = math.cos(angle) \* speed, math.sin(angle) \* speed bullet:applyLinearImpulse(dx, dy, bullet.x, bullet.y) end