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

0 favourites
From the Asset Store
Piano tiles
$9.99 USD
Template for a piano tiles game, fully documented in comments and video
  • Bump.

  • Bump. Please, I really need some help.

  • The other events are contradicting the events you want executed..

    So when you want one thing to happen another condition is also true so the actions from that event are also done..

    These are conflicting events - and they are performed every tick, which isn't necessary..

    Replace the other events with events like the above

    leveloneenemy on destroyed

    -add 1 to..

    -set width to..

    leveltwoenemy on destroyed

    -add 1 to..

    -set width to..

    etcetera..

    By the way, bumping your thread after one and a half hours isn't really considered polite, just so you know..

  • If you need to have events regarding to different levels on one event sheet it might be easier to have a global variable level and check if that is true before checking other conditions.

    you could also have all stuff regarding another level in a group which you activate or deactivate when that level is played..

    another option would be to have a seperate event sheet for level specific things and include it in your main event sheet.

  • Hey LittleStain, I did what you said, but should I also delete the highlighted part below (lifeHeartTiled - varlifeHearts = 1 ---> Set width to 24, etc.)? Should I delete all of those lines of code as well?

  • [attachment=0:f03wmgi0][/attachment:f03wmgi0]

    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

  • 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)?

  • 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?

  • I would delete them and just use

    Set width to lifeHeartTiled.varlifeHearts*24

    everytime you have an action that changes lifeHeartTiled.varlifeHearts

  • 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?

  • 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)

  • 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:

    Do I have to use a global variable or something?

  • 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..

  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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..

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)