Mimicking the cliffturn behavior

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

Moderator: Userbase Moderators

GtW
Bob-Omb
Bob-Omb
Posts: 22
Joined: Sat Jun 06, 2020 6:35 am

Mimicking the cliffturn behavior

Postby GtW » Sun Jul 12, 2020 3:40 pm

So, I am currently making an NPC that walks on the ceiling, which then turns around when there is no ceiling to walk on.
I'm curious if there is a way to mimicking the behavior of the "cliffturn" property but checking the ceiling instead or not. I already kind of have an idea to iterate position check through the block in the level manually, but that seems to be a bit overkill.

Does anyone have a better idea on how to approach this?

Also, I have another small question that I'm not sure if it warrants its own thread so I'll add it here too.

Is there a way to make single effect behaves differently without manually duplicating the effect itself? Similarly to the basegame Shy Guy or Bullet Bills -it moves similarly to TICK_DROP if stomped, but TICK_ARC if killed by other means. That'd not only save effect slot but also easier to do custom graphics for the user side.

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

Re: Mimicking the cliffturn behavior

Postby Emral » Sun Jul 12, 2020 3:47 pm

1) I believe the polflip has some kind of slant detection for ceilings. It doesn't care for slopes though.
viewtopic.php?f=101&t=24442
If not the polflip, then the ceiling and floor stretch npcs in basegame share custom edge detection code that works similarly. That code may be difficult to understand, though, as all 4 possible stretch directions share the same lines of code.
Basically, it's two getIntersectings in the facing direction, placed just in front of the hitbox. One above the current y for pits, and one below for walls.

2) Yes. You can, for specific harm types, override the speed values of an effect. Look at the monty mole in basegame (npc-309.lua i believe).
[HARM_TYPE_JUMP]={id=170, speedX=0, speedY=0},
[HARM_TYPE_FROMBELOW]=170,

GtW
Bob-Omb
Bob-Omb
Posts: 22
Joined: Sat Jun 06, 2020 6:35 am

Re: Mimicking the cliffturn behavior

Postby GtW » Mon Jul 13, 2020 3:25 pm

Enjl wrote:
Sun Jul 12, 2020 3:47 pm
1) I believe the polflip has some kind of slant detection for ceilings. It doesn't care for slopes though.
viewtopic.php?f=101&t=24442
If not the polflip, then the ceiling and floor stretch npcs in basegame share custom edge detection code that works similarly. That code may be difficult to understand, though, as all 4 possible stretch directions share the same lines of code.
Basically, it's two getIntersectings in the facing direction, placed just in front of the hitbox. One above the current y for pits, and one below for walls.
Thank you very much! This seems to be what I'm looking for and it works very well.

Enjl wrote:
Sun Jul 12, 2020 3:47 pm
2) Yes. You can, for specific harm types, override the speed values of an effect. Look at the monty mole in basegame (npc-309.lua i believe).
[HARM_TYPE_JUMP]={id=170, speedX=0, speedY=0},
[HARM_TYPE_FROMBELOW]=170,
However, this doesn't seems to be working for some reason.
I'm not sure if this is just me or the currently known bug but it seems like the parameters aren't overriding properly?

This is a screen record of a fresh new level using basegame Monty Mole. When I'm jumping on it, its defeated effect still moves like regular AI_ARC without initial speedX and speedY set to 0 like in code.
Spoiler: show
Image

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

Re: Mimicking the cliffturn behavior

Postby Emral » Mon Jul 13, 2020 3:47 pm

Huh. You seem to be right. Just fixed it internally, so that'll work in the next patch. Thanks for noticing.

GtW
Bob-Omb
Bob-Omb
Posts: 22
Joined: Sat Jun 06, 2020 6:35 am

Re: Mimicking the cliffturn behavior

Postby GtW » Tue Jul 14, 2020 1:43 am

No problem. Glad I could help!


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 3 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari