Page 1 of 1

Ball 'N' Chain NPC

Posted: Sun May 31, 2020 7:41 pm
by Smibbix
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

Re: Ball 'N' Chain NPC

Posted: Sun May 31, 2020 8:10 pm
by King Mario
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!

Re: Ball 'N' Chain NPC

Posted: Mon Jun 01, 2020 12:07 am
by TheTrueMarioMaster
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.

Re: Ball 'N' Chain NPC

Posted: Mon Jun 01, 2020 2:05 am
by Emral
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.

Re: Ball 'N' Chain NPC

Posted: Wed Jul 29, 2020 7:40 am
by Hammerless Penguin
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.

Re: Ball 'N' Chain NPC

Posted: Wed Jul 29, 2020 3:02 pm
by Smibbix
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