Hi! I've quite recently started learning javascript and I still have quite some trouble with it. I'm currently working on a RPG-game and have started a test scene, it contains:
EnemyCube <- Atm static cube, with a box collider and a script that senses if mouse is over it and makes it change colors aswell as mouse cursor-texture. If mousebutton is pressed when it's hovering over it the variable "selected" is changed from 0 to 1.
PlayerCube <- Moves to where the mouse is clicking, it has a box collider aswell as an empty child-object with a sphere collider ("RangeCollider"), I want the rangecollider to kick in when it senses another Collision, I want it to check if the other colliders object is tagged with the tag "monster"
In case the tag is "monster" I want it to read if the "selected" variable is 1 in the EnemyCubes script, in that case I also want the PlayerCube to call "function isInCombat()"
My problem is the part where I want my "RangeCollider" to look if the other collider has the EnemyScript and if that scripts "selected" variable is set to 1. I'm kinda clueless.