Icon

Random Functions

Jamie Ford

You must be logged in to obtain assets

Description

4 scripts that can help in almost any game. I found that having some simple functions like these made using random() way easier.

They are quite simple to use but just in case, here are some examples:

Create an enemy every 2 seconds, give or take a bit.

// in step event
if random_seconds(2){
    instance_create(x,y,enemy_obj);
}

10 percent chance of dropping a power up object

if random_percent(10){
    //drop power-up
    instance_create(x,y,powerup_obj);
}

Get a random name of the ai player

var ai_name = random_name();

target and destroy 1 random enemy

target_enemy = random_instance(enemy_obj);
with target_enemy{instance_destroy();}

If you have any ideas for more random functions that i could add to this pack, please post it on the forum here: http://gmc.yoyogames.com/index.php?showtopic=635513

End User Licence Agreement (EULA).

Age Rating: 4+

Version

GMS1 - Version 1.0.0. Published August 25, 2014

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait