Set Direction Random - GameMaker GML Visual

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



Duration: 11:14
4 views
0


In this video we are learning how and when to use Game Maker Studio 2 GML Visual Block which is called:
Set Direction Random

This block is part of the "Movement" group of drag and drop blocks.
It is used when you want to move some Object by specific speed in random direction.

It has eight (8) possible directions to pick from, all represented with arrows.
Click on the arrow you want - to select direction you want your Object to be able to pick randomly.
You can pick as many as you want, only one specific, up to all eight.
If no arrows are selected, your Object will use your default Direction, if you defined any Direction earlier or later in the game.

Don't forget to add some kind of speed to your Object, Direction only is not enough !
Direction is needed to define where do you want your Object to point and move - in which direction.
But to put it into motion you need to add some force on it, some speed to be precise.
So add "Set Speed" drag and drop block below "Set Direction Random".
Choose "Direction" from Type drop down menu, type some value in Speed field and that's it.

As always, be careful where and when you put this block in your code.
You will mostly add it to Create Event, but you can also change it later or put it into some If/Else condition statement.

You can use this block to:
- make enemies move in random directions
- weapon shoot bullets in random directions
- spawn collectables in random directions

#gamemaker #gamemakerstudio #gamemakerstudio2
#gamedev #gamedevelopment #gamedeveloper #gamedevelopmenttutorial
#gameengine #tutorial #nocoding #coding







Tags:
GML Visual Set Direction Random
Set Direction Random
GameMaker GML Visual
GML Visual
GameMaker GML Visual Blocks
GML Visual Blocks
GameMaker
GameMaker Studio
GameMaker Drag & Drop
GameMaker Studio D&D
Knowledge For All
K4A