pxt-arcade icon indicating copy to clipboard operation
pxt-arcade copied to clipboard

makecode arcade: bounce on wall physics are not correct when using tile maps

Open rantan-plan opened this issue 2 years ago • 1 comments

Describe the bug When bounce on wall is activated and used together with tile maps, the sprite physics seem to be not correct any more.

To Reproduce Try the following code in the arcade.makecode.com editor. The tile map itself may remain unpopulated but needs to be created in order to execute the code.

tiles.set_current_tilemap(tilemap("""level1"""))

mySprite = sprites.create(img("""
            1 
    """),
    SpriteKind.player)
mySprite.set_bounce_on_wall(True)
mySprite.set_velocity(18, -40)

Then try to code with the tile map disabled, i.e. removed from the code. The bouncing / reflection of the sprite will be different.

Expected behavior The bouncing physics should not change when an empty tile map is added to the code.

Desktop (please complete the following information):

  • OS: Linux Mint 20.1
  • Browser: Firefox 95.0, Chromium 96.0

rantan-plan avatar Mar 17 '22 07:03 rantan-plan

Updated the example code to set a velocity for the sprite - that code line slipped through in the original post.

rantan-plan avatar Mar 29 '22 17:03 rantan-plan

@jwunderl can you see if this bug is valid ?

abchatra avatar Sep 28 '22 02:09 abchatra

This sounds fixed by https://github.com/microsoft/pxt-common-packages/pull/1368 which fixed hitbox detection for bounce on wall when no tilemap is set, though I'll note that there would still be some changes when adding an 'empty' tilemap -- in particular, the default tilemap at 16x16 is larger than the screen, so adding it to the project will make it so the collisions on the right / bottom side won't occur until they are further down / rightward - I would describe that as 'by design' as even a tilemap with no tiles constrains the play area / it's still there even if no tiles are rendered.

jwunderl avatar Sep 28 '22 17:09 jwunderl