L
Luka Radulovic
Guest
I've tried using my normal method of gravity and vertical collision and making it work for anti-gravity, or in other words, falling upwards and not downwards.
This is just a basic Create Event, don't think there's much to explain here.
The logic seems fine to me, but I may be overlooking something easy. When the object falls (upwards) towards the oWall object, it falls one pixel more into the oWall object. The jumping works how it's supposed to work. Everything is alright except that one pixel in the oWall object.
Any help will be appriciated, thank you.
Code:
// Create Event
vsp = 0;
grv = 0.1;
jumpsp = -2;
// jump_delay used for staying on the ground 50 frames before jumping again
jump_delay = 50;
Code:
vsp += grv;
if (place_meeting(x, y-vsp, oWall)) {
// this is where I think the problem arises
while (!place_meeting(x, y-sign(vsp), oWall)) {
y -= sign(vsp);
}
vsp = 0;
// code below is for jumping after only 50 frames
jump_delay--;
if (jump_delay == 0) {
vsp = jumpsp;
jump_delay = 50;
}
}
y -= vsp;
Any help will be appriciated, thank you.