From e21d0cf8238aedcd4320e6e5f73fd97c640f704f Mon Sep 17 00:00:00 2001 From: taxicomics <168220579+taxicomics@users.noreply.github.com> Date: Mon, 27 May 2024 16:03:52 +0200 Subject: [PATCH] Create draw_animated_sprite.lua --- lua_scripts/draw_animated_sprite.lua | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 lua_scripts/draw_animated_sprite.lua diff --git a/lua_scripts/draw_animated_sprite.lua b/lua_scripts/draw_animated_sprite.lua new file mode 100644 index 0000000..8491aee --- /dev/null +++ b/lua_scripts/draw_animated_sprite.lua @@ -0,0 +1,8 @@ +--Draw sprite N at the position X/Y with NFRAMES number of frames at a certain SPEED and maybe FLIP it. +--flip, speed and even Nframes are optional if the animation has just two frames. + +function spr_anim(n,x,y,nframes,speed,flip_x,flip_y) + local speed=speed or 1 + local nframes=nframes or 2 + spr(n+(time()*speed)%nframes,x,y,1,1,flip_x,flip_y) +end