Hi I’m making a game and I was wondering if there was a way to make a health bar and obstacle s to reduce the health. Please help
Hi @Granted,
This progress bar example may be useful here:
https://developer.playcanvas.com/en/tutorials/ui-elements-progress/
how would i make a obstacle to damage the player
You can listen for collision events to check if there is an impact between the obstacle and your player.
Check the collisions and triggers example project:
https://developer.playcanvas.com/en/tutorials/collision-and-triggers/
also out of curiosity how would i make a gun to damage other players
For a gun a common practice is use a raycast from the gun point towards the direction it is facing when press the fire key.
If the raycast returns a result and that’s another player, inflict the damage.
Here are several demo projects you can study that involve raycasting:
could you maybe tell me a little on how this works please
also this is completely out of the blue but is there a way to play a sound when a player jumps in fps. Cuz i want the sound to only be played when the player is grounded
I think you should do yourself a favor and study both the User Manual and the Tutorials, all that you ask in some form are answered there.
Start here and best of luck
ok thank you
I could help, especially with the raycast part, i can help you make people die when shot, stuff like that
thank you can i add u
Yes, my account is @oofinz_official
added u
Ok
also i was maybe thinking a healthbar in a ui or above the player
Hmm, ok, i may be able to figure out to hover it above
Whats the code for a healthbar?
can you make the health bar please?