+ 4

4 Way Collision

How can I test to see whether the player is touching the bottom, top, left or right of the platform? Each side will have a different reaction. https://code.sololearn.com/WSC3JL587LQ2/?ref=app

25th Jun 2019, 2:45 PM
Clueless Coder
Clueless Coder - avatar
14 Antworten
+ 5
I really can’t help, but maybe this code of mine is helpful? It also handles collisions on 4 sides of a block... https://code.sololearn.com/WM2x10n1vy1A/?ref=app
25th Jun 2019, 6:57 PM
marjel101
marjel101 - avatar
+ 5
☕__JavaScripter__💐 i hope so too, good luck 🌹🌹
25th Jun 2019, 7:03 PM
marjel101
marjel101 - avatar
+ 5
marjel101 Does the variable "x0" and "yO" reference the square on your code?
26th Jun 2019, 5:55 PM
Clueless Coder
Clueless Coder - avatar
+ 4
☕__JavaScripter__💐 yes, these are used in the collision detection between blocks and circles. I found the function in the p5.collide2D library.
26th Jun 2019, 6:36 PM
marjel101
marjel101 - avatar
+ 3
marjel101 Interesting, I tried p5.collide2D with InvBoy's Node.js library but I couldn't find anything like that on GitHub. I wonder if there is an alternative for collideRectRect() which checks sides and widths of the object?
26th Jun 2019, 6:40 PM
Clueless Coder
Clueless Coder - avatar
26th Jun 2019, 6:47 PM
marjel101
marjel101 - avatar
+ 2
marjel101 Thanks for the reply. I don't understand collision in the code at all, but thanks anyway. I have asked Coder to see if he can help.
25th Jun 2019, 7:00 PM
Clueless Coder
Clueless Coder - avatar
+ 2
Concept: have the platforms break up into 4 lines and detect collisions with the point edges of the box Implementing this takes a bit of time (for me to test) Source: http://www.jeffreythompson.org/collision-detection/line-point.php
26th Jun 2019, 10:43 AM
CodeMStr
CodeMStr - avatar
+ 2
Coder It's probably an easy solve Again. But I can't get the top collision to respond again https://code.sololearn.com/WjuHV2FIB48r/?ref=app
8th Jul 2019, 6:27 AM
Clueless Coder
Clueless Coder - avatar
+ 2
Coder The character can't jump when it hits the top of the platform. Also, when I did debugging using the console, I found out that top and bottom are reversed.
8th Jul 2019, 6:32 AM
Clueless Coder
Clueless Coder - avatar