Jump to content


Photo

Save all tiles in the room as a background file


  • Please log in to reply
5 replies to this topic

#1 FruitPlusVeggies

FruitPlusVeggies

    GMC Member

  • New Member
  • 238 posts

Posted 29 June 2011 - 07:14 PM

Let's say I have a room and I have placed a bunch of tiles inside.
Is there a way I can make it so Game Maker takes all of these tiles in the room (just the tiles), and saves it into
a background.png file? The rest of the room being transparent in the background file of course.

And no, I don't mean manually printing the screen in the room editor and doing it in photoshop,
I want to know if there is a way I can do this all in GML.

Edited by FruitPlusVeggies, 29 June 2011 - 07:15 PM.

  • 0

#2 voltain

voltain

    V.C.G

  • GMC Member
  • 174 posts

Posted 29 June 2011 - 07:22 PM

Can you be more specific? Like how big is the room in question? While playing the game, will you be able to view the whole room or a portion of it? Will there be objects obscuring some tiles? And what exactly do you intend to use the saved file for? I'd just like to get a handle on this problem.
  • 0

#3 FruitPlusVeggies

FruitPlusVeggies

    GMC Member

  • New Member
  • 238 posts

Posted 29 June 2011 - 07:55 PM

I just want every tile that is placed in the room, to be some how saved into a background file.
Yes there most likely will be objects obscuring the tiles, however I can get them removed.
And no, the entire room sometimes will be bigger than the window itself.

I just want all the tiles to be put together, all tile layers, into one .PNG file.
  • 0

#4 voltain

voltain

    V.C.G

  • GMC Member
  • 174 posts

Posted 29 June 2011 - 08:14 PM

Okay I think I get what you're asking now.
You could try using the screenshot save part function -screen_save_part(fname,x,y,width,height)- although I think you would have to make sure there are no objects obscuring the tiles in the room first. You just enter zero for the x and y coordinates and have the width and height parameters correspond with that of the room's. I think that might work. I haven't used GM so I may be wrong.

The only thing I would be careful of (assuming this function works the way I think it does) is to make sure that the room isn't too big.

EDIT: If you need more help just ask!

Edited by voltain, 29 June 2011 - 08:17 PM.

  • 0

#5 YellowAfterlife

YellowAfterlife

    GMC Member

  • Global Moderators
  • 3490 posts
  • Version:GM:Studio

Posted 29 June 2011 - 08:17 PM

The most 'secure' way to do this is disable ALL object's visibility, setting draw target to a surface, and calling screen_redraw(). Game will draw all tiles into the surface nicely.
  • 0

#6 FruitPlusVeggies

FruitPlusVeggies

    GMC Member

  • New Member
  • 238 posts

Posted 29 June 2011 - 08:34 PM

What do you mean by "setting draw target to a surface" ? and then using screen_redraw()?
I've never used surfaces before and I'm a bit confused on how I would get that into a file.
screen_save_part() seems like my best option though, but can you explain what you mean about surfaces...?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users