X and Y coordinates for hitboxes and how they interact

Discussion and analysis of graphics, story, levels, and so on.
Post Reply
Bernie
Posts: 124
Joined: Sat Sep 22, 2012 2:28 pm
Location: Aus

X and Y coordinates for hitboxes and how they interact

Post by Bernie »

Don't know if this is the correct area to post this in, but I changed the graphic for my keen sprite (for keen4) and its taller than the original and now i can't click switches or enter doorways like normal cause they have to be a tile higher now, but i'd like it if i can make it still click em at the same height.

anyways, this is copy/pasted from a PM I sent to someone:

this is my plight:

changing the y co-ords for the keen sprite hitbox does nothing, basically.

so my new graphic for keen is 43 pixels high and i gave it a hitbox height of 32 (well, 31) as is for the normal keen graphic, but a chunk of my graphic is now below the floor- so i bump up its Y hitbox co-ord with all sorts of crazy numbers and... they keep doing nothing :/ its always partly underneath the floor. (bit of a side note: had to give keen's jumping sprites/graphics the same values or it goes weird).

my amateur guess is that the sprites has some sorta 'fall till you hit the ground' behavior that neglects any upward Y co-ord you give it (cause it just kicks it back down to the floor anyways).

so anyone out there know what im talking about?
free buscuits for anyone who helps! thanks.

EDIT: I guess in a nutshell I'm asking if there is any way a taller/bigger graphic can have a smaller hitbox and work correctly.
Last edited by Bernie on Mon Mar 25, 2013 2:44 am, edited 1 time in total.
Plasma Captain
Posts: 18
Joined: Sun Oct 11, 2009 6:27 pm
Contact:

Post by Plasma Captain »

Did you try changing the y offset? It's in the second array, after the array that defines the hitbox coordinates.

Code: Select all

6: [4, 0, 19, 31], [0, 0], 4
Bernie
Posts: 124
Joined: Sat Sep 22, 2012 2:28 pm
Location: Aus

Post by Bernie »

oh yes. thats what i was referring to when i said 'bump up its Y hitbox co-ord'.

thanks but no biscuits yet!
Plasma Captain
Posts: 18
Joined: Sun Oct 11, 2009 6:27 pm
Contact:

Post by Plasma Captain »

Oh. I was under the impression that you were only messing with the hitbox coordinates, not the offset.

In any case, I just tried doing what you said that you wanted to do, and I had absolutely no problems. In fact, I didn't even need to modify the offset.

Here's Pope Blazkowicz II:

Image

As you can see, his sprite is now 43 pixels tall, but his hitbox will be left untouched from the original.

Now, I went into the sprites file and modified this line:

Code: Select all

6: [4, 0, 19, 31], [0, 0], 4
To become this:

Code: Select all

6: [4, 11, 19, 42], [0, 0], 4
We're leaving the size of the hitbox the way that it was, so all we want to do is change its position. So, with the new sprite open in MS Paint, I just dragged the Select tool from the upper left corner of the hitbox panel to the upper left corner of the hitbox, getting the distance (4,11). The 4 is the same as it was before since we didn't change the width of the sprite. The same goes for the lower right corner of the hitbox. Nothing else needs to be changed. Compiling the sprites and checking it out in-game gave me this:

Image

(Ignore the black scribbles, I obscured some custom sprites; likewise the white graphical glitches exist due to in-progress assets)

As you can see, he's properly positioned.

Sorry if this is overkill, but I'm just trying to make sure that I'm covering all the bases.
Bernie
Posts: 124
Joined: Sat Sep 22, 2012 2:28 pm
Location: Aus

Post by Bernie »

ohhhhh, you made the first Y position 11. see, i tried putting some values in that point before but it didnt seem to do anything. I'll try this when i get home.

thanks alot for that.

btw i dont actually have biscuits :/ sorry if you helped me just to get biscuits.
Plasma Captain
Posts: 18
Joined: Sun Oct 11, 2009 6:27 pm
Contact:

Post by Plasma Captain »

Hahahah. No problemo.
Bernie
Posts: 124
Joined: Sat Sep 22, 2012 2:28 pm
Location: Aus

Post by Bernie »

OMG this works beautiful! you beautiful, beautiful man. i'd go gay for you sir.
thank you again.

PS is that keen as the pope in those pics?
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

It seems the switches respond to Keen's hitbox's top-left corner; this can be lowered a tile... with certain caveats.
Plasma Captain
Posts: 18
Joined: Sun Oct 11, 2009 6:27 pm
Contact:

Post by Plasma Captain »

Bernie wrote:you beautiful, beautiful man. i'd go gay for you sir.
If I had a quarter for every time I've heard that... well, I might have a dollar. An ironic dollar.

And yes, "pope hat" is the first thing that came to mind when you mentioned heightening Keen's sprite.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

It is said when a Shelley releases white smoke we have a new PopeKeen.
Plasma Captain
Posts: 18
Joined: Sun Oct 11, 2009 6:27 pm
Contact:

Post by Plasma Captain »

Hahahahah. This must happen.

"Commander Keen 5 in: Commander Keen 4: A New Pope"
Post Reply