Francisco Knebel

Problem migrating to 5.1 from 4.1.1

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.

Share this post


Link to post
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 !

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.