Trouble creating a score bonus for Breakout Clone

0 favourites
  • 5 posts
From the Asset Store
Awardkit
$5 USD
Create custom awards and achievement or use the many templates and create your own.
  • I'm working on my first game, a Breakout clone (gotta start somewhere, right?). The twist is that the goal is not to destroy all the blocks on the screen, but to destroy certain targets. The blocks are just obstacles for the ball. But I figure I should reward the player for destroying all the blocks. But I cant quite figure it out.

    I currently have it set like this:

    <img src="http://farm9.staticflickr.com/8385/8634569429_e495b31acf.jpg" border="0" />

    When the block count is less than or equal to 0, I add ten to the score, display a message informing the player of the bonus, then sets that to invisible after 1 second. However, this causes 10 to be added to the score every frame, and I can't think of any other way to do it. help a newbie out please?

  • I would create 2 groups

    Group 1 (Active by default):

    System Block.Count =<:

    -0 Enable Group2

    Group 2 (Inactive by default)

    System, Is Group 2 active:

    -Disable Group 1

    -Add 10 to score

    -Set Text Visible

    -Set Text "All Blocks Destroyed"

    -Disable Group2

    Then a couple more events:

    If Text = "All Blocks Destroyed":

    Set opacity= lerp(error.Opacity,1, 1-0.1^dt) (adjust as needed)

    If Text Opacity =< 0:

    set Text to invisible

  • You also have the run once option.

    You could also create a variable to track if all blocks are broken. Set it to 1 when all blocks are broken. Have a trigger that checks if the variable is 1, if so adds 10 to the score, then sets the variable back to 0. That may work for you.

    The current issue is you are basically saying when all blocks are broken add 10 points, well every time the code runs through (each frame) it is still true. So you need a way of setting a condition that they are broken and then clearing it so the code doesn't keep running.

  • 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! Adding the trigger once condition (that IS what you meant by the run once option, right?) worked perfectly. I figured it'd be something stupidly simple like that.

  • DillonMakesGames that's the one! Sorry didn't have Construct in front of me at the time. Glad to have been of help!

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