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!

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

― Robert A. Heinlein

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: