Bubble Breaker Shooting Help

DrGlickertDrGlickert Member Posts: 1,135
edited November -1 in Working with GS (Mac)
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).

Comments

  • OkyshoOkysho Member Posts: 158
    That's an odd error, could you post images of your rules so I can get a better look? I'll do my best to help
  • DrGlickertDrGlickert Member Posts: 1,135
    Okysho - how do I take screen shots and post my images on here? I'm unfamiliar with that process. Thanks for your help.
  • GingerBGamesGingerBGames Member Posts: 390
    Hello Doc,

    Email me and I can send you a template you can look at. gingerbgames (at) gmail (dot) com.
  • DrGlickertDrGlickert Member Posts: 1,135
    Just shot you an email Ginger. Thank you!! (Might have to check spam mail just incase).
  • OkyshoOkysho Member Posts: 158
    Take an area screenshot by holding command, shift, 4 then dragging an area on your screen.
    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.
  • DrGlickertDrGlickert Member Posts: 1,135
    Sweet. Got it uploaded.

    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).
  • OkyshoOkysho Member Posts: 158
    I think I see your problem. You're treating the two cases separately.
    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
  • DrGlickertDrGlickert Member Posts: 1,135
    Okysho -

    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!
  • DrGlickertDrGlickert Member Posts: 1,135
    Wait. Hold the phone. Now I can't figure out how to display the "next ball." And, more importantly, I can't figure out how to make the next ball display, be the actual ball that's fired...
Sign In or Register to comment.