How do I "damage" enemy sprite from a family

Get help using Construct 2

Post » Sat Aug 22, 2015 4:01 pm

just to stress the point you can still access the instance variable created for the family from the sprite. so from above you can still access red.maxhealth. so sprite.health is linked to family.health...
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Sat Aug 22, 2015 5:46 pm

Yes I know, im just saying that it could be easy if you create a family.maxhealth variable but then apply a diff number for each sprite as you want (sprite1.maxhealth=10, sprite2.maxhealt=20, etc), so when you create the new sprite it is created with his own number, with no need to create a new event to change this number
I dont know if im explaining myself correctly as my english is still bad ^^'
B
22
S
9
G
4
Posts: 66
Reputation: 3,775

Post » Sat Aug 22, 2015 7:24 pm

Image

if you edit the capx to the above - when run all spOrange will be created with ivHealth = 150 (which is the family (famThings) instance variable). spBlue will be created with ivhealth of 50 and spGreen with ivHealth of 100 - these figures were set by selecting (in the projects list)each of the spOrange, spBlue and spGreen in turn and the setting (in the properties list) the ivHealth value I wanted for each sprite . You can overrule these set values in the code but do not need to.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Sat Aug 22, 2015 8:48 pm

OOOOOOOOHHH! wow, now I see! that's exactly what I wanted! I feel so dumb right now, thank you very much for your patience!
B
22
S
9
G
4
Posts: 66
Reputation: 3,775

Post » Sat Oct 31, 2015 4:31 pm

Hey there,

This is exactly what i was looking for. It's just a pitty that the images and the capx in this thread are deleted. Is there a chance to get those examples again?
B
11
S
3
G
2
Posts: 76
Reputation: 1,891

Post » Sat Oct 31, 2015 6:38 pm

August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Previous

Return to How do I....?

Who is online

Users browsing this forum: dop2000, Yahoo [Bot] and 5 guests