G

G

Create:

Code:

```
hsp=0;
vsp=0;
grav=.2;
```

Code:

```
//Get Inputs (However you want)
//if press right, hsp=2;, if press left, hsp =-2, etc...
//Apply gravity
if(vsp<10){
vsp+=grav;
}
//Horizontal Collisions
if (place_meeting(x+hsp,y,oBlock)){
//Up slope
var yplus=0;
while(place_meeting(x+hsp,y-yplus,oBlock)&&yplus<=abs(hsp)) yplus+=1; //change the abs(hsp) to 3*abs(hsp) if you want to be able to go up a 3-1 slope, etc..
if(place_meeting(x+hsp,y-yplus,oBlock)){
while(!place_meeting(x+sign(hsp),y,oBlock)) x += sign(hsp);
hsp=0;
}else{
y-=yplus;
}
}
x += hsp;
//Down slope
if !place_meeting(x,y,oBlock) && vsp >= 0 && place_meeting(x,y+2+abs(hsp),oBlock){
while(!place_meeting(x,y+1,oBlock)) y += 1;
}
//Vertical Collisions
if (place_meeting(x,y+vsp,oBlock)){
while(!place_meeting(x,y+sign(vsp),oBlock)) y += sign(vsp);
vsp=0;
}
y+=vsp;
```

Here is a good link for some common methods.