Scoring with Projectiles
At the moment I am working on a PS2 style game.
It came across my mind that at some point, I would have a free-for-all mode where first to 10 points wins. As such, I need to create a system where after firing a projectile from an emitted weapon (to save on thermo), if that projectile lands a kill, the person firing the weapon is awarded a point.
I’ve had no success thus far, but I’ve tried attaching a transmitter to the projectile, that carries the value all the way from the player to the projectile.
When the player is killed, there is a brief time at which a receiver in the player reads the signal for the projectile. As it is carrying a fat wire for player info, it transmits this to the receiver, and this receiver gives a point to the player.
It works for player one, but when the other player kills player one, both are rewarded points.
Any suggestions?
(I think it might be to do with the fact that the projectile and weapon aren’t in the same group. Therefore the emit with wires option doesn’t emit correctly)
-
The easiest way would be to have one bullet for player 1, one bullet for player 2. Player 1 emits bullet 1, Player 2 emits bullet 2. Bullet 1 scores for player 1, bullet 2 scores for player 2.
-
I'd recommend going the tried and true method and use a raycast for your hit detection. You place a laser scope on the weapon (or puppet), then pulse it on trigger pull. If there's a hit, add a point. The projectile is just cosmetic. This will be overall more reliable for a variety of reasons, which is why most games use it. :)
-
True. It may be frustrating if your "bullet" hits when your scope doesn't or visa versa, so watch out for that. In that case the bullet should probably move very fast.
-
Indeed. There are other gotchas as well if you want to simulate things like bullet travel time, and bullet drop. So in those cases, the raycast method may mean more logic/math work.
Of course in that case, if you get stuck on the logic, you have smarties like TAP here to help work it out. :)
Iniciar sesión para dejar un comentario.