Player & Enemy Same sprite

Get help using Construct 2

Post » Tue Jun 09, 2015 6:00 pm

I am at a bit of a loss. I want the enemy to use the same sprite as the player.

Sprite has:
Hit box
Body
Weapon

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.
B
3
Posts: 4
Reputation: 183

Post » Tue Jun 09, 2015 6:56 pm

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Jun 09, 2015 10:36 pm

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.
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Fri Jun 12, 2015 2:14 am

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
B
3
Posts: 4
Reputation: 183


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 29 guests