customblockanim.lua - Cause we got no block.txt at the moment

Share and discuss custom LunaLua code and content packs for SMBX2.

Moderator: Userbase Moderators

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9865
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

customblockanim.lua - Cause we got no block.txt at the moment

Postby Emral » Sun Apr 21, 2019 8:27 am

This script lets you customize blocks kinda like you would customise NPCs, BGOs and effects in txt files. Definitely not basegame-worthy, but it should take care of wanting animating blocks of certain sizes.

Download:
https://pastebin.com/cDPxepWG

Example:
Spoiler: show
Image
Docs (also in the file):

Code: Select all

-- customblockanim.register is the only thing you can call in this library. It takes an ID and several optional arguments and will transform all blocks of the specified ID into what you set them to be. It will adjust width and height or all blocks of the ID to image.width and image.height/frames automatically.
customblockanim.register(id, {
	frames = #, --default 4
	framespeed = #, --default 8
	opacity = #, --default 1
	priority = #, --default -65
	img = imageresource, --defaults to standard image of the block id, will make block automatically invisible if left unchanged
})

Eri7
Banned
Posts: 1770
Joined: Sat Jan 28, 2017 4:48 pm
Flair: Good Foundation allows for strong Execution
Contact:

Re: customblockanim.lua - Cause we got no block.txt at the moment

Postby Eri7 » Sun Apr 21, 2019 8:32 am

This is cool, it will be surely useful for the project i am helping out with.

Hoeloe
Phanto
Phanto
Posts: 1465
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: customblockanim.lua - Cause we got no block.txt at the moment

Postby Hoeloe » Tue Apr 23, 2019 10:30 am

Why exactly is this drawing the blocks manually? That has a bunch of limitations (such as blocking access to Graphics.sprites). Why doesn't it use the block animation memory locations like the animated blocks in basegame do? (With the exception of the TNT block, which does need to draw itself manually in order to use per-instance animation).


Return to “LunaLua”

Who is online

Users browsing this forum: gio_zen and 3 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari