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

Bug Report: Unable to add Sprites to appear under playerStrum underlay notes #3933

Closed
2 tasks done
Starexify opened this issue Dec 13, 2024 · 2 comments
Closed
2 tasks done
Labels
status: pending triage The bug or PR has not been reviewed yet. type: minor bug Involves a minor bug or issue.

Comments

@Starexify
Copy link

Starexify commented Dec 13, 2024

Issue Checklist

  • I have properly named my issue
  • I have checked the Issues/Discussions pages to see if my issue has already been reported

Platform

Itch.io (Downloadable Build) - Windows

Browser

None

Version

0.5.x

Description (include any images, videos, errors, or crash logs)

I try to make a custom Sprites to have the zIndex under the notes of the playerStrum underlay, for example if I try to make a sprite when a note is hit:

override function onNoteHit(event:HitNoteScriptEvent) {
    var sprite = new FunkinSprite(0, 0, "img");
    sprite .zIndex = 900;
    sprite .cameras = [state.camHUD];
    state.add(sprite );
 }

state = PlayState.instance; in this simple case

The notes appear under the sprite for some reason, but normally the notes should be over the sprite (doesn't matter what zIndex I give, result still same even if i usethe zIndex of the strumline or one strumline note)
Edit: The only idea I could come up with is to render the sprite beforehand onSongLoaded, but the approach is not that optimal imo
Or call the method sort but idk how optimal is this
state.sort(SortUtil.byZIndex, FlxSort.ASCENDING);

Steps to Reproduce

  1. Create a polymod with the code snippet above (with an actual image name)
  2. Notes are shown under the Sprite even tho zIndex should render them above the Sprite.
@Starexify Starexify added status: pending triage The bug or PR has not been reviewed yet. type: minor bug Involves a minor bug or issue. labels Dec 13, 2024
@Keoiki
Copy link
Contributor

Keoiki commented Dec 14, 2024

Below the line which adds the sprite, put state.refresh();, it does what your sort example does and it's exactly what you're supposed to do. The only time zIndex works is when you call the refresh function, otherwise it's pointless.

@Starexify
Copy link
Author

Below the line which adds the sprite, put state.refresh();, it does what your sort example does and it's exactly what you're supposed to do. The only time zIndex works is when you call the refresh function, otherwise it's pointless.

Oh so it's the same literally but without having to import stuff, nice thanks. but still why isn't it called refreshZIndex/reorderZIndex/rerenderZIndex or smth like that so it's more clear when trying to use the method ;-;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: pending triage The bug or PR has not been reviewed yet. type: minor bug Involves a minor bug or issue.
Projects
None yet
Development

No branches or pull requests

2 participants