Useful Code Groups

The code templates here are the ones that may be needed anytime, so they are useful! Most of them will be written by me, if not I will put references.


Filling A Room With Same Type Of Object

This code fill the whole room with a single type of object, just as water or land for a game map.

fillwith = object0;  // change object0 into the name of the object you want to fill the room with

tilesize = 16;          //  input the size of your object's sprite here, this will be used as creation interval.
for (i=0;i<room_width/tilesize;i+=1)
{
for (j=0;j<room_height/tilesize;j+=1)
{
instance_create(i*tilesize,j*tilesize,fillwith);
}
}


No comments:

Post a Comment