hi
i am building one game, when i am firing bullet from axis point it is “fire only state line” but i want fire all the direction from axis point. any help plz:
[import]uid: 87661 topic_id: 19551 reply_id: 319551[/import]
hi
i am building one game, when i am firing bullet from axis point it is “fire only state line” but i want fire all the direction from axis point. any help plz:
[import]uid: 87661 topic_id: 19551 reply_id: 319551[/import]
Here 
[code]
local sin = math.sin
local cos = math.cos
local rad = math.rad
local speed = 100
local angle = 0 --this should be the angle of the object your using and rotating
–x and y below should be assigned to your bullet
x = sin(rad(angle)) * speed
y = cos(rad(angle)) * -speed
[/code] [import]uid: 84637 topic_id: 19551 reply_id: 75520[/import]
hi Danny
it is working nice, thanks for replay…
but i am firing bullet from barrel and barrel move on axis when we will press button then bullet should fire on barrel direction, but problem is that bullet firing direction and barrel direction are not matching…i am sharing code
barrel:>
[lua] x1 = event.x - barrel.x
y1 = event.y - barrel.y
angle = math.deg(math.atan2(y1, x1))+90
if angle >= 180 then
angle = angle - 360
transition.to( barrel, { rotation = angle} ) [/lua]
bullet:>
[lua] local speed = 1500
transition.to(bullet, {time = 1000, y = cos(rad(angle -180 )) * speed , x = sin(rad(angle -220)) * -speed[/lua]
please any help::
[import]uid: 87661 topic_id: 19551 reply_id: 75987[/import]