How do I subtract a portion of width from a tiled object!?

Get help using Construct 2

Post » Wed Jul 16, 2014 4:17 pm

Capturelive1.PNG


You do understand these two actions are the same?

set width to 0
set width to 0*24 = 0

All the other events concerning setting the width are redundant if you use the
set width to lifehearttiled.varlifehearts*24 on events that trigger a change in varlifehearts
You do not have the required permissions to view the files attached to this post.
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 » Wed Jul 16, 2014 4:32 pm

Hey @LittleStain, lol yeah, now I get it. So, I'll delete the "set width to 0, etc." pieces of code, but should I also delete these pieces of code as well (are they also redundant)?

Image
Image
B
33
S
8
G
1
Posts: 626
Reputation: 3,775

Post » Wed Jul 16, 2014 4:48 pm

Regarding the highlighted lines of code directly above, should I replace, "Set width to ..." with "Set width to lifeHeartTiled.varlifeHearts*24"? Or, just delete them entirely?
B
33
S
8
G
1
Posts: 626
Reputation: 3,775

Post » Wed Jul 16, 2014 4:57 pm

I would delete them and just use

Set width to lifeHeartTiled.varlifeHearts*24

everytime you have an action that changes lifeHeartTiled.varlifeHearts
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 » Wed Jul 16, 2014 5:26 pm

Sorry, I just want to make it clear, I should completely delete those lines of code? Not just replace "Set width to..." with "Set width to lifeHeartTiled.varlifeHearts*24", like I did below?

Image
B
33
S
8
G
1
Posts: 626
Reputation: 3,775

Post » Wed Jul 16, 2014 5:31 pm

If you'd rather still see them, just right click and set them disabled..

but yes like I showed in my first picture.. delete all that is crossed out in red.. (Thought that was obvious)
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 » Wed Jul 16, 2014 6:21 pm

OK, I did what you said, but it's still not working. This time, it works fine on level one, but on level two and on all of the other nine levels, the hearts just ignore their commands and displays way more hearts than it's supposed to. For example, on level two, it should show only two hearts, but instead, it shows this: Image

Image
Image

Do I have to use a global variable or something?
B
33
S
8
G
1
Posts: 626
Reputation: 3,775

Post » Wed Jul 16, 2014 6:35 pm

you have an event levelonenemy destroyed for level 1 that's why it's working..
for your level 2 enemies you still have the enemy2health<0 event, which isn't working..
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 » Wed Jul 16, 2014 7:04 pm

So, how would I make it so that when all of level 2's enemies are killed --> add 1? My enemies are grouped in families, but the problem was/is, instead of adding 1 heart when all of the level's enemies have been destroyed, it would add 1 heart every time I destroyed a single enemy on the level. So, if I changed the "enemy2health<0 event" with "familyEnemies2<0", how would I make it so that only when it destroy all enemies on the level will it add 1 heart, rather than adding 1 every time a single enemy is destroyed?
B
33
S
8
G
1
Posts: 626
Reputation: 3,775

Post » Wed Jul 16, 2014 7:37 pm

test if any enemies are left on screen using the .count

system compare two values: familyenemies.count=0

but you should only do this in level two, only trigger it once and only have it active after enemies have been created..

so please let the program know on what level it is by using a global variable level and please put all the events for level 1, level 2 etcetara in their own group and only activate it when that level is playing..
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

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: ultrafop and 12 guests