Breaking 2 objects results in only 1 score

This forum is currently in read-only mode.
From the Asset Store
Create the right kind of drama with Film Scoring Tools sound library!
  • Hey everyone! This is my first post. I searched forum topics and did Google and Bing searches for the last 6 hours, or so, and can't seem to find any other reports of my problem. So I hope I'm not bothering anyone.

    I am starting out with a simple Breakout clone. I followed the tutorial, here:

    scirra.com/tutorials/46/introduction-to-families-for-construct-classic/page-1

    It's a great tutorial and got me up and going. My problem is that my ball sometimes breaks two bricks, which isn't a problem while playing the game... but for some reason, even though both bricks get destroyed, you only get score for one, and my variable that calculates the end of the round only gets +1 added to it. So by the end of the bricks, the game is waiting for more.

    I uploaded a cap to wlok.com/upload/breakout01.cap

    Other than the double destruction, it seems to run pretty well.

    Any help would be appreciated. And I'll keep trying other things. I read somewhere that I might not use the "Ball" object but I will need to read up on Custom Movement before I start that.

  • I seems intuitive that it would add two.

    First, one would assume that On Collision is a triggered condition, as most conditions begin with the word "On" are.

    A green arrow appears before the condition name on the event sheet for triggered conditions:

    <img src="http://dl.dropbox.com/u/1013446/forumhelp/trigger.PNG" border="0" />

    in the screenshot below you can see this is not present on the On Collision condition.

    Since the condition is not triggered by each collision, and instead is evaluated once in the order it appears in the event sheet. Those actions are carried out one time, regardless of the number of colliding instances, and all instances are picked at the same time. This is useful, because you can do things like make a sound play once even in the event of multiple collisions, instead of playing twice at the same time, etc,

    If you need an action for each collision, you can still use a 'System: For Each Object' subevent to loop through each of the objects that are picked in the collision event - which results in the behavior you originally intended:

    <img src="http://dl.dropbox.com/u/1013446/forumhelp/bricks.PNG" border="0" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you so much lucid! I am trying to wrap my mind around why it would destroy the two blocks, but not score 2 blocks. Give me a little time and it will sink in to my brain. Hehe.

    I understand your fix, tho. And that's the first time I've ever used a Sub-Event. I'm going to have to look at the manual for that specifically and learn more about them.

    This worked perfectly and pretty much finished up the first board of the game. I really appreciate your help! I usually dish out hugs but I will get to know everyone better before that. Hehe.

    Let me know if you'd like an exe of what I have so far. ^_^

  • That was my first tutorial - glad it helped :)

    lucid

    Interestingly, I originally had the 'for each' condition but took it out after Ashley said I didn't need it, because the family inherrently used the for-each condition when checking.

  • This is something where C2 and CC currently differ, but hopefully will be fixed soon. C2 runs some sort of a loop when collisions happen based upon the number of instances involved.

    http://www.scirra.com/forum/r75-loop-apparently-running-without-a-loop_topic48141.html

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