![]() |
Platforming and slopes
Anyone have any suggestions on how to accomplish this? I've tried checking for slope tiles ahead of movement, and incrementing the player.y accordingly(if a 45 degree angle, increment player.y the same as speed, if a 22.5 degree angle, half the speed)... but that's proved unreliable, especially at speeds not divisible by .25. Not only that, but it's not a solid detection(for instance, if the player falls on a slope, nothing would happen).
Right now I'm using NPC's and simply using testnpc(since an NPC inherits the shape of the image) to 'stick' the player onto the slope of the NPC in pixel precision, but this is also proving unreliable at higher speeds. |
I had something where the world was represented as lines stored in arrays instead of tiles, it handeled slopes easily and perfectly (Just draw a collision mask over the level).
There's tons of examples of line intersection algorithms online, then just find the line you hit's normal and you can work off that. Alternatively you could just as easily automatically convert the tiles into lines for collision. |
Quote:
|
Quote:
Only reason I did it manually was because I liked the control.. It added a bit more depth to have the player moving like, a tad up and down on a surface that's actually a flat tile. If you show a tile layer above the player's feet it would look really nice like that, once V6 comes out. |
Quote:
|
Quote:
|
Well I'm talking about using lines as a base for collision detection
|
So am I. It's only around 10-15 lines maximum that are being tested against each frame. It's not a lot.
|
Well then :)
|
Hmm... well I was hoping for something a little less complicated. I really wish there was a nice open-source platformer with good code and physics, since just about every free platformer out there sucks ass.
If I can manage the line intersection that'd be cool, but it'd be automatic(every time you enter the level). Kai did once post a script that translated all walls into an array of lines, along with the ability to detect collisions. What does worry me is that I'd want this to be able to work flawlessly on a gmap, and processing that when player enters a new level would possibly cause a slight hang-up. I should also mention this would be in GS1. |
Hmm, this is what I currently came up with:
PHP Code:
|
| All times are GMT +2. The time now is 05:41 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.