Issues with Touch
Hello, All,
In my game, you hit a colored square that takes up 1/4 of the screen. This gives you 10 points and then the game randomly selects a new position for the square which you hit again.
If you hit the background instead of the square, you lose 10 points.
My issue is that once the square or background are touched one time, it gives the player +10 or -10 points initially; after this, the score never goes up past 10 or down past -10.
The rules I currently have up are:
When Touch is Pressed, change attribute game.Score to +10. (colored square)
When Touch is Pressed, change attribute game.Score to -10. (background)
Is there something wrong with the rules I'm using? I'm thinking the issue is that the game is reading it as "once Touch is pressed, change the score and leave it so"--how might I go about fixing this?
Thanks much!
Comments
you need to set your rules up like this:
When touch is pressed, change attribute game.score to game.score +10
That will take the current score and add 10, right now you are setting the score to equal 10.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Hi, Jamie_C,
I've tried that solution before and found that it didn't make a difference; the score still won't go above 10. I'm thinking that there must be like...a switch or something that I can't find to make the game register the Touch as a temporary action and not as a permanent change.
Thanks!
(Unless I'm just inputting it wrong-- I put it in as
Change attribute game.Score to game.Score + 10--is this okay? Thanks!)
If its not incrementing, double check your behaviors to make sure you didnt leave a stray bit of code from the original method in, because that should definitely work.
Don't type the words "game.Score" choose them from the list in the expression editor.
Like @Tosanu says, that should work as expected unless there is something else messing it up somewhere in your behaviors.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page