Collision help

I’ve been trying to make the jump function and make sure that hitting the side of the block stops it from moving, but the block won’t jump and does weird stuff hitting the side of a block. can someone help? (when editing blocks, make sure to edit one block, delete the other, and replace the deleted one with the edited one, if that made any sense)

my perfect collision7-9-2020_7-25-09PM.wick (2.5 KB)

and as far as copies go, they also do weird things. i might have to just remake the code differently, make sure i don’t hardcode anything, and see if that works.

mojad answered this question in another topic. Here:
add this code (you may change it if your wall is in a different axis)
if(this.hitTest(wall1) ) {
this.x -=10; // stop moving right
}
-credit to @mojad

acually i got that code from greg

oh. THE CIRCLE OF ATTRIBUTION

I’m looking for a more “perfect collision” like Revon’s. I made a ghost player thing that figures out where the player will go. Here’s kind of what I do.

  1. set everything to be still.
  2. because of gravity and movement, the ghost player is somewhere near the player, planning the next location of the player
  3. if the ghost collides with something, do something about it (this is what I need help with) and adjust the ghost player
  4. move the player to the same location as the ghost
  5. repeat starting at step 2

@awc95014, I tried editing your game and this is as far as I got: awc perfect collision.wick (4.2 KB)

There is somewhat a perfect collision, but it lags sometimes to the point that the ghost player would have a more perfect collision than the actual player, especially with the blocks that I copy pasted from the original. I’ve seen @Revon’s perfect collision before, so I’d be guessing he’d be a greater help in this project.

Thanks for your help :slight_smile: I think it’s getting closer, I’ll see if I can get it to work the way I hope.

1 Like