PyDew-Valley icon indicating copy to clipboard operation
PyDew-Valley copied to clipboard

Index out of range

Open midna666 opened this issue 2 years ago • 5 comments

Hey,

thank you for this amazing guide , i am following you to learn Pygame

i tried your code and faced the below issue can you please help here ? I see someone else had trouble with this but the issue was closed with no solution for us other coders to see.

Traceback (most recent call last): File "d:\Pygame\Survival\code\main.py", line 25, in game = Game() File "d:\Pygame\Survival\code\main.py", line 11, in init self.level = Level() File "d:\Pygame\Survival\code\level.py", line 14, in init self.setup() File "d:\Pygame\Survival\code\level.py", line 17, in setup self.player = Player((640,360), self.all_sprites) File "d:\Pygame\Survival\code\player.py", line 14, in init self.image = self.animations[self.status][self.frame_index] IndexError: list index out of range

i didnt change anything , just run your code

midna666 avatar Apr 05 '23 07:04 midna666

I get the same problem and can't figure out where the problem is

Arfaller0523 avatar Apr 05 '23 07:04 Arfaller0523

Hi, the asset pack has changed since this code/tutorial has been done. Now Characters animations are not in separate folders anymore, so import_assets() function doesn't collect any image and self.animations dictionary contains no images just empty arrays.

Pin-ball avatar Apr 10 '23 15:04 Pin-ball

Hi, the asset pack has changed since this code/tutorial has been done. Now Characters animations are not in separate folders anymore, so import_assets() function doesn't collect any image and self.animations dictionary contains no images just empty arrays.

Thanks alot, hope you have a good day!

Arfaller0523 avatar Apr 10 '23 15:04 Arfaller0523

@Pin-ball This is incorrect.

@Arfaller0523 @midna666 The code runs fine. Please make sure to cd into the 'code' directory before you run main.py

spyridonpallis avatar Apr 16 '23 01:04 spyridonpallis

@spyridonpallis when i run my code it shows a black output screen hows ur code running fine?

tiarakabra avatar Mar 09 '24 10:03 tiarakabra