Comparing random numbers

Hello, please help a newbie.

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.

Please help!

Many thanks to the developers of GDevelop!

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.

He meant: or greater, or equal or lower. 3 conditions.

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.

There are 3 number that the player can collide with. He wants generate a number and the player have to collide with the correct number.

Have a look to see if is this you are trying to do.

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.

Many thanks

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 :arrow_right: 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.

You are totally correct! I seem not to know how to tackle the conditions and events.

then you are ok now?

No I am not…I need help with running the event in a more detailed manner.

If you can, please. I am going back to read the wiki on variables again

can you upload some screenshots from what you have got so far?

Have you checked the file I uploaded?

Hello Zutty, I am unable to open file. What format is it?

Something went wrong. Now it works.

Zutty, what type of app or program is used to open this file. i have tried to use Gdevelop to but no success.

Many thanks.

Create a folder and extract the files into that, so you can open the file “game.json” in gdevelop.

You need “win.rar” to extract them.

Thanks Zutty…it did the magic!

I cannot thank you enough…It works like I would like the game structure to be. Let me alter mine and share any feedback. You all ROCK!