Page 1 of 1

How do I make a Thwimp constantly jump forward instead of back and forth?

Posted: Mon Jul 22, 2019 10:33 pm
by Chilly14
I've been trying to figure this out, but I haven't yet. Any answers...? ',:(

Re: How do I make a Thwimp constantly jump forward instead of back and forth?

Posted: Tue Jul 23, 2019 1:26 am
by Maxjacinto2
I know this is a Lua-oriented question, but the easiest way to make this is to simply replace the Fighter Fly's graphics. :)

Re: How do I make a Thwimp constantly jump forward instead of back and forth?

Posted: Tue Jul 23, 2019 4:27 am
by Enjl
Copy npc-301.lua into the level folder, rename it to npc-751.lua, copy the sprite and ini file (data/pge/config/smbx2/items/npc/npc-301.ini) as well, and do the same. Go into npc-751.lua and remove the data.direction field and everything related to setting it or retrieving information from it. NPC-751 is now a copy of thwimp which doesn't know what turning is.

Re: How do I make a Thwimp constantly jump forward instead of back and forth?

Posted: Tue Jul 23, 2019 7:26 am
by Chilly14
Thank you!

Added in 12 minutes 36 seconds:
Okay, it's working, for the most part, but somehow the Thwimp never stops jumping forward even after hitting a wall. Plus, even if it is set to go right, it still jumps left. How do I fix this?

Re: How do I make a Thwimp constantly jump forward instead of back and forth?

Posted: Tue Jul 23, 2019 8:11 am
by Enjl
Chilly14 wrote:
Tue Jul 23, 2019 7:39 am
Thank you!

Added in 12 minutes 36 seconds:
Okay, it's working, for the most part, but somehow the Thwimp never stops jumping forward even after hitting a wall. Plus, even if it is set to go right, it still jumps left. How do I fix this?
You probably removed the data.direction from the line where it sets the speedX value when a jump begins. I don't know exactly what integer it is, so here's an example on how it MIGHT look vs how it SHOULD look:
v.speedX = 2
should be
v.speedX = 2 * v.direction

v.direction automatically changes when the thwimp hits a wall.

If I'm talking utter nonsense here, please share your new thwimp file on https://hastebin.com/

Re: How do I make a Thwimp constantly jump forward instead of back and forth?

Posted: Tue Jul 23, 2019 8:26 am
by Chilly14

Re: How do I make a Thwimp constantly jump forward instead of back and forth?

Posted: Tue Jul 23, 2019 9:29 am
by Enjl
Chilly14 wrote:
Tue Jul 23, 2019 8:26 am
Here: https://hastebin.com/obipoyefep.rb
Here's the line:
v.speedX = data.thwimpJumpSpeed * data.thwimpJumpDirection
data.thwimpJumpDirection needs to be replaced with v.direction.

Re: How do I make a Thwimp constantly jump forward instead of back and forth?

Posted: Tue Jul 23, 2019 10:38 am
by Chilly14
Oh, thank you! I finally got it to work properly.