Trouble creating a score bonus for Breakout Clone

Get help using Construct 2

Post » Tue Apr 09, 2013 7:47 pm

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:


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?DillonMakesGames2013-04-09 19:50:15
B
6
Posts: 10
Reputation: 545

Post » Tue Apr 09, 2013 8:39 pm

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
B
6
S
3
G
1
Posts: 102
Reputation: 1,379

Post » Tue Apr 09, 2013 9:18 pm

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.
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Wed Apr 10, 2013 4:22 am

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.
B
6
Posts: 10
Reputation: 545

Post » Wed Apr 10, 2013 7:01 am

@DillonMakesGames that's the one! Sorry didn't have Construct in front of me at the time. Glad to have been of help!
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418


Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 17 guests