1 decade ago by Silent
Hello.
I want my NPCs to glow whenever they're in contact with the player. I need a flag that will tell me whether or not the NPC is touching the player, and set the animation accordingly.
I have the following code -
However, apparently, MyGame.getEntitiesByType is not a function. I assume it has something to do with my NPC class not knowing MyGame. Can someone please give me a hint?
Thanks in advance.
I want my NPCs to glow whenever they're in contact with the player. I need a flag that will tell me whether or not the NPC is touching the player, and set the animation accordingly.
I have the following code -
update: function () { this.parent(); var player = MyGame.getEntitiesByType( EntityPlayer )[0]; if(this.touches(player)) { // Glow } }
However, apparently, MyGame.getEntitiesByType is not a function. I assume it has something to do with my NPC class not knowing MyGame. Can someone please give me a hint?
Thanks in advance.