Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation lies regarding z-index ordering of setLegend #1222

Open
grymmy opened this issue Nov 8, 2023 · 2 comments
Open

Documentation lies regarding z-index ordering of setLegend #1222

grymmy opened this issue Nov 8, 2023 · 2 comments
Assignees
Labels
bug Something isn't working medium priority

Comments

@grymmy
Copy link
Contributor

grymmy commented Nov 8, 2023

Describe the bug
A user reported that the documentation in the help panel states the following under setLegend(bitmaps):
Screenshot 2023-11-08 at 4 25 53 PM
however this link shows a game where it can easily be seen that this ordering is not respected.

To Reproduce
Steps to reproduce the behavior:

  1. Open above link
  2. Modify legend order
  3. Run game

Expected behavior
draw order should respect setLegend documentation

Actual behavior
draw order does not respect setLegend documentation

@grymmy grymmy added the bug Something isn't working label Nov 8, 2023
@grymmy
Copy link
Contributor Author

grymmy commented Nov 8, 2023

@leomcelroy stated he believed this is likely a regression. I will investigate this tomorrow by doing a git bisect and attempt to find the specific commit that caused this apparent regression.

@grymmy grymmy self-assigned this Nov 8, 2023
@leomcelroy
Copy link
Collaborator

This is a minimal example that does seem to demonstrate that the z-ordering is respected.

https://sprig.hackclub.com/share/3kovFmLi0HQaMQNvOMQd

Try swapping the order of the sprites.

What the bug should be in the provided example is that setLegend should clear the entire sprite table in the movement code.

onInput("w", () => {
  getFirst(player).y -= 1
  setLegend([ player, playerMaps[0]])
})
onInput("a", () => {
  getFirst(player).x -= 1
  setLegend([ player, playerMaps[1]])
})
onInput("s", () => {
  getFirst(player).y += 1
  setLegend([ player, playerMaps[3]])
})
onInput("d", () => {
  getFirst(player).x += 1
  setLegend([ player, playerMaps[2]])
})

The error may be here:

https://github.com/hackclub/sprig-engine/blob/main/src/web/index.ts#L94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working medium priority
Projects
None yet
Development

No branches or pull requests

2 participants