I am at a bit of a loss. I want the enemy to use the same sprite as the player.
Each one has a variable for team and peerID, i want to make it multiplayer once i get single setup.
I am trying to figure out a way to have the weapon dmg the enemy or player.
I have setup
Weapon on collision with HitBox
Weapon team not = to hitbox team
then deal dmg to hit box.
this does not work and i am not fully sure why. If i do it with the multiplayer myID variable it does work.
Develop games in your browser. Powerful, performant & highly capable.
You could try something like on start of layout set an instance variable on the weapon to either the hitbox.uid or an instance variable of the hitbox, that way you'd only have to check if the instance variable is the same on collision, if not, do damage..
Add an instance variable - something like "owningUID" for the weapon. When you spawn it, save the UID of the sprite that fired it in owningUID - then when you have a collision you can check to see if the weapon belongs to the sprite that spawned it , or not.
i was able to figure it out.
i put player weapon as a family of it own
hitbox on collision with player_Weapons
Pick hitbox where team != to weapon team