So, what me and my friends are coding for a school project. We each got assigned roles, and I have barley a clue how to work on code. My role is said to be the easiest. It is to make a beam, which I have the png file for, shoot the player once they walk in the middle. It doesn’t kill them, it should take away a 2/3 of their health. How do I get started on something like that
You can use a trigger collision object to detect when to fire the beam. Firing means spawning a beam game object containing another trigger. When the player (containing its own collision object) collides with the beam trigger, deduce health.
Here’s a minimal trigger example: https://www.defold.com/examples/physics/trigger/
Here’s a spawn minimal example: https://www.defold.com/examples/basics/spawn/
And here is a tutorial how to do something on collision: https://www.defold.com/tutorials/side-scroller/
The tutorial removes stars and awards points on collide. Deducing health can be done in the same way.
3 Likes
Thank you very much, that was actually very helpful.