K
Kivelocity
Guest
For the entirety of the time I've been working on my current project, I have been having some issues the gravity, and slope collisions. The gravity of the game works fine as long as vertical speed has been increased beforehand, for example if the player jumps. If the player walks off the side of a platform, it falls down far too fast and makes platforming harder and feel strange to do. Here is the gravity code and slope code.
Gravity:
if !ground
{
vsp += 0.25;
}
Slopes:
while place_meeting(x-4, y, objSlopeLongR)
{
y-=2
ground = true;
image_angle = 23
}
while place_meeting(x-4, y, objSlopeLongL)
{
y-=2
ground = true;
image_angle = -23
}
while place_meeting(x-4, y, objSlopeR)
{
y-=2
ground = true;
image_angle = 45
if hsp <= -4
{
hsp -= 0.05
}
}
while place_meeting(x-4, y, objSlopeL)
{
y-=2
ground = true;
image_angle = -45
if hsp >= 4
{
hsp += 0.05
}
Gravity:
if !ground
{
vsp += 0.25;
}
Slopes:
while place_meeting(x-4, y, objSlopeLongR)
{
y-=2
ground = true;
image_angle = 23
}
while place_meeting(x-4, y, objSlopeLongL)
{
y-=2
ground = true;
image_angle = -23
}
while place_meeting(x-4, y, objSlopeR)
{
y-=2
ground = true;
image_angle = 45
if hsp <= -4
{
hsp -= 0.05
}
}
while place_meeting(x-4, y, objSlopeL)
{
y-=2
ground = true;
image_angle = -45
if hsp >= 4
{
hsp += 0.05
}