Awkward Game Mechanic

Bolt2Bolt2 Member Posts: 41
edited April 2012 in Working with GS (Mac)
Greetings GS forum!

I've got another question for you today as my dependence on you is growing ten fold. I love you guys...

Anywho, my game is simple:

-Coloured Square indicates what colour blocks you need to target.
-Coloured Blocks fall from the top of the Scene to the bottom.
-If the Coloured Square is green, you must click only the Green Blocks to gain points.
-If the Coloured Square is green and you miss a Green Block then you lose a life.
-If the Coloured Square is green and you click on a Blue Block, you lose points.

The premise is simple.

However:

-The Coloured Square changes to a random colour after X amount of seconds.

So my issue is this:

-Coloured Square is Green.
-Blue Block is on Scene.
-Coloured Square turns Blue.
-Blue Block is missed and player loses a life.


What would I have to add to my rules in order to stop a Blue Block taking away a Life if the coloured square has ONLY JUST changed to Blue?


Any suggestions? Please ask if it needs to be clearer. Took me a while to write this question and understand it myself...

Thanks

-Blackmill

Best Answer

  • scitunesscitunes Posts: 4,047
    Accepted Answer
    Here's what I would do. I would wrap your color change rules in something like this:

    When self.positionY is greater than 100 (or whatever you want)
    And when game.ChangeColorNow is true
    -----change attribute self.BlockColor to random(1,10)

    this will make it so that it will ignore the color change command when it is below 100. If it is above 100 its color will change to a random color.

Answers

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Create an integer game attribute called game.color. Then on a scrap of paper or your hand, or even in a text document keep track of which integer value = which color.

    So lets say 0 = green and 1 = blue.

    When the color changes to blue you will also change game.color to 1

    Then in the blocks an integer attribute called self.color
    Then have this rule in the block "when self.color = game.color" AND self.positionY is < -(self. height/2)
    Change self.dead to 1 (you'll need to create this boolean)

    Then,
    When self.dead is true do blah blah blah
  • Bolt2Bolt2 Member Posts: 41
    Thanks for the fast response.

    I'll give it a look over, but not entirely sure what you mean.

    I assume you mean

    -Take a life off if the coloured block is missed and the same as the coloured square
    -AND if it is above a certain height?

    Thanks again

    -Blackmill
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Basically what you are doing is you are comparing the color of each block to the colored square. By assigning an integer to each color and being consistent about this (using same color/number pairs for both the game.color and self.color) you can compare the color of each block to the color of the square mathematically. In other words you can check if game.color is the same color as self.color for each block with a rule that checks "when self.color=game.color".

    Then you can put rules within that rule. Like this:

    RULE - "When self.color=game.color" (This will be fore a correct tap)
    ------Rule - "When touch is pressed"
    ------change game.points to game.points + 10
    ------destroy

    ------Rule - "self.position is less than 0" (This checks if it has fallen off the bottom of the screen)
    ------Change game.points to game.points - 10
    ------Play sound wah, wah, waaaaaa
    ------destroy

    OTHERWISE (of very first rule - the one with self.color = game.color) (this will contain all of the stuff for when the colors are not the same)
    ------Rule - if touch is pressed
    ------change game.points to game.points - 10
    ------Play sound wah, wah, waaaaaa
    ------Destroy

    I would also do this in the block prototype (before the rule set above)
    change self.BlockColor (integer) to random(1,10) (change the ten to the number of colors you have)
    Then you can have a rule that says when self.BlockColor = 1
    -----change attribute x3 (change the 3 RGB values) or change to a new image if you want

    when self.BlockColor=2
    -----change attribute x3 (change the 3 RGB values) or change to a new image if you want

    etc.
  • Bolt2Bolt2 Member Posts: 41
    edited April 2012
    @scitunes - All of the above you've stated, I have done.

    My issue is that a player loses a life within seconds of the Coloured Square changing it's colour as a Coloured Block, of said colour, is already on the scene and is to far down to TAP before it goes off screen.

    -If I added a timer to state 'Wait 0.1 seconds after Coloured Square changes to minus a life' as by that time any Actors near the bottom of the screen would have been deleted... Could that work?

    It's hard to put into words, but if you refer to my first post it explains it better.

    -Blackmill
Sign In or Register to comment.