Jump to content

Problem with sprite.frame in the update method


Moleyo
 Share

Recommended Posts

Hi,

 

This is undoubtedly a simple problem to solve as I'm relatively new to html5 and js but after researching and toying around with it I can't get it to work.

 

Basically I want to change the frame of my sprite in the update method using sprite.frame = value;

 

I've been doing this in the create method fine. player1.frame = 3; works yet in the update method player1.frame = 3; does not. It just results in a black screen when I try to load the game. I need the statement to be in the update method as the frame chosen depends on the result of certain functions carried out in update.

 

Other functions carried out in update are working fine, and player1.frame = value; works fine in the create function so I'm stumped.

 

Cheers for any help!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...