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.53k stars 470 forks source link

Passive collisions do not work on top down 2D scenes #451

Open ultimate-steve opened 4 years ago

ultimate-steve commented 4 years ago

Describe the bug In Platformer scenes, if the player stays still and an enemy collides, the collision event is triggered. However, if you change the scene type to "Top Down 2D", the collision only triggers when the player tries to move towards the enemy.

To Reproduce

  1. Create a "Top down 2D" scene
  2. Create an actor and set a basic update script to move towards the player
  3. Configure an "On Hit" action
  4. Test the game and verify that the collision doesn't trigger when the player stays still.

Expected behavior The collision event should fire

Platform (please complete the following information):

Additional context Add any other context about the problem here.

pau-tomas commented 4 years ago

TopDown only checks for collisions when there's movement. I have a local fix for it (just adding the extra collision check that exists in the Platformer) but need to do some testing to make sure it doesn't break anything else.

RichardULZ commented 4 years ago

Tigy01 on discord was also running into this issue https://discord.com/channels/554713715442712616/585023243732123676/746597514089725959 Good luck testing!

raulriera commented 4 years ago

Adding my own comment on the issue as well https://discordapp.com/channels/554713715442712616/585023243732123676/748012165436276807

@pau-tomas, do you have a PR up? I could eject my engine and test your fix on my game

jessemillar commented 2 years ago

This appears to have come back since @pau-tomas's PR was merged. Passive collisions as described in the initial post do not work in v3.1.0 for top-down or adventure scenes based on my testing.

RichardULZ commented 2 years ago

@jessemillar just checking, this is with passive collisions from the player to actors?

Actor to actor collisions have never worked as it's exponentially more checks, and with scene collision enabled on move events, actors don't go inside the player to cause hit events.

jessemillar commented 2 years ago

@RichardULZ Correct. I have an enemy actor and when it goes inside the player it doesn't trigger collision but when the player attempts to move into (or move while the enemy is already inside the player), the collision triggers. I've fixed the issue in my game by using the "is player within x tiles from enemy actor" action after each movement from the enemy actor.