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

Share and discuss custom LunaLua code and content packs for SMBX2.
Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8733
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

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

Postby Enjl » 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
})
Ideas are useless if you can't make them real.
Image

User avatar
Eri7
Banned
Posts: 1772
Joined: Sat Jan 28, 2017 4:48 pm
Flair: Good Foundation allows for strong Execution
Current Project: Producer of the Novaverse
Chat Username: Eri7
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.

User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1236
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Current Project: A2XT Episode 2

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: No registered users and 2 guests