GameMaker Studio 2 D&D blocks - Get Random Number

Subscribers:
499
Published on ● Video Link: https://www.youtube.com/watch?v=ND56yD04g08



Duration: 13:50
671 views
10


In this video we are learning how and when to use Game Maker Studio 2 Drag and Drop Block which is called:
Get Random Number

This block is part of the Random group of blocks.
It is in the first row, first from the left, with "Get a random inclusive number." description on it.
As always you just need to drag and drop it to start using it.
We are going to add it to Create Event, because we need it to be defined only once per game, at it's start.
If we add it to Step Event instead, it will keep creating random numbers 30 times per second, endlessly, and we don't want that.

We add this block to the obj_coin Object, Create Event, and then we see that this block has couple of option fields:
Type - the type of the number, Decimal or Integer
Minimum - the minimum value of the number we want to generate (for six sided dice it will be 1)
Maximum - the maximum value of the number we want to generate (for six sided dice it will be 6)
Target - target variable in which we will put the generated random number into, so we can call it from other Block, Event or Object
Temp - ...

3:05 - adding the Get Random Number block into Create Event
4:36 - creating Target variable for random generated number
6:34 - connecting and using variable from Create Event Random Number generator in Draw Event Draw Value block