[Mkl]Those damn slopes!

Posted by Moikle on Feb. 17, 2012, 4:44 p.m.

Sup 64 digits, I am doing stuff.

I have finally decided to get off my arse and continue working on this project I have been stuck on for 2 weeks.

A while ago, back when I did a lot of GM stuff, I would have had this done in a day or two, but for the fact that I haven’t really done any engine stuff with it for a very long time, (only experiments and cool visual things), coupled with how my perfectionism level has raised significantly since then- meaning I will not accept any of the crappy solutions I may have come up with a year or more ago.

I am working on a platform engine which has pretty much all of the features I can see myself needing (although starting off with the basics of course). So far I have got the ability to play the game with either a keyboard or an xbox360 controller (and have also set it up so that adding local multiplayer should be easy) which is something I have never done in GM before, but I am rather happy with the result.

The problem however is slopes, the bane of every GMnoob (which I do not consider myself). I have created several platformer engines before that support slopes, but none that will support the current model.

I have got to a point where I do not understand where I have gone wrong, so here I am, asking for help on something quite simple.

Here is a link to the file, all of the problems are in the step event, highlighted…

//VVVVVVVVVVVVVVVVVVVVVVVVVVV

…like this

//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

It is GM8.1 but I don’t know how to use LateralGM so sorry if you don’t have 8.1 :(

You can press enter to change control scheme

Keyboard:

Left/right arrows - move

X - jump

controller:

left stick - move

A - jump

Oh, and i just found another problem, the game starts off with extreme lag. this seems to fix itself if you attach a controller, and then disconnect it. even if you don't change the control scheme. I have no idea why…

Comments

Moikle 13 years ago

oh great! my skype name is redmoikle

@rob yeah, just saw that XD

now it jumps up a few steps then stops

JuurianChi 13 years ago

Math, it's magic.

Cesque's method works too.

Rob 13 years ago

Actually your whole for loop system is fucked. You should seriously do it in reverse.

Let's say that your xspeed is 10. What you're doing is moving 10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1. Try looping through in reverse instead. And then exit the loop once you've moved.

Moikle 13 years ago

Just looking back at it I realized how blind I must be to have missed that, I don't even know what I was trying to achieve like that…