How can I make projectiles (bullets) travel at an angle?

I think I have the right idea, just my calculation is wrong .. or I am fully wrong.

playerangle is the angle the player is at ;)
I thought I could transfer the angle of the player to a gradient, hasn't worked.

1
2
3
4
5
6
 
local bullet = display.newCircle(player.x+10,player.y, 10)
        physics.addBody(bullet, {filter = bulletFilter})
        bullet:setFillColor(255,0,0)
        bullet:setLinearVelocity( math.tan(playerangle), 1 )
        transition.to(bullet, {time = 1000,  onComplete = function(self)        self.parent:remove(self); self = nil; end })
views:1501 update:2011/10/15 14:27:43
corona forums © 2003-2011