Jump to content

Problem with hero and tiles when not moving


totallybueno
 Share

Recommended Posts

 

Hi there, guys, I have a question about arcade physics (I guess I´m missing something...)
 
[9:09] 
I´m having a problem with my hero colliding with the tilemap. Everything works perfectly except if the hero is standing, then the collide simply "doesn´t happen", if the hero runs, she collides but if she´s standing on a platform (hero speed = 0 and platform speed = whatever) nothing happens.
 
 
See attached gif for a better explanation
 
 

 

 

collide.gif

Link to comment
Share on other sites

Those graphics look great!

How are you "sticking" the player on the platform? It's true, arcade collisions don't work if the velocity of a thing is 0. I'm less familiar with moving platforms, though, so I'm wondering if there's something there to look at.

Link to comment
Share on other sites

So I'm guessing you have something like this one here:

https://jsfiddle.net/ya22nbdr/

And my solution to it:

https://jsfiddle.net/ya22nbdr/1/

I think this is not really a bug as the collision gets triggered but the platform stuff overrides the wall physics, because I don't use arcade to move the platform with body.velocity but I used the sprite.x instead.

 

Link to comment
Share on other sites

18 hours ago, drhayes said:

Those graphics look great!

How are you "sticking" the player on the platform? It's true, arcade collisions don't work if the velocity of a thing is 0. I'm less familiar with moving platforms, though, so I'm wondering if there's something there to look at.

Thanks, but well, I´m not making the graphics, I bought the tileset and hired an artist to make a few sprites, anyway, I´ll tell him that :)

Those two elements are attached with arcade physics, obviously both of them enabled and then just a simple this.game. physics.arcade.collide(element1, element2). Arcade physics does the magic, I do nothing :)

And yes, I guess like the player´s velocity is 0, there´s no collision, so probably I´m gonna try with the overlap instead, someone gave that point yesterday in the slack channel.

 

Thanks for your answer.

Link to comment
Share on other sites

17 hours ago, symof said:

So I'm guessing you have something like this one here:

https://jsfiddle.net/ya22nbdr/

And my solution to it:

https://jsfiddle.net/ya22nbdr/1/

I think this is not really a bug as the collision gets triggered but the platform stuff overrides the wall physics, because I don't use arcade to move the platform with body.velocity but I used the sprite.x instead.

 

This is exactly what I need, thanks for your time (and code) :D

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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