Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Problem with rotating

This thread is locked; no one can reply to it. rss feed Print
Problem with rotating
tmrovsky
Member #15,394
November 2013

Hello everybody!
I have some problems with my game. I was sitting by this problem for long time and I still have nothing. I don't know how to solve a moving my spaceship problem. What I want to do? So, I want to move my spaceship in each possible direction and moreover have a possibility to rotate it in this same time. While holding press_up/press_down button I also want to use right/left button to rotate. I don't know is it clear. I hope that there will be a person who can help me : ).

I attached my code + one bitmap.

Arthur Kalliokoski
Second in Command
February 2005
avatar

Nobody has answered in so long, and I had some time to kill (took me an hour!) so I rewrote it from scratch with some differences based on my rewrites of some of the examples.

I changed your bitmap to a TARGA tga file to provide transparency.

Both the source and tga file are in the paperclip.

If you wanted the ship to start and stop more smoothly, say so, it'd take me a few more minutes.

Also, it looks rather crappy without blending and such enabled, but it's complicated enough now.

[EDIT]

Whoopsy! A fierce bug bars the way! Line 123 should be

  ship_angle += ALLEGRO_PI*2.0;

Sorry!

They all watch too much MSNBC... they get ideas.

tmrovsky
Member #15,394
November 2013

Thanks a lot for answering. You did exactly what I was looking for. I understood your code and it was good way to know something new. It nice of you that you wasted your time to help me sort out a problem. Currently version is fine to me and enough smoothly.

Thanks, once more!

Go to: