2D enemy shoot bullets

I have this 2D game and I need to make the red cube (enemy) shoot the black bullets at the player, and when the collision hits the player for the player to be disabled, and a 2D UI screen is enabled at the same time. Any Ideas?

Hi @Jacob_McBride1,

Try splitting this in smaller tasks:

  • For shooting a projectile you can use physics/forces. Check this mini course on how to apply a force to a dynamic body: Making a Simple Game - Part 1 | Learn PlayCanvas

  • For detecting when a bullet hits the player use triggers, check this tutorial: Collision and Triggers | Learn PlayCanvas

  • At the end you can use the entity .enabled property in your code, on the player entity and the UI screen, to disable the former and enable the latter accordingly.

2 Likes

Okay!