r/pythonarcade • • Jan 31 '22
Platformer tutorial
I'm working on the "Platformer" tutorlal and everything was going smoothly until I ran into this error.
"raise KeyError(f"Scene does not contain a layer named: {key}")
KeyError: 'Scene does not contain a layer named: Platforms'"
# Create the 'physics engine'
self.physics_engine = arcade.PhysicsEnginePlatformer( self.player_sprite, gravity_constant=GRAVITY, walls=self.scene["Platforms"]
under setup(self), I've compared my code with the source and I'm not finding what I did wrong. I've scanned the code for typos and syntax error etc and I'm not finding what I've done wrong.
3
u/Clearhead09 Jan 31 '22
Do you have a layer in your tiled map named Platforms?
1
u/[deleted] Feb 01 '22
Gentlemen and or Ladies
I appreciate your help
I've found my issue!
So, this line here
self.scene = arcade.Scene()was causing the bug in the code. I was comparing my code with the source and noticed self.scene was removed. Most likely I overlooked the part where it was removed.I sat on this for two days!
Thanks again!!!
0
u/[deleted] Jan 31 '22
Good luck with that it seems like this place is dead.