Hello there,
I am a beginner in Allegro5 development, also in Game development.
My starting project is a simple SpaceInvaders themed game. I decided to let user control spaceship with either a keyboard or a mouse. The thing is that if I don't touch my mouse, keyboard control is working flawlessly. Same goes for mouse control, I chose to move my ship with left mouse button and fire gun with clicking right mouse button. Now here is where it still works, but if I choose to steer ship with left mouse button and fire gun with a space button on my keyboard, it starts to jump around. Even better any keystroke while moving my spaceship causes my ship to jump around to different positions, like if the stroke were processed by mouse and converted to x , y mouse positions. Don't know if that logic makes any sense from a programming point of view, but it kinda looks like it.
Here is my code:
What if you gave the keyboard priority? If the left key or right key are true, ignore mouse move events.
Thanks for fast respond.
The problem is however, that if I do that I won't be able to shoot with space button, and in future I won't be able to expand game, so that for example different types of missles use different keys to fire.
You can warp the pointer to the new location you've moved to with the keyboard.