Make a enemy with a gun

Hi guys!

In the moment I’m working at my project. But I have a problem. If you create a 3D-schooter you also need enemies and life information! I’ve already build a gun but that’s not enough. :unamused:

Can somebody help me? It will great, if somebody finds out, that the enemy can attack you with a gun! :slightly_smiling_face:

Yours,
Rex Dungeur

Hello,

All the community is here to help :slight_smile: but it would be great if could narrow down the question a bit.

Is it more about modeling and creating the assets, the physics and/or collision detection, the “AI” to move the enemy, the animation of the characters, the sound or the general approach ?

I only need the information how a subject like a box (enemy) can attack you and that your life goes down.

This is still a broad subject :slight_smile:

If it is about a gun, I guess basically you would need to simulate firing a bullet with a bit of randomization depending on the ennemy accuracy. Then you would ray cast in this random direction and see if the ray hits the player. If yes you could decrease its life else you would not.

https://doc.babylonjs.com/babylon101/raycasts

1 Like

I agree.

What’s about the life information? How can I build it in my game?

It will be nice if it’s on the left above. :wink:

You can use the babylon GUI extension:
https://doc.babylonjs.com/how_to/gui

I found this PG example (Babylon.js Documentation):
https://www.babylonjs-playground.com/#3BZFBP#0

4 Likes