Breakout clone powerup question
Let's be somewhat extreme. :)
I have several bricks in different colors called "color_brick" i.e red_brick, blue_brick and so on, already set as a level.
Every 7 second i want to pick one of them at random for about 5 seconds and if the ball hit the picked brick it will produce one of five power ups, so the player can catch it with the paddle.
And after the seven seconds, the randomizer will pick another brick to "power up" for five seconds.
Pretty straight forward, but i don't have a clue on how to code it in MMF2.
I understand that i can make a group of it so i don't have to code it the whole day, right ?
Anyone ?
Re: Breakout clone powerup question
Frame editor:
Select all bricks and give then a qualifier, for instance: Group.1
Event editor:
* Timer: Every 7 seconds
- Group.1: Set flag 0 Off
* Timer: Every 7 seconds
+ Pick one of Group.1 at random
- Group.1: Set flag 0 On
* Flag 0 of Group.1 is On
+ Ball collides with Group.1
- Create object Bonus at 0,0 from Group.1
I think that will work, but haven't tested it.
You could also, instead of using flags, use a counter to which you set the fixed value of a random brick every 7 second, and then test if the brick's fixed value equals the counter when the ball hits it.
Re: Breakout clone powerup question
Ok thanks for the answer.
Just to repeat so you can correct me if i understand it wrong.
Every 7 seconds i set the whole group to flag 0 to Off.
Every 7 seconds is a randomly picked brick set to flag 0 to On
Then if a ball collides with a brick with flag 0 set to On, it will produce a power up.
But i want to set the flag 0 to Off again after 5 seconds, so there is lesser chance to get a power up. How will i do that ?
Re: Breakout clone powerup question
I can't seem to get it to work..
Tackle it tomorrow.
Re: Breakout clone powerup question
* Flag 0 of Group.1 is On
- Group.1: add 1 to alterable value A
* Alerable value A of Group.1 >= 250
- Group.1: Set flag 0 Off
250 equals 5 seconds if framerate is set to 50 (which is default).
Re: Breakout clone powerup question
Another thing i cant get to work is the collision between the brick with "Flag 0 On" and the ball.
It wont produce any result, it handles it like a regular brick.
Maybe i have to set the collision statement somewhere else ?
Re: Breakout clone powerup question
Do you do it exactly like this:
* Flag 0 of Group.1 is On
+ Ball collides with Group.1
- Create object Bonus at 0,0 from Group.1
If that doesn't work, are you sure that flag 0 really is on?
To test that, you can place another object on the brick with flag 0 = on.
* Always
- Active1: Set to invisible // hiding the object when no bricks are active
* Flag 0 of Group.1 = On
- Active1: Set position to 0,0 from Group.1
- Active1: Set to visible
Then you'll' always see which brick is active.
Re: Breakout clone powerup question
I will try to do a trouble search when i get the time.
Re: Breakout clone powerup question
I still can't get it to work.. I'm loosing hair over this. :)
If you look at the picture, you can see that I have a test scenario.
http://home.swipnet.se/blackstorm/random_pu.jpg
Row 13: I pick one at random, and set the flag, for the moment it always stay in the same brick.
Row 14: The actual collision between the ball and the flagged object it should produce a power up and start the motion so it falls to the bottom.
Row 15: Setting of the flag and creating the power up and stopping the motion to prevent it from falling, just to see where it is.
So row 13 and 15 is no problem since i can see where it is, but when i collide with the brick no power up is created.
And if i switch the order so Row 15 become Row 14, still no power up.
Please help me.
Re: Breakout clone powerup question
I'm bumping this, cause I want a solution to my problem.