Receiving odd errors for sprites in the debugger

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By vybr
:warning: Old Version Published before Godot 3 was released.

I seem to get the error “Index p_frame out of size (vframes * hframes)” whenever an enemy dies in my game (they are removed using queue_free). It’s somehow caused by calling set_frame in a 2d sprite object.

The weird thing is none of my enemies use a sprite2d object object, they all use AnimatedSprite2D. I commented out all “set_frame” calls in every script in my project yet I still get this error. I used a file searcher so I definitely didn’t miss anything.

There is also no stack trace for the error.

Is anyone else experiencing this issue?

I’m not used to AnimatedSprite but the error suggest that you are trying to access to a frame that does not exist, like if it have 5 frames and is trying to get the 6th.

Maybe the wrong frame was set on the inspector or the animation/spriteframe is broken.

Check the remote inspector while playing, add breakpoints to check frame values.

eons | 2017-04-26 21:42

:bust_in_silhouette: Reply From: Bot.13

I had the same error fixed it just now. Had an animation player messing with some frames that were not there. I would look for AnimationPlayer or .set_frame.
I wish you the best of luck it’s a “hard to find where the problem is kind of error”.

Kind regards,
Bot.13

:bust_in_silhouette: Reply From: Wolf6Dev

I just fixed it right in this moment. Check your animation’s frames. My “Idle” animation was following: 1, 1, 2, 3, 4, 5, 6, etc.

I fixed it correcting the first frame to 0. Running clean now.

Also, check the debugger the see when the messages appear. In my case, that was right in the moment my character touched the ground, so, during the change from “Jump” to “Idle” scene. Probably, in the first frame, as It proved true.

Hope it helps!