tobymcfly Posted June 11, 2018 Share Posted June 11, 2018 Hey, i'm making a game where you can pick up a box and free a chicken if u got the right key. The problem is, that my game crashes everytime i try to free any chickens from the boxes: I'm using prototype states. Here is my code: Link to comment Share on other sites More sharing options...
rich Posted June 11, 2018 Share Posted June 11, 2018 Scope, scope, scope, scope. Your function scope is wrong. Where-ever you are calling "freeChicken2" from, the scope inside of it doesn't match the State, which is why "this.game" doesn't work. tobymcfly 1 Link to comment Share on other sites More sharing options...
tobymcfly Posted June 11, 2018 Author Share Posted June 11, 2018 Hi. I switched out "This.game.add" with "SpaceChicken.game.add" and now it works. My assets and animations are really bugged tho Don't really know why it worked though? Link to comment Share on other sites More sharing options...
Recommended Posts