I’m building a fairly simple space shooter game but I want projectiles to shoot at the angle my spaceship is rotated. Here’s a couple lines of my code to see what the image is and how it’s being rotated:
ship = display.newImageRect("ship.png", 78, 22) transition.to(ship, {rotation = 90, time=750, transition=easing.inSine})
Right now the game is using display.newImageRect but eventually I’m going to use a sprite sheet (once I get the art). To angle the ship I’m using transition.to, neither the player nor myself have direct control over that angle so I’m wondering how I can find the angle at any given time. I’ve looked in the api and did a google search but couldn’t find a function that returned an angle. Am I overlooking a function somewhere or do I have to approach the problem differently? The only thing I can think of right now is I’ll have to calculate the angle myself, and feed it to the ship…that way I’m the one who controls the angle of the ship so I’ll always know what angle the projectile needs to be fired.
Thanks in advance for any help.