Banner
Views: 784,441,850
Time:
13 users online: Blue Axl, fail_1235, goldenrules,  idol, K.T.B., MaxwelHacks, MegaSonic1999, Nadir, Nikku4211, orka-bln, Rammy, Ruberjig, snoruntpyro - Guests: 28 - Bots: 190 Users: 41,024 (1,551 active)
Latest: fail_1235
Tip: Palettes 0-3 do not work correctly on the overworld unless you use LM's option to disable the event reveal animation.Not logged in.
Hey, listen! DO NOT use the "gfxoffset" NPC codes! This tells you how to properly align NPC hit boxes.
Forum Index - Sunken Ghost Ship - Old Contests & Events - SMWCX - Hey, listen! DO NOT use the "gfxoffset" NPC codes! This tells you how to properly align NPC hit boxes.
Pages: « 1 »
Seriously, don't. It will only cause you and the players trouble.

So I was making my Pikmin Forest level, and I found something intimidating about Super Mario Bros. X that I think you should know about.

So I decided to change the Pikmin graphics simply because there are more Pikmin available in this new art style, and I think this new art style looks better.

Anyway, what I wanted to do is change the size of the hit boxes, and this is what it initially looks like (using PGE editor).



As you can probably see, the hit box (the red box) isn't aligned the way I want it. That might simply make you think, "Ooh, I'll simply change "gfxoffsetx" to align the hit box." That's exactly what I did. This is where I want the hit box to be. (Note the "X Offset" property.)



So I tested the collision behavior in Super Mario Bros. X one night and everything seemed to be working properly. It was getting late, so I went to bed.

The next morning, I started testing it again, and it was NOT working properly! "What the heck!" I thought, "How's it not working properly? It was working properly last night, wasn't it?"

Now comes the jarring part. You saw how the hit box was aligned properly in the second screenshot, right? Well, I found out that if I were to press the button with the arrow pointing right on it, which makes the sprite "face right", this happens.



What?! The hit box is misaligned?!

If I change the "X Offset" from -3 to 3, the hit box aligns.



But then the hit box won't be aligned when I make it "face left".



What?! So how do I align the hit box?!

The solution is simple. First of all, make sure the "Offset" properties are set to 0 and turned off. Never touch them. To align your hit box, open up your NPC in a graphics editor and add blank columns of pixels to a side of the graphic to align your hit box the way you want it. The number of blank columns to add would be DOUBLE the number that you would type in for the "gfxoffset" property. Make sure you edit the graphic and the mask this way, and don't forget to change the "gfxwidth" and "gfxheight" properties accordingly.



I typed in 3 for the offset value, so I add 6 blank columns of pixels to the right of the graphic and the mask to align the hit box.

Now the hit box is aligned properly.



See?



Any objections, ladies and gentlemen? Do you think "gfxoffset" still has a use after this tutorial or no?


My Little Pony: Cutie Re-Mark Adventure is on hiatus.

The authors of these 2 My Little Pony fan games have removed their games from the Internet.
Download My Little Pony: Rise of the Clockwork Stallions DX: Director's Cut and My Little Pony: Magic Shards now! Mirror 2. Spread these links!

Oh, interesting tutorial! Will keep this as a sticky for it to not be together with the level threads.

Haven't done much with NPC codes yet, but this can be useful.
Actually, the gfxoffset codes can be useful if the hit-box is aligned to the left of the graphic instead of the center. Also, if changing the hit-box misaligns the graphic somehow, gfxoffset=0 will fix it.
Pages: « 1 »
Forum Index - Sunken Ghost Ship - Old Contests & Events - SMWCX - Hey, listen! DO NOT use the "gfxoffset" NPC codes! This tells you how to properly align NPC hit boxes.

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2019 - SMW Central
Legal Information - Privacy Policy - Link To Us


Total queries: 7

Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Talkhaus
  • SMBX Community
  • GTx0
  • Super Luigi Bros
  • ROMhacking.net
  • MFGG
  • Gaming Reinvented