Bubble Breaker Shooting Help
DrGlickert
Member Posts: 1,135
I'd like to make a bubble breaker game to help teach me some basic GS concepts. Here's my problem right now:
I'd like to have my "cannon" shoot random colored balls at the bubbles. What is the best way to do this? I set up an attribute (Ball Color) and made it an Integer. Then I gave the "cannon" a rule where it spawns the blue ball if the attribute Ball Color is 1, and it would shoot a Red ball if the Ball Color is 2, both of those rules are followed with a Change Attribute Ball Color to Random (1,2).
Sometimes my "cannon" shoots two balls, sometimes just one. But there really is no consistency. Any ideas? (I did try to change Ball Color attribute to an index and that did not help).
I'd like to have my "cannon" shoot random colored balls at the bubbles. What is the best way to do this? I set up an attribute (Ball Color) and made it an Integer. Then I gave the "cannon" a rule where it spawns the blue ball if the attribute Ball Color is 1, and it would shoot a Red ball if the Ball Color is 2, both of those rules are followed with a Change Attribute Ball Color to Random (1,2).
Sometimes my "cannon" shoots two balls, sometimes just one. But there really is no consistency. Any ideas? (I did try to change Ball Color attribute to an index and that did not help).
Comments
Email me and I can send you a template you can look at. gingerbgames (at) gmail (dot) com.
Upload it to photobucket or tinypic or something, then just paste the HTML into the textbox, they read them naturally so it's no problem.
I've used the random function myself, and I've never had anything "double" appear, which is why I want to take a look at how you're doing it.
http://s1210.photobucket.com/albums/cc402/DrGlickert/Brubble Breaker Help/
I have an Attribute called "Ball Color" that is an integer. This code is on the rectangle shaped actor (that represents a cannon). Thanks Okysho (and, everyone else).
The way I would have done this is actually make the spawner into one rule. something more like...
please excuse my pseudocode if it's somewhat illegible I'll try to explain it better if you can't
if ( mouse button is down)
{
generate number
// (within the same rule, create a new rule)
if (generated number = 1)
{
spawn blue balls
}
otherwise
if (generated number = 2)
{
spawn red ball}
After that I'd create a separate rule to show the player what the next ball is. (you might want to create separate actors for the "next" display)
It might look something like this:
if(generated number = 1)
{spawn actor "display_blue"
destroy actor}
otherwise {display red}
The key here is treating the "next" ball and the "current" as separate entities.
If this doesn't help, let me know and I'll take another look at it, I might be misinterperating your code
That's it man! That's working for me. That literally took me 6 hours today to try and figure out! Thanks for your help. If I have problems with the "display balls" i'll start a new thread!
Thanks again!