Francisco Knebel Posted February 6, 2018 Share Posted February 6, 2018 Ok, i'll go straight to the point. I have a small implementation of the Space Invaders tutorial, with a bit of extra stuff added in there. I'm updating all my dependencies, since the repo is over a year old, and of course, updating MelonJS too. I found some problems, and after a couple of hours debugging, I couldn't find anything to solve it. The enemy manager container isn't working as intended, the screen objects are not positioned as expected, it's a mess. To build with each version, just change the file version on lib/melonjs.js and run grunt dev. Repo, on the working branch: https://github.com/FranciscoKnebel/spaceinvader/tree/greenkeeper/initial I created an imgur album with some examples: https://imgur.com/a/OkQnD. I've read all CHANGELOG and the migration guide, but I found nothing that points to this. Thanks for reading. Quote Link to comment Share on other sites More sharing options...
obiot Posted February 7, 2018 Share Posted February 7, 2018 Hi, thanks for the feedback ! through the 5.x releases, lots of effort have been made in fixing and better implementing anchor points for all renderable, and what you see is probably related to it. As since version 5.0 at least, the default Anchor Point (center of object) should properly be applied everywhere (including bounding box, transform, etc...) So long story short, if you set the container anchor point to [0,0], it should restore the previous behaviour (easier that changing everything to accommodate with the new center). let me know, Olivier. NOTE : and indeed this should be better clarified/mentioned in the migration guide ! Quote Link to comment Share on other sites More sharing options...
Francisco Knebel Posted February 7, 2018 Author Share Posted February 7, 2018 Thanks for the quick answer! I looked at the documentation and adding anchor point (0,0) worked as expected. Just had to add it to both the start menu and the enemy container. I'll look into updating the tutorial repository and the corresponding documentation. EDIT: upon further inspection, it's not _exactly_ the same. Anchoring to 0,0 is making the container fix to the correct location, but the container is moving faster than the child components, both on the x and y axis, so we get results as the image I added. The game logic still works, as in child bounds still are respected when reaching the corner of the screen, so the container moves outside the viewport. 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.