Is between range

Hi Gang,

How do you set an is between range?


  1. Player clicks button
  2. var RESULT = Random(30)

So I’m trying to work out in gdevelop5
If RESULT = range (1, 10) = something
If RESULT = range (11,20 ) = something other
If RESULT = range (21, 30) = something else

Hope this makes sense.

You can’t do one take, it has to be 2 separated conditions

Thanks Reborn. Sorry about the delay in responding.

Not sure why this is not working. var=Target, which is rand num. Player creates the Result num. if result > target then THUMB UP
if result < target then THUMP DOWN.

Any ideas?

Can you show where you are changing the variable “result”? Also what is the value of Targ?

I thought it might because of using both ≥ and ≤. Is it possible for the Result to be the same number as varTarget? For example if they were both 3.Then both 3 ≥ 3 and 3 ≤ 3 would be true? So changing one of them to > or < avoids the conflict?

I generate a RandomRange in a textbox = ‘Target’.
I generate ‘result’ when player clicks objects
Then, if Button is clicked… it should display :slight_smile:

I created two separate images for the thumbs, just to test.

The premise of the game is…

  • The computer generates a random number ‘Target’ at the beginning. which is hidden to the player.
  • Player clicks of objects, each object has a number-value. This adds to the ‘Result’ var.
  • when player is finished, they click BUTTON… which checks if result is < or > the ‘Targ’ and displays a thumb up or thumb down img.

Reborn told you half of the story
1st you need ONE event with TWO conditions where one condition checks if number is above some value and 2nd condition which checks if number is below some value
This check in between some values

So if yes you create thumb up

Now 2nd event again with two conditions
But now you check if it is below and if it is above

So example for all of this

Value is equal or greater than 5
Value is equal or less than 20
Action give thumb up

Another event
Value is less than 5
Action create thumb down

And third last event
Value is greater than 20
Action create thumb down

And you are set

In your project, it’s setting a random number to an object variable but then it’s checking a scene variable not the object.

1 Like

Ye was about to say that