• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Game Mechanics mouse aiming in a 2.5d game

T

Tempus

Guest
Hi,
i´m trying to get a good mouse aiming in a 2.5d game.

I want to shoot a laser.
The laser shoots through enemies and stops at a wall
The laser gun is above the ground on top of the player and is controlled with the mouse.
The collision boxes are only the lower part of the objects, so they can overlap a bit to get a pseudo 3d effect

like this
upload_2017-4-21_11-19-16.png

right now my aiming and collision looks like this
upload_2017-4-21_11-19-59.png


The problem is aiming is really diffcult

upload_2017-4-21_11-20-37.png
the player thinks he hitting the enemy 1 but the collision line is under the enemy .
the player thinks he shoots over the the enemy 2 but he is hitting the enemy.



how do you handle mouseaiming in 2.5d?
 
Last edited by a moderator:

Genetix

Member
I would match the collision of the laser with the location it is being drawn. You can give the laser a shadow below that helps create the 3d look.
 
T

Tempus

Guest
Right now i try the following concept.


The player shoots at the ground where the mousepointer is.
A line at the ground from the player to the mousepointer is to check the collisions with walls. It is to get the endpoint of the laser.
Then i draw the laser from the gun which ends at the ground (mousepointer) or a wall.
The laser checks for collisions with enemies.
So the line on the ground from the player base to the mousepointer for walls. The line from the gun to the mousepointer for enemies.
upload_2017-4-26_22-33-16.png
This has the benefit that i can shoot at the ground.
The drawback is that aiming distant enemies requires to move the mouse a greater distance.
Less spray and pray more sniping. I think this aiming is a bit slower.

I'm looking forward for other solutions.
I guess a lot of 2.5d games with relative tall playercharacters have this problem.
 
Last edited by a moderator:
R

Regniwekim

Guest
This is a difficult concept to make work, especially if the laser graphic is persistent. It's something a lot of big games struggles to get right (see LoL) where the graphics don't match the hitbox a lot of time because of weird perspective issues. You could always just draw a graphic from the player's feet that stretches to the aim point to show the player where it will definitely collide.
 
T

Tempus

Guest
for now i stay with the above concept of firing at the mousepointer at the ground.
(still looking forward for other solutions)

Right now i don´t do the collision check 100% true. I make a separate hitbox for the enemies as big as the sprite. So it´s easy to aim but not 100% right.
Sometimes the beams should miss the enemies (shoot besides) but hit them.
I think most players would be more irritated if the beam crosses the enemie but does not damage it.
So in the above picture i damage the two enemies with the laser. Even if the upper enemie is not really hit.
 
Top