Growler Posted May 11, 2019 Share Posted May 11, 2019 In MelonJS 5.1, after I load the level and the player entity, I set the player's position somewhere else (testing positioning) via: this.pos.x = 1000; this.pos.y = 1000; For some reason, melon fades the screen out to white, re-renders the entire environment (it seems), and the player entity doesn't appear. I also get error: Uncaught TypeError: Cannot read property 'flipX' of undefined Which is complaining at line this.renderable.flipX(...) So it would appear the renderable is removed from the player entity. Moreover, other screen entities also appear to be destroyed, as I have logs in each entity's onDestroyEvent. All entities appear to be destroyed on a simple positioning of the player entity. Update: I tested logging the renderable and body property objects on the player entity before and after setting the position. Before, the renderable and body are both defined correctly according to the docs. After, both renderable and body are both undefined, yet the entity class is still instantiated. Question: Why is the entity or entity's renderable removed and why does the screen fade out on a simple entity repositioning? Note: I do not have a player entity object directly added to the Tiled map. Instead, I have a "spawn entity" object where I place at the position of where the player entity should ultimately be instantiated at a certain point in the game. I also have alwaysUpdate = true on the player entity. @obiot Quote Link to comment Share on other sites More sharing options...
Growler Posted May 14, 2019 Author Share Posted May 14, 2019 @obiot Any thoughts on that? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.