Can you make a powerup hurt you?

Post here for help and support regarding LunaLua and SMBX2's libraries and features.

Moderator: Userbase Moderators

UbuntuJackson
Buster Beetle
Buster Beetle
Posts: 84
Joined: Sat Aug 05, 2017 4:43 am

Can you make a powerup hurt you?

Postby UbuntuJackson » Tue Oct 19, 2021 7:48 am

Hello, I had this level idea about a forest with tanooki leaves falling from the sky. I imagined there being red leaves that hurt you, brown leaves that do nothing, and green leaves that gives you it's normal powers. I just don't know how to go about making this. Has anyone tried making something similar to this? I know I could just make an enemy look like the leaf, but then I would still not have the falling animation.
(I am not sure if this is the right place to ask this, tell me if I am doing something wrong.)

deice
Volcano Lotus
Volcano Lotus
Posts: 596
Joined: Fri Jul 23, 2021 7:35 am

Re: Can you make a powerup hurt you?

Postby deice » Wed Oct 20, 2021 7:39 am

the basic idea is quite simple to implement. it simply entails creating a custom npc that hurts you and then (i assume to mimic powerup behavior) also kills itself when it does so. the main problem here is implementing the tanooki leaf movement. since it's a legacy NPC, there's no ready-made lua script with it's AI, but luckily since the SMBX source code is now public, it's possible to simply view exactly how it's physics work and attempt to recreate it based on that.

alternatively, you could just make it so that leaves are by default invisible and draw over the ones you actually want to be visible with the normal sprite, then have an (effectively) invisible, friendly tanooki leaf that you manually set never to despawn (field despawnTimer) and just have your custom NPC follow it's movements with a specifed positional offset based on it's initial spawn point.

i'm aware that both of these solutions seem a bit daunting, but they're the only ones that come to mind for me. someone else might have a better idea.

Marioman2007
2025 Egg Hunter
2025 Egg Hunter
Posts: 529
Joined: Tue Aug 25, 2020 3:19 am
Flair: Dr. Bones
Pronouns: He/Him

Re: Can you make a powerup hurt you?

Postby Marioman2007 » Wed Oct 20, 2021 7:46 am

Well, the problem was solved on the codehaus discord.
Just letting the people know.


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari