Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Other - [AGK] Trim spacing from tile set images

Author
Message
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Mar 2014 02:15
A tileset image is an image made up of multiple square tiles as used for a tile-based game. With AppGameKit, you can load this single image and use the animation commands to break apart the tiles. But sometimes, these tilesets have spacing and margins around each tile in the image and AppGameKit has no way to account for this when building the animation frames. This is a convenience function to get around that without having to alter the image yourself with an image editor.

Specify the filename of the image to load, and the width and height of a tile. Margin is the area around the top and left of a tile. Spacing is the area on the bottom and right side of a tile. The function will rebuild the image without all the spacing and margin and return an image ID.



Login to post a reply

Server time is: 2024-03-28 08:53:21
Your offset time is: 2024-03-28 08:53:21