Making score rules

Here's my question: I want to add a rule that says if a certain color is active, the player gains points, if they presses the wrong color then the points the player obtains, get subtracted by any number. How would I go about it?

Best Answers

  • tintrantintran Posts: 453
    Accepted Answer

    Not sure what you mean by a certain color is active. I can only guess that you mean when the player press on an actor and it's a certain color then you get points?
    so you can do a rule (for example if green is greater than 50%) in your actor that says

    if all these conditions are happening
    touch is pressed
    do
    -- if all these conditions are happening
    -- if self.color.green > 0.5
    --do
    ----change attribute game.score to (game.score+1)
    --else
    ----change attribute game.score to (game.score-1)

    the above is only an example of what you might do. maybe you'll subtract or add score using (self.color.green * constant) instead of 1.

  • tintrantintran Posts: 453
    edited August 2015 Accepted Answer

    by "character" you mean "word" so that they can gain points if right or wrong color is on the screen?
    Like if the screen is green, you will randomly show "blue" "yellow" "green" and if they click on "green" they gain points? is that what you mean?
    If that's the case maybe you can set a game attribute when you change your screen color like if your screen is "green" set a game attribute to 1 or "green" or anything that represents "green" and call it screen_color for example.
    Then add an actor attribute to represent its color word, like 1 for green, 2 for blue and so on and call it actor_color or something ...
    then when user clicks on your actor.
    just check to see if the actor attribute (self.actor_color is/equal to game.screen_color) and add/subtract points based on that .

Answers

  • Professor CaineProfessor Caine Member, PRO Posts: 15

    My apologizes. Let's say if the words was an independent actor, that rapidly appears on screen every 10 seconds or so, then you configure each character so that they can gain points or lose points if the right or wrong color is on the screen, how can that be accomplished. I've tried to make each word appear at a certain time in a loop manner, but when I made the corrseponding rules to match each word, no results came up.

Sign In or Register to comment.