CCDirectLink / crosscode-map-editor

Map Editor for CrossCode
MIT License
53 stars 19 forks source link

Incorrect x/y coordinate calculation for some NPC Entities #130

Open ghost opened 4 years ago

ghost commented 4 years ago

NPC: "crossovers.bunny"

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

Vegita2 commented 4 years ago

in what map is the npc used?

ghost commented 4 years ago

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

ghost commented 4 years ago

These rely on animSheet.SUB entries

Vegita2 commented 4 years ago

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

ghost commented 4 years ago

Possibly. I need to check

Vegita2 commented 3 years ago

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

XenonA7 commented 3 months ago

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.