GameMaker: Studio

GameMaker: Studio

View Stats:
zeRqs Oct 31, 2014 @ 2:41pm
auto tile a room with grass
Hi, i got a huge room i want to tile with grass as i am making a forest level..
im trying to make a script to do that for me , i played around with tile_add and some for loops without mutch sucsess, i managed to tile from pos 0.0 and 0/32 0/64 etc and the same on Y axis bit not fill the room. coud someone point me in the right direction?
< >
Showing 1-6 of 6 comments
Daynar Oct 31, 2014 @ 2:48pm 
Originally posted by Zerqs:
Hi, i got a huge room i want to tile with grass as i am making a forest level..
im trying to make a script to do that for me , i played around with tile_add and some for loops without mutch sucsess, i managed to tile from pos 0.0 and 0/32 0/64 etc and the same on Y axis bit not fill the room. coud someone point me in the right direction?
for(var i = 0; i < room_height/32; i++)
{
for(var ii = 0; ii <room_width/32; ii++)
{
tile_add(background, left, top, width, height, ii*32, i*32, depth);
}
}
I think this will work.
Last edited by Daynar; Oct 31, 2014 @ 2:48pm
zeRqs Oct 31, 2014 @ 2:49pm 
so simple , so brilliant! why didnt i think about nesting the loops! -_- tnx again Daynar!
zeRqs Oct 31, 2014 @ 2:53pm 
it works but uses ALOT of CPU :D
zeRqs Oct 31, 2014 @ 2:54pm 
is there a way i can make the tiles stick in my room after i game quit? :P
Daynar Oct 31, 2014 @ 3:18pm 
Not if you set everything up in code. However, you can do something else. Go to the room and open the backgrounds tab. Maker sure visible when room starts is checked and then choose the grass tile as the background. It should automaticly tile itself to fill the room. This will probably work if all you want to do is fill the room with the repeating grass tile.
zeRqs Oct 31, 2014 @ 3:21pm 
thats a solution aswell, but i got the script working. silly rookie mistake -_-
< >
Showing 1-6 of 6 comments
Per page: 1530 50

Date Posted: Oct 31, 2014 @ 2:41pm
Posts: 6