rhennig Posted March 22, 2017 Share Posted March 22, 2017 Hello guys, I'm making a simple infinity runner and, sometimes, after the player falls in a hole and the game is restarted, platforms dont are created anymore. The group seems to dont restart correctly (Cannot read property 'body' of null) and I'm not sure how I can fix this. To test you can simply fall on the first hole and restart the game. Link is below and thanks for any help! http://funs2.com/funs2/games/pliniosrevenge/ Link to comment Share on other sites More sharing options...
samme Posted March 22, 2017 Share Posted March 22, 2017 platforms.getFirstAlive() will be null if none are alive. Quote if(((this.world.right-this.platforms.getFirstAlive().body.right)>200)&&(this.resp)) rhennig 1 Link to comment Share on other sites More sharing options...
rhennig Posted March 22, 2017 Author Share Posted March 22, 2017 ok, thanks for your answer, but why the game works fine on the first time and doesn't work after the game is restarted? (I've tryed to destroy/kill/clear the platform group on shutdown with no success) I'm not figuring out how I can simply make the game work at the same way after the state is restarted... some tip? Link to comment Share on other sites More sharing options...
rhennig Posted March 24, 2017 Author Share Posted March 24, 2017 Sorry for asking again, but I'm really stucked on this problem... as the bug never occurs on the first run... is there not a way to make the game work at the same way after the state is restarted? some tip? Link to comment Share on other sites More sharing options...
samme Posted March 25, 2017 Share Posted March 25, 2017 I'm not really sure. Usually restarting the state takes care of it, but there's something about those platforms. Link to comment Share on other sites More sharing options...
Recommended Posts