How do you change the size of effects?

Need help with any SMBX game-related issues? Ask your questions here.
Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on-topic/appropriate?
-Are you posting in the right forum/following the forum rules?
User avatar
Dr Vivian
Swooper
Swooper
Posts: 117
Joined: Tue Oct 18, 2016 7:53 am
Current Project: Kelp World 2

How do you change the size of effects?

Postby Dr Vivian » Tue Nov 15, 2016 7:52 am

Using custom graphics, and it's pretty easy to change the size of the original NPC either by creating a notepad or using the npc configuration from the editor (SMBX2.0 beta / PGE editor), but changing effects, like the enemy's "death animation", I just can't get it to change size. So I end up with some garbled fraction of my sprite. This even happens with custom character graphics, and my effect for my character is 100x100 and it still messes up. I couldn't find how to do this anywhere.

Thanks in advance, sorry if this is already answered somewhere.
Image

User avatar
PixelPest
Link
Link
Posts: 7118
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: How do you change the size of effects?

Postby PixelPest » Tue Nov 15, 2016 8:17 am

For effects, make a lunadll.lua file for a level or a lunaworld.lua file for an episode. Put the following in it:

Code: Select all

function onTick()
    for _, v in pairs(Animation.get(#)) do
        v.width = #;
        v.height = #;
    end
end 
Replace the first number symbol with the animation ID, the second with the new width, and the third with the new height. You can remove either of the latter two lines I referenced if you only need to change one dimension

User avatar
Imaynotbehere4long
Kamikaze Koopa
Kamikaze Koopa
Posts: 1389
Joined: Thu Jan 23, 2014 3:00 pm
Current Project: Chaotic Culmination: Universe Rescuer

Re: How do you change the size of effects?

Postby Imaynotbehere4long » Tue Nov 15, 2016 7:58 pm

Alternately, you could make the effect sprites invisible and use a combination of layers and friendly sprite-swaps to simulate larger (and even animated) effects. Just be aware that this won't work for generated enemies since each layer can only spawn once.
I've decided to cancel SMBXville Under Seige. After my 1st Senior year of college, I realized I wouldn't have enough time to devote to finishing my four-level episode. Apologies to those who cared.
My favorite quote on the entire forum:
Spoiler: show
mechamind wrote:
AeroMatter wrote:People who think "autistic" is an adjective and not a verb.
You autistic some people so much with that statement.
My SMBX portfolio:
Spoiler: show
Image
(includes a Sonic 3D Blast styled level.)
SOMEONE ANSWER MY CRY FOR HELP: http://www.supermariobrosx.org/forums/v ... =69&t=2026

User avatar
Dr Vivian
Swooper
Swooper
Posts: 117
Joined: Tue Oct 18, 2016 7:53 am
Current Project: Kelp World 2

Re: How do you change the size of effects?

Postby Dr Vivian » Wed Nov 16, 2016 6:56 am

PixelPest wrote:For effects, make a lunadll.lua file for a level or a lunaworld.lua file for an episode. Put the following in it:

Code: Select all

function onTick()
    for _, v in pairs(Animation.get(#)) do
        v.width = #;
        v.height = #;
    end
end 
Replace the first number symbol with the animation ID, the second with the new width, and the third with the new height. You can remove either of the latter two lines I referenced if you only need to change one dimension
So if I do this for multiple effects, do I use another instance of that code for each one in the same file? Also, does this work with characters? I want my custom costumes to have proper "death effects" too. But how does that work with multiple costumes?
Imaynotbehere4long wrote:Alternately, you could make the effect sprites invisible and use a combination of layers and friendly sprite-swaps to simulate larger (and even animated) effects. Just be aware that this won't work for generated enemies since each layer can only spawn once.
Is that the only way to have animated effects?
Anyway, that method could also be used to have "transforming" enemies, couldn't it?
Image

User avatar
PixelPest
Link
Link
Posts: 7118
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: How do you change the size of effects?

Postby PixelPest » Wed Nov 16, 2016 7:10 am

You can repeat that code for each effect, just change the letter each time (v --> w, w --> x, etc.). If you want to make multiple effects the same dimensions too, don't just replicate that loop over and over. Instead, replace the first number symbol with a table of your animation IDs. (For example, if you all wanted IDs 1, 3, and 5 to be the same, you would replace the first number symbol with {1, 3, 5}.) It'll work for character effects too. However, if you're making it a costume and physically put it in the costumes folder (not just the custom graphics folder for your level), you need to put this text in a costume.lua file, which means that you have to use API format. Take a look at some of the costumes that have these files and see if you can figure it out for yourself

User avatar
Imaynotbehere4long
Kamikaze Koopa
Kamikaze Koopa
Posts: 1389
Joined: Thu Jan 23, 2014 3:00 pm
Current Project: Chaotic Culmination: Universe Rescuer

Re: How do you change the size of effects?

Postby Imaynotbehere4long » Wed Nov 16, 2016 9:08 pm

Dr Vivian wrote:I want my custom costumes to have proper "death effects" too. But how does that work with multiple costumes?
Death effect sprite-swaps for player characters should stretch automatically; no lua needed. In fact, death effects for enemies not killed by stomping should also stretch automatically.
Dr Vivian wrote:Is that the only way to have animated effects?
It's the only way in 1.3. I'm sure there's another way to do it if you use lua.
Dr Vivian wrote:Anyway, that method could also be used to have "transforming" enemies, couldn't it?
Yes; just be careful not to make the secondary NPC's hitbox too large since that could lead to it hitting the player unfairly or clipping through blocks if you're not careful.
I've decided to cancel SMBXville Under Seige. After my 1st Senior year of college, I realized I wouldn't have enough time to devote to finishing my four-level episode. Apologies to those who cared.
My favorite quote on the entire forum:
Spoiler: show
mechamind wrote:
AeroMatter wrote:People who think "autistic" is an adjective and not a verb.
You autistic some people so much with that statement.
My SMBX portfolio:
Spoiler: show
Image
(includes a Sonic 3D Blast styled level.)
SOMEONE ANSWER MY CRY FOR HELP: http://www.supermariobrosx.org/forums/v ... =69&t=2026

User avatar
Dr Vivian
Swooper
Swooper
Posts: 117
Joined: Tue Oct 18, 2016 7:53 am
Current Project: Kelp World 2

Re: How do you change the size of effects?

Postby Dr Vivian » Fri Nov 18, 2016 8:06 am

Thanks for the help, I've got it working now! Maybe I'll upload some of my "custom" graphics finally.

I'm using 2.0 beta, maybe I should have specified that?
Image

User avatar
MisterZygarde64
Spiny
Spiny
Posts: 43
Joined: Wed Jun 08, 2016 9:43 pm

Re: How do you change the size of effects?

Postby MisterZygarde64 » Thu Jul 11, 2019 10:23 pm

PixelPest wrote:
Wed Nov 16, 2016 7:10 am
You can repeat that code for each effect, just change the letter each time (v --> w, w --> x, etc.). If you want to make multiple effects the same dimensions too, don't just replicate that loop over and over. Instead, replace the first number symbol with a table of your animation IDs. (For example, if you all wanted IDs 1, 3, and 5 to be the same, you would replace the first number symbol with {1, 3, 5}.) It'll work for character effects too. However, if you're making it a costume and physically put it in the costumes folder (not just the custom graphics folder for your level), you need to put this text in a costume.lua file, which means that you have to use API format. Take a look at some of the costumes that have these files and see if you can figure it out for yourself
Would you mind providing an example? I get warning of an overwritten handler for 'onTick'

User avatar
Cedur
Blue Yoshi Egg
Blue Yoshi Egg
Posts: 4831
Joined: Tue Jun 28, 2016 10:14 am
Flair: Save climate, cut fridays for whole-week future
Current Project: various playthroughs and tests

Re: How do you change the size of effects?

Postby Cedur » Fri Jul 12, 2019 5:54 am

MrZygarde64 wrote:Would you mind providing an example? I get warning of an overwritten handler for 'onTick'

He's gone from the forums. Check before responding to very old posts. You can still contact him at the Codehaus server (see the SMBX2 homepage --> "join us on Discord")
Image

Supports: show
Image
Image
Image
Image

Image

Still using the legacy editor? Get SMBX2 and PGE, it will improve your experience significantly. Here's why.

iphtechnologies wrote: NEO super mario world x is a really nice game. This Episode is 2,7 GB large at the moment.That`s crazy!
Please find similar post:
[ads]

If you're not smart enough to plan ahead, then DOOM ON YOU!


Return to “Help and Support”

Who is online

Users browsing this forum: No registered users and 1 guest