How do I use instances instead of clones in this mechanic?

0 favourites
  • 9 posts
  • Hello friends, this is a piece of a larger game I'm working on. I have it working fine with separate objects, but I know I should be using instances and variables, or instances and then doing it entirely through animation frame matching. I have tried and tried but I can't get it working using either of these approaches. It's easy enough using the method I am using here, but it's very annoying that I'm not doing it properly. Any help is greatly appreciated. Thanks

    dropbox.com/s/fzjekbw5asvzyat/only%20hearts.c3p

    Basic mechanic:

    1) Hearts are created and drop using physics

    2) There are empty (faded opacity) heart slots at the top

    3) Upon clicking the falling hearts, they are matched by animation frame, and the ones at top become fully opaque

    4) When all are matched, it resets

    Also, I'm sure there are other and perhaps better approaches to marking them as "achieved", both individually and when all have been achieved - booleans, etc. I'm open to suggestions for sure. I just settled on using opacity since it was easy.

    Tagged:

  • Post a link to a version without 3rd party plugins (betteroutline) and I'll have a look

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've updated the link. Thank you.

  • this is how I would do it...

    https://www.rieperts.com/games/forum/onlyHearts2.c3p

    I made it so that you can only select each color once, but it doesn't have to be that way.

  • this is how I would do it...

    https://www.rieperts.com/games/forum/onlyHearts2.c3p

    I made it so that you can only select each color once, but it doesn't have to be that way.

    Thanks so much Allan! This is fantastic, and so much more concise than I even thought possible. Pick by evaluate was exactly the kind of functionality that I was saying to myself "this is what I need - a combined pick instance and compare state." I've never used it or frankly even noticed it, so that's a revelation, I will have to become much more familiar with it. Even more awesome is the picked count, which is a system expression I take it. That will be incredibly useful for the kind of content I create (educational games). Thanks again.

  • Allan, I have really been struggling trying to figure out how to execute the "create a heart every X seconds" by using a timer object instead of the every x seconds action. I would greatly appreciate any assistance.

    This is part of a bigger game where I'm using a lot of the every x seconds commands, and they are not behaving well with game restarts, etc. I know I need to be using timers, but I've struggled with it, and I haven't found good examples as it relates to spawning.

    Many thanks for any assistance.

  • It's quite simple. Add Timer behavior to some static object on the layout, or create an invisible sprite for that.

    Run this action once, for example in "On start of layout" event:

    Sprite Start timer "spawn" for 1s (regular)

    If will trigger "Sprite On Timer" event every second, which you can use to spawn hearts.

  • It's quite simple. Add Timer behavior to some static object on the layout, or create an invisible sprite for that.

    Run this action once, for example in "On start of layout" event:

    Sprite Start timer "spawn" for 1s (regular)

    If will trigger "Sprite On Timer" event every second, which you can use to spawn hearts.

    Thanks very much. I have it working. When I do it this way, with create as opposed to spawn, am I not creating instances? When I set it to spawn it was making copies as they were falling.

    I can see it's much more effective than every x seconds, easy to pause, etc.

  • Thanks to both of you for the help. I think I can run with this. Very much appreciated!

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