OK.... Before you all unanimously shout "NOOB!" I have never made a platformer so therefore needed a CPM. I have got a basic engine set-up now (jumping and left/right) but i cannot for the life of me get slopes working properly. i have got four detectors (top left bottom right) which can be set to any height/length if needed. I have had slopes working a little bit but it is nowhere near as smooth as i would like it to be. Any suggestions as to what I should do??? If slopes are a problem with custom engines i will just have t oscrap them but the way i see it someone MUST know how to create a smooth method. Please help.
20th June, 2007 at 14:02:40 -
A simple way would be to have two detectors on either side, at the bottom, then move the guy up if you're moving in a direction and the detector on that side is overlapping something but the detector on the other side isn't.
I used to make the main mask (or whatever you used for collisions) move up if it's in the ground and down if it's in the air. This worked quite well for ramps, so long as you turn it off when you're not jumping or falling. It interferes with the jump height.
Thank you Phizzy. I dont remember you sending me an engine with slopes in but will look again. I will tray and implement this code later and let you know how it is going. I have posted a preview of the game (http://www.create-games.com/preview.asp?id=2879 ) if you would like to see how it is coming along.
you can still do slopes with the detectorless, 1-pixel fastloop push method. It's just a slightly more complex process.
Ordinarily, the object would use fastloops to move 1 pixel at a time, and if it detects a backdrop on its loop (in this case, the horizontal loop), it moves one pixel back and ceases movement.
To detect slopes, you instead have it, when detecting a backdrop, move one pixel up and check again. If there's nothing there, it remains, and will continue moving. If it detects backdrop, though, you move it one pixel back and one pixel down, and stop it. And that'll allow for up to 45° slopes, which is generally good enough.
Yeah, I've been using a detectorless fastloop-less movement for my latest project (Bonesaw: The Game) and I've gotten really good results. The platform engine is just applied to Group.0, and then all the enemies and the player are just in that group, so everything obeys the same platform engine that I only had to code once.
Down the road I want to refine the engine and add slopes and some other things, and really get it working perfectly. Thanks a lot for the example, it'll definitely help me out ;D