crosscode-map-editor icon indicating copy to clipboard operation
crosscode-map-editor copied to clipboard

Incorrect x/y coordinate calculation for some NPC Entities

Open ghost opened this issue 6 years ago • 7 comments

NPC: "crossovers.bunny"

Calculated sheets.fix[0].x position should be 0 but is 32.

ghost avatar Dec 30 '19 15:12 ghost

in what map is the npc used?

Vegita2 avatar Dec 30 '19 15:12 Vegita2

I can't find the map with bunny in it, but it also breaks for "crossovers.turing" map: "rookie-harbor.test"

ghost avatar Dec 30 '19 15:12 ghost

These rely on animSheet.SUB entries

ghost avatar Dec 30 '19 16:12 ghost

Maybe because of this line? https://github.com/CCDirectLink/crosscode-map-editor/blob/673bfbb766fd48b4ffa61742fab64536ee42e928/webapp/src/app/shared/phaser/entities/registry/npc.ts#L175

if sheet.offX is 0 it is not used because it evaluates to falsy

Vegita2 avatar Dec 31 '19 15:12 Vegita2

Possibly. I need to check

ghost avatar Dec 31 '19 22:12 ghost

Maybe because of this line?

https://github.com/CCDirectLink/crosscode-map-editor/blob/673bfbb766fd48b4ffa61742fab64536ee42e928/webapp/src/app/shared/phaser/entities/registry/npc.ts#L175

if sheet.offX is 0 it is not used because it evaluates to falsy

It's not because of this. The hardcoded NPCSimple is used to offset the frames, but the npc crossovers.turing only has one frame so the offset is wrong. I don't really know how to fix it, or in general how the npc's get their sprites

Vegita2 avatar May 21 '21 16:05 Vegita2

I have noticed this too, it seems to be quite widespread. NPCs rendered in the map editor are always slightly off from their positions in-game. Here is an example comparing the map editor (first image) versus in-game (second image), note the position of the character's feet compared to the floor pattern: image image

It's not always the same offset however. Here is another example. First image is map editor, second image is in-game: image image

The first example was higher in-game and the second example was lower in-game. It seems to be different for different NPCs, their "config" setting in the NpcState, and perhaps their "face" setting.

This is a minor annoyance that makes it impossible to be pixel-perfect while placing NPCs. I also like to position NPCs around in the editor temporarily to note coordinates for navigation waypoints, and this means those will always be slightly off.

XenonA7 avatar Jul 31 '24 23:07 XenonA7