thefootballguy

Problems with Stackable Immovable and Moveable Blocks Codepen inside

Recommended Posts

CODE PEN: http://codepen.io/thefootballdaddy/pen/GjKvYE

I have been trying to fix this problem for days any help will greatly be appreciated. The problems I am having is:

A: The collisions between objects are in the Moveable group are falling on top of one another.

By pressing The '1' key a few times you can see that collectable group collides and stack but they will sink to one another after 2-3 stacks.

Looked around HTML5 and old post on the fourm but the solution wasn't found.

B. The collisions between immovable objects are not colliding with each other and are occupying the same place.

Using immovable objects by pressing 3  a few times creates the immovable white blocks but they won't stack.

Again thanks for reading my post.

Share this post


Link to post
Share on other sites

Here's another forum post that describes your same problem as well:

Have you tried using the P2 physics instead of the Arcade physics?

I also noticed that the problem wasn't "as bad" if I moved the character a bit while spawning the collectables. If they were offset slightly on the x-axis instead of directly on top of each other, they stacked better. This is just an observation, but it leads me to believe it could be some sort of math error in the physics implementation.

Another thing mentioned in that link I included was the possibility of calling the game.physics.collide() call(s) more than once per frame. It did seem to help the problem a little, but as mentioned there, this would certainly be a BAD THING to do. So don't do that for a serious fix, but you can check it out.

Share this post


Link to post
Share on other sites
9 hours ago, thefootballguy said:

Using immovable objects by pressing 3  a few times creates the immovable white blocks but they won't stack.

I think those blocks are all being created in the same place.

Share this post


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

  • Recently Browsing   0 members

    No registered users viewing this page.