chrismaltby / gb-studio

A quick and easy to use drag and drop retro game creator for your favourite handheld video game system
https://www.gbstudio.dev
MIT License
8.49k stars 469 forks source link

Top Down 2D - Walking Through Collisions (v2>v3) #848

Open Geonjaha opened 2 years ago

Geonjaha commented 2 years ago

After migration of project from v2 to v3.

Unsure if intentional given new sprite size parameters. Collisions work in all directions except upward (i.e. when approaching a collision from below).

Issue isn't present when changing the sprite boundaries to 16x16 instead of the 16x8 that it defaults to with migration (in v2 no movement into darker green blocks was possible)

To Reproduce Steps to reproduce the behavior:

  1. Set player sprite boundaries to 16x8
  2. Walk up (north) against a collision in Top Down 2D mode (16x16 grid)

Collisions

Collisions as shown (note the thinner collision on the top allowed total movement through) image

Platform: OS: Windows 10 Pro GB Studio V3.0

RichardULZ commented 2 years ago

Are your project settings using topdown 2d 16x16 grid instead of 8x8? Does it do this in both modes?

Geonjaha commented 2 years ago

Are your project settings using topdown 2d 16x16 grid instead of 8x8? Does it do this in both modes?

This is using a 16x16 grid. It doesn't do this in 8x8 (collisions act as normal). It also isn't a problem in Adventure mode.

RichardULZ commented 2 years ago

If you paint collision in blocks of 2x2, it's not an issue right? As it only happens in 16x16 grid mode, the engine fix would be checking all 4 tiles in this mode, could be a little slower for the Gameboy cpu.

Are there any cases you could see where you are using 16x16 grid mode, but need an 8x8 collision tile changed?

Geonjaha commented 2 years ago

If you paint collision in blocks of 2x2, it's not an issue right? As it only happens in 16x16 grid mode, the engine fix would be checking all 4 tiles in this mode, could be a little slower for the Gameboy cpu.

Are there any cases you could see where you are using 16x16 grid mode, but need an 8x8 collision tile changed?

Unfortunately, it's an issue for a 2x2 collision block too, so long as you're moving up into it. The difference is with a 1x2 collision block, you can walk through it, whereas with 2x2, you can walk onto it, but no further. You can see both happening in the GIF.

RichardULZ commented 2 years ago

ah, i see now, it's testing the 2 tiles under the top of the sprite before it moves, you did mention it having 16x8 collision in the sprite editor. Does making the player sprite bounds 16x16 fix this? I worry that adding a specific check for 16x topdown 2d, that adds an offset of tile collision, may break more than it fixes. if 16x16 bounds on the sprite, with topdown2d 16x grid works, a warning when using 16x8 collision with 16x grid mode might be best/easiest?