This is my first time making a game and it’s a school project and I have some ideas to make my game better but I just have no idea how to code them
Here’s something I want to do
I wanted a text balloon to pop up over the mushroom house whenever my character comes near it, how do I do that?
Also, I wanted my pink orbs to have a disintegrating effect when the main character collects it before they get destroyed, is that possible?
Here is my project so you can get ideas. Please help! https://playcanvas.com/editor/scene/1117590
Thank you in advance!
There are couple of ways to do this. You can do a simple distance check between the player and the mushroom house and if it’s within a certain distance, show the popup.
Or as you are using physics already, you can use a trigger area so that when the player enters/leaves, you can show/hide the popup.
https://developer.playcanvas.com/en/tutorials/collision-and-triggers/
I would look at using particle effects, maybe even with animated textures: https://developer.playcanvas.com/en/tutorials/?tags=particles
Is there a specific code or sample for this? Sorry I’m pretty new
var housePosition = this.mushroomHouse.getPosition();
var characterPosition = this.character.getPosition();
if (characterPosition.distance(housePosition) > 10) {
// hide popup
} else {
// show popup
}
1 Like