Jump to content

Problem migrating to 5.1 from 4.1.1


Francisco Knebel
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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 !

Link to comment
Share on other sites

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.

Untitled.png

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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