Enemy has a black bar on top of them, sometimes

Godot Version

Godot 4.6 Beta 2 (32-bit)

Question

Hello! I hope that you are doing well.

A black bar appears on top of my enemy’s animated_sprite_2d, but it has a few characteristics:

  • Enemy is a Node2D
  • The bar most prominently appears when the camera is moving, such as when player jumps from one platform to another.
  • When the bar appears, it appears on all instances of the enemy.

Things I tried to fix this issue:

  • Exporting the project.
  • Downgrading (I have tested upto v4.4).
  • Recreating the scene minimally.

Hardware Info

CPU: Intel Core 2 Quad Q9550

GPU: Nvidia GT 740 (Proprietary Nvidia drivers)

OS: Arch Linux (X11, i3, picom)

Important assets

Test Project link.

NOTE: Test project was extracted from v4.5.1, but I am still using v4.6 Beta 2.

Which stretch-mode are you using?

Disabled.

Seeing your post, I tried the other two options, namely canvasitems and viewport. But both the settings only limited the window size to the camera, but didn’t affect the black bar at all.

Texture filter to nearest, if it’s not already?

Are you using a sprite sheet or texture Atlas ? Make sure you don’t have neighboring pixels getting UV mapped and resulting in the black bar ? You might be sampling the texels in a neighboring frame kind of thing.

Cheers !

2 Likes

Filter is already set to nearest.

I am using a sprite sheet.

Also! I managed to fix it by opening the file in aseprite normally (NOT by Import sprite sheet) and then I held Ctrl, then I dragged the whole thing upwards by 2 pixels. I saved it and now all the sprite have a vertical offset of 2 pixels by default.

Thanks!

1 Like

I have had this same issue, and I am almost certain it has to do with the animation player, not the sprite necessarily. I’ve tried to tweak this but to no avail. I am certain it has something to do with how godot renders the sprite sheet you are using when it calculates the key frames.

edit:

I’ve also found this is an issue with the sprite placement on the sprite sheet. If you are using a sheet that has sprites touching, this will cause that problem. It also happens when using animated sprites as well. My workaround was to just separate sprites better on the sheet.

1 Like