Need a hand with generating random balls
I'm making a bubble shooter type game. I can't seem to get this all sorted out. What I want is this:
1. 1 colored ball to shoot
2. 2 display balls (1 that will fire next and 1 that is after the current shot)
3. When all the bricks are shot that corresponds to a color to not have that ball come up to shoot.
Here's what I have so far;
Right now I have different colored actors that correspond to numbers in game.attributes;
1 actor type that is the actual ball that has physics and collisions that bounce around and such
1 actor type that is the "shot display" that just changes alpha from 1 to 0 and back if it's next to be shot
1 actor type that is pretty much the same as the "shot display" but is "on deck" ball
(I hope this has made sense so far...)
I have a number of game.attributes that are as follows;
game.ColorToShoot
game.NextColorToShoot
game.RandomBallGenerator
game.BlueBricks
game.RedBricks
At the beginning of the level the engine counts the number of red and blue bricks and assigns that number accordingly to game.BlueBricks and game.RedBricks
I have an invisible actor that generates the colors for the display and what to shoot.
So, I have some rules;
Every time the mouse is down, change attribute game.RandomBallGenerator to Random(1,2)
Change Attribute game.NextBallToShoot to game.RandomBallGenerator, Change Attribute game.BallToShoot to game.NextBallToShoot
Then I have a rule that if game.RedBricks = 0 Change Attribute game.RandomBallGenerator to Random(1,2).
SO, FINALLY TO MY ISSUE...
This seems to work only occasionally. It seems like for about 2 or 3 shots it'll work fine but then I'll get a blue ball (or really any colored ball that those bricks are gone from...)
I know this is a lot to digest in one post, but if you have questions about what I'm trying to accomplish please ask so I can get this sorted out. It's the last big issue in my behaviors that I need to work out!
Thanks!
1. 1 colored ball to shoot
2. 2 display balls (1 that will fire next and 1 that is after the current shot)
3. When all the bricks are shot that corresponds to a color to not have that ball come up to shoot.
Here's what I have so far;
Right now I have different colored actors that correspond to numbers in game.attributes;
1 actor type that is the actual ball that has physics and collisions that bounce around and such
1 actor type that is the "shot display" that just changes alpha from 1 to 0 and back if it's next to be shot
1 actor type that is pretty much the same as the "shot display" but is "on deck" ball
(I hope this has made sense so far...)
I have a number of game.attributes that are as follows;
game.ColorToShoot
game.NextColorToShoot
game.RandomBallGenerator
game.BlueBricks
game.RedBricks
At the beginning of the level the engine counts the number of red and blue bricks and assigns that number accordingly to game.BlueBricks and game.RedBricks
I have an invisible actor that generates the colors for the display and what to shoot.
So, I have some rules;
Every time the mouse is down, change attribute game.RandomBallGenerator to Random(1,2)
Change Attribute game.NextBallToShoot to game.RandomBallGenerator, Change Attribute game.BallToShoot to game.NextBallToShoot
Then I have a rule that if game.RedBricks = 0 Change Attribute game.RandomBallGenerator to Random(1,2).
SO, FINALLY TO MY ISSUE...
This seems to work only occasionally. It seems like for about 2 or 3 shots it'll work fine but then I'll get a blue ball (or really any colored ball that those bricks are gone from...)
I know this is a lot to digest in one post, but if you have questions about what I'm trying to accomplish please ask so I can get this sorted out. It's the last big issue in my behaviors that I need to work out!
Thanks!
Comments
1. I'll create game attribute for each color of the bricks (ex. blueCount, yellowCount...etc..) then ill set that to integers.
2. Then on each colorbrick ill add a change attribute "blueCount = blucCount+1" on bluebricks and so on....
3. This change attribute will keep count of all the color brick you place inside your scene. Lets say you place 10 blue and 5 reds inside your scene. The blueCount will automatically be 10 and the redCount will be 5.
4. In order to check the blueCount you must change the blueCount attribute to blueCount-1 whenever you break it. (hint you can place this change attri in the ball actor so whenever it collide to the blueBrick it will deduct 1 blueCount.
5. now you can set a rule to check if there are still BlueBrick on the scene by checking the value of blueCount.
sorry if its a bit confusing but i hope you got my point.
I have that man. I have individual counters for the randomly generated bricks. Every time the ball collides with the brick it subtracts one from that colored brick. Then, I have a rule on the ball generator that says that if bluebricks = 0 and BallColorToShoot is blue (1) then change attribute BallColorToShoot to random.
It works but only for a few shots. It will eventually respawn another blue ball to shoot. That's my problem, is that it doesn't work 100% of the time, only like 60% of the time...
I need it to work 100% of the time :-)