Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ThreeSpark |
In short, I have a playspace scene. This is where the enemies spawn. It has a variable called “damage” that changes over time. When the player clicks on an enemy, I want that enemy’s “health” variable to go down by the playspace’s “damage” variable. How do I do that?
Could you specify how you have set up your code? Is there a main Node where you store the bulk of your game’s logic? If that is the case, then use the click event to trigger the damage-inflicting function. Your damage variable and the click event listener should be in the same script.
johnygames | 2018-11-11 22:14