Custom related questions

Need help with any SMBX game-related issues? Ask your questions here.
SuperYoshi
Goomba
Goomba
Posts: 2
Joined: Fri Jan 05, 2024 10:35 pm

Custom related questions

Postby SuperYoshi » Fri Jan 05, 2024 10:52 pm

So this is probably gonna sound like a problem with a super easy solution I apologize I am new to all of this. I recently just made a custom NPC just to basically have it make a message and nothing else. Two problems I have is first the size I want to make it a bit smaller but when I try to make the image smaller in my image editor it just becomes distorted. Basically I am asking if there is a way to resize the sprite within SMBX. My other problem is it won't stop jumping. I looked through all the code and I can't see anything that would cause it to just to constantly jump.

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

Re: Custom related questions

Postby Emral » Sat Jan 06, 2024 10:53 am

1. Regarding size:
There are 2 separate files. One is for the editor size, one is for the size in game. The editor file is the .ini file, the one for the game can be either a .txt, or embedded in the .lua as part of the "setNPCSettings" block. You probably have the latter.
In your ini, adjust gfx-width and gfx-height to match the size of one frame on the sprite sheet. physical-width and physical-height exist too, and define the size of the hitbox. The same fields exist in the txt/lua and are called gfxwidth/gfxheight and width/height respectively here. Just make sure the values match between the ini and txt/lua and you should be good.
For more information: This docs page

2. Won't stop jumping
Check the onTickNPC of the code. There should be a comment near the bottom that reads "Execute main AI of the NPC. This example just jumps forever". Remove the lines below that comment that set v.speedY when the NPC is on the ground. This piece of code is there as a check to confirm that your code is loaded correctly, and as a starting point for people to replace with their own.

SuperYoshi
Goomba
Goomba
Posts: 2
Joined: Fri Jan 05, 2024 10:35 pm

Re: Custom related questions

Postby SuperYoshi » Sat Jan 06, 2024 11:57 am

Thank you so much


Return to “Help and Support”

Who is online

Users browsing this forum: No registered users and 3 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari