X and Y coordinates for hitboxes and how they interact
X and Y coordinates for hitboxes and how they interact
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.
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.
-
- Posts: 18
- Joined: Sun Oct 11, 2009 6:27 pm
- Contact:
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
-
- Posts: 18
- Joined: Sun Oct 11, 2009 6:27 pm
- Contact:
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:
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:
To become this:
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:
(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.
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:
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
Code: Select all
6: [4, 11, 19, 42], [0, 0], 4
(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.
-
- Posts: 18
- Joined: Sun Oct 11, 2009 6:27 pm
- Contact:
-
- Posts: 18
- Joined: Sun Oct 11, 2009 6:27 pm
- Contact:
-
- Posts: 18
- Joined: Sun Oct 11, 2009 6:27 pm
- Contact: