Log In  

Hi all, new here. I'm wondering if someone can point me in the direction of best practices to animating
a multi tile character sprite: Do you use a function with multiple calls to spr() and a timer or pack a table etc.

thanks.

P#57522 2018-10-04 22:04 ( Edited 2018-10-05 04:30)

When you call spr(), the two arguments after the x and y coordinate are how many sprites wide and tall to use when drawing the sprite. So, for example, if the top-left of your sprite starts at Sprite #001 and is two sprites wide and tall, you would use spr(1,30,30,2,2) and that would place the whole 16px by 16px sprite at 30,30 on the screen.

P#57524 2018-10-05 00:28 ( Edited 2018-10-05 04:28)

For animating, you can use this method:

https://mboffin.itch.io/simple-animation

This method works fine for multi-tile sprites. You just use the extra arguments for width and height when you call spr() and make sure the table of sprites is filled with the top-left corner sprite numbers.

P#57525 2018-10-05 00:30 ( Edited 2018-10-05 04:30)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-19 13:38:48 | 0.007s | Q:12