0
Aiming with line for top down shooter. How?
Hey guys. I am not good at math and because of it I've got a problem. I want to make shooting in my shooter game (obviously, lol), but I don't know how to make aim. I want it to be like laser sight, red line to point where you gonna shoot. You press a button and character take out his gun, then you need to aim up and down with buttons. How to do so? All I done is shooting itself. When you press the up and down buttons - Y velocity of the bullet changing like velocity += 0.1, but I think that this is nonsense and I need some other logic
3 Respuestas
+ 3
Attach your code too maybe you can get some suggestions from community
+ 1
here is example of what I've done so far
https://code.sololearn.com/WL5V6VAYIe72/?ref=app
0
If you just want a straightline aim you cane replace your lineto with
c.lineTo(10 + 10 * vx, 50 + 10 * vy);
This way your line would show where the bullet be in 10 frames
Does it worry you that the bullet speed depends on the direction? If that's a proplem you might need to use a rotation instead of just adding to the vertical speed component