Edited by Aero88, 03 May 2012 - 03:22 PM.
Animating Tiles
#1
Posted 30 April 2012 - 04:58 PM
#2
Posted 30 April 2012 - 05:13 PM
Hi, I am using GM 8.1 Pro and I am interested in making efforts to increase the efficiency of my programming. Currently I have been using objects when I needed tiles that are animated, but I am now wondering if it is possible to animate tiles themselves in GM rather than using separate objects for each type of animated tile. Any help is appreciated. Thanks for your time.
Don't use a separate object for each tile! That's very inefficient in terms of processing speed and memory usage.
I don't think there is a way to create animated tiles since tiles are used to draw a static image that requires no processing whatsoever. They are used to save processing speed when all you want are static images on the ground. However, you can use sprites to draw animated images. Draw them all in the draw event of 1 object.
Make sure you draw the ones that are actually visible on the screen. Don't draw sprites that are far off the screen since it would slow down the game.
#3
Posted 30 April 2012 - 06:20 PM
#4
Posted 30 April 2012 - 09:24 PM
The GameMaker Language (GML) > Game graphics > Tiles
There are actually quite a few possibilities with those functions.
#5
Posted 30 April 2012 - 10:47 PM
#6
Posted 30 April 2012 - 10:59 PM
#7
Posted 30 April 2012 - 11:45 PM
#8
Posted 02 May 2012 - 01:27 AM
Here is an example I whipped up
http://www.freefilehosting.net/tileanimationexample
Thanks. I am not at my home computer at the moment so I can't download it just yet, but I will take a look at this as soon as I can.
@TheouAegis - I'll look into those functions as well thanks you your suggestions.
#9
Posted 03 May 2012 - 03:21 PM
#10
Posted 24 September 2012 - 03:13 AM
#11
Posted 24 September 2012 - 10:18 AM
This is the code that animates the tile
tile_x = (tile_x+0.3) mod animate_length; //this loops the animation (look up Smart Codes in the GMC)
tile_set_region(my_tile,floor(tile_x)*tile_w,tile_y*tile_h,tile_w,tile_h); //this moves the tile origin
If you comment out the code for making the character walk, and paste the above in the code block, the tile will animate.
Edited by C_Pike, 24 September 2012 - 10:24 AM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











