How do I make enemies with health bars?

Get help using Construct 2

Post » Mon May 11, 2015 2:19 pm

Ah, be sure to move the "On Collision" events out from underneath the For Each, that should make it trigger only once per bullet (then you can destroy the bullet), whereas if it's under the For Each it will run for every enemy before being destroyed.

In the pink box case, change the Y value for "Set position to" from Zombie.Y to (Zombie.Y - Zombie.Height / 2)

That should center it on the zombie :)
Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
127
S
43
G
18
Posts: 2,240
Reputation: 20,592

Post » Mon May 11, 2015 3:21 pm

Hey @Jayjay, I tried but wasn't sure what to move, didn't work :( But the Pink Sprite block is centered now! Thank you! Glad you are helpping me otherwise I would get stuck here for a long time :)!

But do I move that marked with green? or with dark-blue?

Image

Is it okey if my pink block behavior is set to solid?
B
8
S
3
Posts: 120
Reputation: 989

Post » Mon May 11, 2015 3:57 pm

Move all four of those outside of the For Each (so they are on the same level). In practice the easiest way is move all for at once (hold control to select multiple) above the For Each. And it should be fine if the box is solid yes :)
Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
127
S
43
G
18
Posts: 2,240
Reputation: 20,592

Post » Mon May 11, 2015 6:36 pm

Okey @Jayjay I have created Collision_zombie(PINK BOX) - On start of layout - Set position & Pin

I moved the 4 collision bullets away, but even without the pink box ti still kills 2 of them and it's still does that random flying thing :(

Image
Image

Im good with images but not good with coding this ...
Sorry for bothering you on this one soo much :(
Last edited by Frap1K on Mon May 11, 2015 8:39 pm, edited 1 time in total.
B
8
S
3
Posts: 120
Reputation: 989

Post » Mon May 11, 2015 7:21 pm

Ah, make sure to destroy the bullet before the Wait 2 seconds action, otherwise it probably will trigger other events, and no problem! I am glad to help :)
Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
127
S
43
G
18
Posts: 2,240
Reputation: 20,592

Post » Mon May 11, 2015 7:41 pm

I would remove the is overlapping event in the for each event, for it's unnescassary, because the zombiebox and zombieheadbox are already in the container with the zombie so the actions will only affect the ones concerned.

These overlapping events event could create issues when two zombies are overlapping..
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 » Mon May 11, 2015 8:41 pm

Okey @LittleStain Ill try it! Thank you!
B
8
S
3
Posts: 120
Reputation: 989

Post » Mon May 11, 2015 8:53 pm

It didn't work @LittleStain, The Hitboxes just stay in one place they dont follow the zombie. But Is there a way to make the PINK Box Sprite collide?
As soon as I removed the Solid from the Zombie behavior it stopped flying across the map with the high speed...
B
8
S
3
Posts: 120
Reputation: 989

Post » Mon May 11, 2015 9:16 pm

@Jayjay It woker! But I cant set their Behaviour to Solid... But how will they Collide then?? o.O

Image

Thank you, for your attention!
B
8
S
3
Posts: 120
Reputation: 989

Post » Mon May 11, 2015 9:16 pm

@Jayjay It woker! But I cant set their Behaviour to Solid... But how will they Collide then?? o.O

Image

Thank you, for your attention!
B
8
S
3
Posts: 120
Reputation: 989

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, grigrizljac and 8 guests