Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / My RectsOverlap Function is not working as it should?

Author
Message
Amon
9
Years of Service
User Offline
Joined: 30th May 2014
Location: Shropshire, United Kingdom
Posted: 19th Apr 2019 13:06
Does anybody have a better method for a more efficient rects overlap?

Win 10 Pro - AMD RYZEN 7 Octacore 3.8ghz - 32GB DDR4 - RTX 2070 8GB
Qube_
9
Years of Service
User Offline
Joined: 21st Oct 2014
Location: Omnipresent
Posted: 19th Apr 2019 16:43 Edited at: 19th Apr 2019 16:45
* snip * - never mind
Ranietz
AGK Gold Backer
19
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 19th Apr 2019 17:23
Something like this?

Amon
9
Years of Service
User Offline
Joined: 30th May 2014
Location: Shropshire, United Kingdom
Posted: 19th Apr 2019 17:49
Nah, it has the same problem as the last which leads me to believe that the problem is elsewhere. Basically my platform character is getting stuck in tiles sometimes when jumping, especially diagonal movement. I'll post the code here incase anyone can shed some light.






Win 10 Pro - AMD RYZEN 7 Octacore 3.8ghz - 32GB DDR4 - RTX 2070 8GB

Attachments

Login to view attachments
Qube_
9
Years of Service
User Offline
Joined: 21st Oct 2014
Location: Omnipresent
Posted: 19th Apr 2019 18:23
Isn't this because PlayerX and PlayerY are floats whereas the RectsOverlap function is checking integer rather than floats?
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 19th Apr 2019 18:29 Edited at: 19th Apr 2019 18:30
Could it be that your variables are not floats? I don't see them being defined as floats in the function.

Qube beat me to it lol
Amon
9
Years of Service
User Offline
Joined: 30th May 2014
Location: Shropshire, United Kingdom
Posted: 21st Apr 2019 05:46
The player still gets stuck on some tiles when jumping. Jumping diagonally is worse as it is guaranteed to get the player stuck in the tile.
Win 10 Pro - AMD RYZEN 7 Octacore 3.8ghz - 32GB DDR4 - RTX 2070 8GB
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 21st Apr 2019 14:52
the problem is in the while loops not the function
a better system would be to break up the top and bottom of the player so you can more easily determine the reaction


though why don't you use agk's collision system if you're just dealing with tiles?
life's one big game
spec= i5 4ghz, 16gb ram, Nvidia 1070ti gpu

Login to post a reply

Server time is: 2024-03-28 15:08:00
Your offset time is: 2024-03-28 15:08:00