I am making a game where i need to compare a random number against a variety of other random numbers. I would like the score variable to add 5 when a player collides with the random numbers that meet the condition that it is greater than or lesser than or equal to the RandomNoToTest (the major random number) and the score variable to reduce by 2 should the player mistakenly collide with the wrong random number. I am able to make the random numbers but can’t achieve the others.
The score variable I noticed adds up automatically at the beginning of the game, I think it because there is no action.
Its taking me 4 weeks to read through details similar to this on the forum but have not achieved it.
it isn’t any sense the " greater or equal or lower" condition. it will give true output all the times (when collision is hapens). you aren’t need any numbers (random or not) for this.
or I doesn’t understand what are you want.
nevermind. you always can compare the value of two variables. so store your random numbers in variables (in this chase I recommend object variables), and compare them in the condition, and do the action.
if the random number greater than a random number => give 5 score
if the random number equal than a random number => give 5 score
if the random number lower than a random number => give 5 score
?!
I think it doesn’t make sense either.
Hi, I meant a scene would test a condition of say only greater than. So I have three scenes that test either Greater than or less than or equal to. What I am looking for is how to compare in scene 1 say it tests for greater than…how to compare the Major Random Number which I call RandomNoToTest against other random numbers on the scene. If the player collides with any number which is greater than the RandomNoToTest, he earns a score of 5, otherwise a score of 2 for a wrong collision. The score aggregates till the end of the game.
it isn’t so complicated, but I dont know enough to an accurate solution.
I bet the player is a Sprite object. I think the “random nembers in the scene” are text objects. if they are, you need to store theirs generated random numbers in object instance variables. one for each number object. you need do it immediately after you created it, in the same line. its ok for now, you are done with the preparation of the objects.
now the event:
if player is in collision with text object and screen value “RandomNoToTest” is greater than text object stored random number variable than add 5 to global variable “score”.
if I was wrong, upload one screenshot from your game (not the events now) in action, and/or explain more.