Hi, I am creating a basic 2d shoot 'em up in director. I want to have the gun rotate (in order to follow the crosshair). Can anyone help me? To give you a better idea heres a screen shot!
Thanks,
Staff, Northern Ireland
hey kenneth!.. thanks so much for your reply, that is exactly what i want to do.. i know this is so basic but i can work out the lingo despite your informative post. I assume it should be a behavior script applied to the "gun"..
err...
on beginsprite me
set angle = atan of (y position / x position)
end
??? if you could help me correct this it would be much appreciated!!..
Regards,
STAFF
[tt]-- Frame script (Director 10)
on exitFrame me
movieW = the stageRight - the stageLeft
movieH = the stageBottom - the stageTop
h = _mouse.mouseH - movieW/2
v = movieH - _mouse.mouseV
if h <> 0 then
sprite(1).rotation = -atan(v/h)*180/pi
end if
_movie.go(_movie.frame)
end
--[/tt]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.