Mouse or keyboard ?

Previous topic - Next topic

Corax

I am unsure about which control method to use. I would prefer the
mouse, but it seems to behave odd sometimes. What is your opinion ?

Left mouse button: fire
Right mouse button: switch control mode
   mouse-mode: just move the ship with the mouse
   key-mode: use WASD-keys

Eradicator.app.zip - 1.10MB

Kitty Hello

I prefer mouse - but it's not implemented nicely.

For the mouse implementation, I'd add a transparent, virtual cursor, and the ship will move to this point in the speed that you have if you were moving it with the cursor keys. If the plane is fast enough, the virtual cursor must not be displayed at all, maybe.

It looks good.

Ian Price

Both methods feel a tad on the slow side to me -  the ship just doesn't seem to move as fast as I'd like it to. WASD seems an odd choice for a shooter of this type too; I'd much rather use cursors to move and left CTRL to fire. However, why not give users the choice with a redefine keys option - this is very easy to implement.

I like what I've seen so far though. :)
I came. I saw. I played.

backslider

The game looks nice! But Please choose another Background! :D
That´s crazy for my eyes  :puke: :puke: :puke:

I would prefer keyboard for playing the game and yes, Ian, the ship should be faster!

cheers

Wampus

I prefer keys but the mouse was just fine too. Why not keep both movement options? Don't forget to support Joypads. :D

What are your plans for this game? The images are looking good.

monono

Mouse for the casual player and keys for the nerds :)
How do you scroll the background? It´s flickering on my computer.
Good start. Keep it up.

Corax

QuoteFor the mouse implementation, I'd add a transparent, virtual cursor, and the ship will move to this point in the speed that you have if you were moving it with the cursor keys.

This should be the best solution. I used the x/y speed (MOUSEAXIS) so far.

QuoteBoth methods feel a tad on the slow side to me -  the ship just doesn't seem to move as fast as I'd like it to.

The ship´s maximum speed is the same for both methods. The mouse allows more precise movement but it seems to be slower. The speed is constant with key-control and very imprecise at high speed. I could add acceleration but that would be a problem if you have to react fast (avoid collision, aim ...).

QuoteWhat are your plans for this game?

I just plan a simple shooter with a few air and ground units, mainly to practice (I don´t coded anything for over a year now).

QuoteHow do you scroll the background? It´s flickering on my computer.

The y coordinate for the background is changed every frame, then the graphic is drawn two times. I don´t know why it flickers.

Ian Price

QuoteThe ship´s maximum speed is the same for both methods. The mouse allows more precise movement but it seems to be slower. The speed is constant with key-control and very imprecise at high speed. I could add acceleration but that would be a problem if you have to react fast (avoid collision, aim ...).

I think you missed the point. The ship moves too slow whatever method you use.
I came. I saw. I played.

Corax

The problem with high speed rates is the collision detection. If the ship is too fast it could "slip" through an obstacle.
I think I solve the problem by moving it, check for collision, then move it again and check once more within the same frame.
The ship would then be twice as fast.

MrTAToad

What you could do (and it would be a very interesting exercise) would be given starting x,y coordinates and ending x,y coordinates, check to see if the ship has a collision between the two sets of coordinates.

That way you can move the ship as fast as you like without missing any collisions.

Slydog

#10
Define your ship speed as a number of pixels per second, like:
ship_speed% = 100

Then each frame, use GETTIMER() to calculated the fraction of a second to figure out how many pixels to move THIS frame, like:
distance% = ship_speed * (GETTIMER() / 1000.0)

So, if 50ms has passed since the last frame:
distance = 100 * (50 / 1000.0) = 5 pixels this frame.

Then use MrTAToad's concept to loop through the 5 pixels checking for a collision at each new pixel location and reacting to any collisions when you detect them (not at the end of the 5 pixel loop).
It would basically be your collision code now, but in a loop add 1 to the x and / or y and check again until all 5 pixel positions have been checked.

This method also has the advantage to adjust itself based on computer speed, so faster computers wont move the ship faster (unless you did that by limiting your FPS which you now don't need to).

[Edit]
Plus now you can add thruster support (or brake peddle) to slowly increase / decrease your speed by a small margin.  Or power ups to alter your speed.  Or regions of space that move faster / slower.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Wampus

Quote from: MrTAToad on 2010-Dec-02
What you could do (and it would be a very interesting exercise) would be given starting x,y coordinates and ending x,y coordinates, check to see if the ship has a collision between the two sets of coordinates.
At some point I will actually need to use such a technique in a turn based strategy game I'm working on because some objects (e.g. projectiles like lasers) move much faster than a single tile on the game map. Objects may also be very small which compounds the problem. Basically, I will need to use path collision detection rather than a frame-by-frame collision detection.