Yesterday i posted a topic concerning a splitscreen formula, today i release another script, let me know what you think.
//This is a random object generating script for GML.
//Script by Ethan Behan, credit would be appreciated.
//create event (setting the variables to avoid error):
generate=true
type=0
active=0
room_speed=1000 //so the process is sped up.
//step event:
if generate = true //overall decision for the object to start generating!
{
if place_free(x,y) and type=0 and active=0 //this checks active and type is not equal to 1 so it does not generate multiple objects in a single place.
{
active=1
}
}
//object generator, the higher the real numerical random number the less chance there will be an object of choice, type 0 must always be free.
if active=1 and type=0
{
active=0
type=irandom(3)
if type=1{type=0;instance_create(x,y,objWall)}
if type=2{type=0;instance_create(x,y,objwater)}
if type=3{type=0;}
}
//movement,moving by a 16,16 grid.
if place_free(x+16,y+0) and generate=true
{
x+=16
}
//destroys once the object is out of the room.
if y > room_height
{
instance_destroy()
}}
//Outside Event: //this is used to scroll down the room
y+=16
x=0
type=0
active=0
//Destroy Event:
room_speed=30 //this is the normal room speed.
//Sript produced by Ethan Behan.