Solved Flash offset - Where is the starting point?

Question that is answered or resolved.

ipkevin

Member
Hi Guys,

I created a new flash entity and I'm trying to set its offset, but I don't understand where the 0,0 starting point is located. The manual seems to imply that it's related to where the attack box and bbox meet, but I don't really see that in practice.

When I set the flash's offset to (0,0), the flash appears in the middle of the punching arm, far from the point of contact. I also tried creating a rectangular obstacle whose bbox matched its visual edge to make it easier to see, but the flash location didn't make any sense to me.
 
Last edited:
Solution
It seems you may be confusing offset with position, that's not what it is. Offset is the image offset (hence the name) in relation to the entity's in game position.

The manual seems to imply that it's related to where the attack box and bbox meet, but I don't really see that in practice.

That is how it works. The engine calculates where to spawn flash entities by finding the center point where the attack box and body box intersect. If you are getting erroneous results, then you have something maladjusted.

My guess is your boxes are not where you think they are. It's an easy mistake to make, but the engine can help you. See this video by yours truly about debugging collision.

It seems you may be confusing offset with position, that's not what it is. Offset is the image offset (hence the name) in relation to the entity's in game position.

The manual seems to imply that it's related to where the attack box and bbox meet, but I don't really see that in practice.

That is how it works. The engine calculates where to spawn flash entities by finding the center point where the attack box and body box intersect. If you are getting erroneous results, then you have something maladjusted.

My guess is your boxes are not where you think they are. It's an easy mistake to make, but the engine can help you. See this video by yours truly about debugging collision.

 
Solution
Also to add, I generally set my offsets for flashes slightly off centre (black dot)

n6Rez8C.png


so for this flash the offset 68 69


I like to make them small and appear/disappear fast too, pet peeve of mine is big flashy effects
 
@DCurrent -- Thank you! Super helpful! Those debug options are a life saver, too. What I've noticed though is that flash offset does not get reversed when facing the other direction. For example, the flash appears 16px to the right of the point of impact, no matter if I'm facing right or left. I expected it to be 16px to the right in one direction and 16px to the left when attacking from the other direction. That's how offset seems to work for other entities' animations. Is it intentionally different for flash or have I left a setting out somewhere?

Also to add, I generally set my offsets for flashes slightly off centre (black dot)

n6Rez8C.png


so for this flash the offset 68 69

I like to make them small and appear/disappear fast too, pet peeve of mine is big flashy effects

Thanks, @danno! I have the same taste. I dont like a flash that covers up the fist too long and I prefer it to be in front of the fist slightly. It just feels more impactful when you can see the fist.
 
That's how offset seems to work for other entities' animations. Is it intentionally different for flash or have I left a setting out somewhere?

Have you declared toflip 1 in the header like this:
Code:
name    Block
type    none
toflip  1


anim idle
    delay    4
    offset    16 16
    frame    data/chars/flash/block01.gif
    frame    data/chars/flash/block02.gif
    frame    data/chars/flash/block03.gif
    frame    data/chars/flash/block04.gif
    frame    data/chars/flash/block05.gif
    frame    data/chars/flash/block06.gif
    frame    data/chars/flash/block07.gif
 
Back
Top Bottom