The only time I am able to program slopes that actually work are for
a. Enemys that only move left or right
b.game without accel/deccel
The game I am making is way beyond those, so i need some slope relatd help.
here are the codes(not all, just what you might want to look at)
1-Gravity
if not collision_rectangle(x-4,y-1,x+4,y-1,obj_block,1,1) and not
collision_rectangle(x-8,y-1,x+6,y-1,obj_slope,1,1) and air = 0
if vspeed < 0.01
gravity = 0.55
if not collision_rectangle(x-4,y-1,x+4,y-1,obj_block,1,1) and not
collision_rectangle(x-8,y-1,x+6,y-1,obj_slope,1,1) and air = 0
if vspeed > 0
gravity = 1.5
2-Coll. with slope
y-=hspeed/2
3-Movement(left and right are bassically the same)
if keyboard_check(vk_left) and not collision_rectangle(x-6,y-8,x-6,y-8,obj_block,1,1) and gp = 0
{
if vspeed = 0
image_xscale = -1
hspeed-=0.3if hspeed > -0.01
skid+=1
}
the problems i am having are
*when i go down the slope, i get stuck about 2 pixels in the ground, dissabling my movement
*sometimes, i fall through while walking on it
*jumping on it goes through
Finally, here is the engines - jump
s on wall in air - wall jump
down - ground pound
Attached File ( Number of downloads: 4 )
SMB.exe