Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

208
Views
Phaser Animation isn't working and freezing my game, frames from sprite sheet don't seem to load

I'm trying to have an eight-frame walking animation of a character in my game.

This is the code that loads the sprite sheet:

this.load.spritesheet('PeefSide', "assets/PeefSide.png", {frameWidth: 50, frameHeight: 
60, startFrame: 0, endFrame: 7});

This is the code that creates the sprite:

this.p1 = this.physics.add.sprite(500, 730, 'PeefSide');

This is the code that creates the animation:

this.anims.create({
        key: 'walk',
        frames: this.anims.generateFrameNumbers('peefSide', { start: 0, end: 7, first: 0}),
        frameRate: 10,
        repeat: -1
    });

And this is the code that plays the animation when the character moves:

if(this.keyA.isDown) {
        this.p1.setVelocityX(-200);
        this.p1.anims.play('walk', true);
    }

I'm not sure what I've done wrong, but when I run the game, it freezes when I press a move button. The inspection screen says that the error is trying to read properties of undefined and before the error occurs, it says:

generateFrameNumbers: Frame 0 missing from texture: peefSide

It repeats this line for every frame, the number going up one, then the game freezing error happens when a move button is pressed. Really not sure what went wrong.

If it helps find an answer, I'm using Phaser 3 in VSCode employing arcade physics.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The problem is, that the key used in this.anims.generateFrameNumbers('peefSide',...), doesn't match the actual key from the load this.load.spritesheet('PeefSide',...), because the key is case-sensitive.

You would have to use the UpperCase 'P' like this this.anims.generateFrameNumbers('PeefSide',...)

This should fix the Warning:

generateFrameNumbers: Frame 0 missing from texture: peefSide

And this will also solve the freezing issue, because now the animation will be actually playing, before because it culdn't find the frames, it showed the initial frame.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!