Ball 'N' Chain NPC

Share and discuss custom LunaLua code and content packs for SMBX2.
Smibbix
Bit
Bit
Posts: 60
Joined: Fri Apr 06, 2018 10:47 pm

Ball 'N' Chain NPC

Postby Smibbix » Sun May 31, 2020 7:41 pm

So I've been learning how to use LunaLua, and now that I've gotten pretty okay (I think?) at it, I wanted to actually make and post something for other people to see. I noticed that, as far as I know, nobody has made an NPC of the ball and chain things from SMW. So I changed that!

This NPC is actually split into three different NPCs. One for the chain links, one for the spike ball, and one for the actual whole object.

I wanted to make these really useful, so I added some extra options for them in the editor. You can configure each Ball 'N' Chain's speed, its length, its direction, the angle it starts at, and how many spike balls there are. I also implemented it being able to be friendly, to not move, and to move with its layer.

Here's some gifs of the NPC in action:
Spoiler: show
Image
Image
Image
Image
If you just want to download the NPC, get it here:
Download

If you want a demonstration level for them also, see my level thread over here:
My Levels

edit: Oh yeah, and please give me credit if you use it in one of your projects

King Mario
Hoopster
Hoopster
Posts: 124
Joined: Sun Nov 19, 2017 2:13 pm
Flair: Jesus Christ is Lord!
Pronouns: he/him
Contact:

Re: Ball 'N' Chain NPC

Postby King Mario » Sun May 31, 2020 8:10 pm

Smibbix wrote: So I've been learning how to use LunaLua, and now that I've gotten pretty okay (I think?) at it, I wanted to actually make and post something for other people to see. I noticed that, as far as I know, nobody has made an NPC of the ball and chain things from SMW. So I changed that!

This NPC is actually split into three different NPCs. One for the chain links, one for the spike ball, and one for the actual whole object.

I wanted to make these really useful, so I added some extra options for them in the editor. You can configure each Ball 'N' Chain's speed, its length, its direction, the angle it starts at, and how many spike balls there are. I also implemented it being able to be friendly, to not move, and to move with its layer.

Here's some gifs of the NPC in action:
Spoiler: show
Image
Image
Image
Image
If you just want to download the NPC, get it here:
Download

If you want a demonstration level for them also, see my level thread over here:
My Levels

edit: Oh yeah, and please give me credit if you use it in one of your projects
Oh Wow! These are so amazing! Definitely using this, and I also credit you in advance. Thanks, dude!

TheTrueMarioMaster
Blooper
Blooper
Posts: 199
Joined: Mon Mar 19, 2018 11:58 pm

Re: Ball 'N' Chain NPC

Postby TheTrueMarioMaster » Mon Jun 01, 2020 12:07 am

This reminds me of 1AmPlayer's firebars with all the different options. Also to make a suggestion how about doing the Pendulum Ball N' Chain from SMWC since it is related.

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

Re: Ball 'N' Chain NPC

Postby Emral » Mon Jun 01, 2020 2:05 am

Looks awesome, keep it up!

After a quick look through the code, a few things I noticed that might be good to take in account for for the future:
- Having the ball permanently spawned might lead to some overhead in large sections, so it might be good to find an alternative. Orbits internally handles despawning as something that starts happening when all pieces of the orbit are offscreen. Since the ball has authority over the chain, it's always going to be the last object to despawn already (as long as a full rotation takes less than 3 seconds).
- Orbits itself has some funky attach to layer compatibility, it might be worth to test through some of the combinations (ball on moving layer, moving layer attached to ball) and test through some edge cases with layer movement (Player powering up, player entering warp, Green P-Switch enabled. Important to note is that layers attached TO npcs don't usually pause during a player forced state change).
- Speaking of testing, the empty if-statement about grabbed, thrown and contained state has me wondering if the NPC acts as expected in those situations. The first 2 can be tested by putting a ball n chain into diggable grass, and the latter can be tested in many ways, like putting it into a block, or setting the ball as the player's reservePowerup in onStart.

Hammerless Penguin
Snifit
Snifit
Posts: 203
Joined: Sat Sep 22, 2018 6:17 am
Flair: Just kicking that kirby to the curb!
Contact:

Re: Ball 'N' Chain NPC

Postby Hammerless Penguin » Wed Jul 29, 2020 7:40 am

Image
Attaching the ball to layers with moving NPCs and then getting hit or getting a power up will cause the ball to dislocate from the attached layer instead of staying in sync
Image
They also don't disappear when they are on layers that shouldn't be visible until an event takes place.

Smibbix
Bit
Bit
Posts: 60
Joined: Fri Apr 06, 2018 10:47 pm

Re: Ball 'N' Chain NPC

Postby Smibbix » Wed Jul 29, 2020 3:02 pm

Hammerless Penguin wrote:
Wed Jul 29, 2020 7:40 am
Image
Attaching the ball to layers with moving NPCs and then getting hit or getting a power up will cause the ball to dislocate from the attached layer instead of staying in sync
Image
They also don't disappear when they are on layers that shouldn't be visible until an event takes place.
Hmmm... Yeah there are definitely some things I've been meaning to fix about this, along with some of the stuff Enjl said above. I'll get working on a bugfix update, also probably including the grey rotating platforms as a bonus


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 0 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari