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?
Follow Us On