hackclub / sprig

🍃 Learn to code by making games in a JavaScript web-based game editor.
https://sprig.hackclub.com
MIT License
919 stars 1.14k forks source link

Phantom Tiles happening when placing sprites with names longer than a character #1892

Open 29cmb opened 4 months ago

29cmb commented 4 months ago

Describe the bug Creating a sprite with a name that starts with the name of another sprite creates phantom tiles

To Reproduce Create a sprig project and create 2 items in the legend, w for winSpace, and wa for Wall If I want to place the wa, instead of just placing the wall, it places a winSpace and a red square, the req square makes a new row or column of tiles which cannot be interacted with or placed on, generating phantom tiles

Expected behavior Either WA should be placed just fine or an error should be given saying "Sprite names must be one character"

Actual behavior
Creates phantom tiles with no indication of something being wrong.

https://github.com/hackclub/sprig/assets/71194682/a33330bd-bf6d-4d4f-bf1e-7b2ac66e8500

BrightTheBackpack commented 4 months ago

I think that's just due to the nature of the map. Maps have a multi-line string of characters representing the bitmaps to be rendered. When the sprite name is longer than a character, "wa" gets added, but it gets parsed as "w" "a". I think having an error added is a good idea though

29cmb commented 4 months ago

Yeah that is the issue, but it's not addressed which is the problem

BrightTheBackpack commented 4 months ago

theres already errors when you set a bitmap to more than one character. how else do you suggest this to be adressed?

29cmb commented 4 months ago

It should probably just not let you assign a bitmap to a multi-character name in the first place, as that error only appears when the run button is pressed