M
MarkyzZz
Guest
Hi. I need some help on solving this one. I've made an ideal pendulum which moves in a semi-circular way . It works fine, but the problem is that when I (or the Player) am on this platform-shaped pendulum, at some moments, i am unable to jump. Sometimes the player just slips into the object and falls down through it.I made the platform to be the child of the GROUND object, that way it should make the collision similar as if the player collided with the ground, with certain exceptions. But it seems i am wrong.
Here's the code:
Here's the code:
Platform Step Event
And here's the code for collision with Walls/Ground in the Player Step Event
Code:
angle+=(pendulum_frequency*state);
if(angle>180){
angle=0;
state=-1;
}
if(angle<-180){
angle=0;
state=1;
}
position_x=pendulum_amplitude*sin(degtorad(angle));
position_y=pendulum_amplitude*cos(degtorad(angle));
x= x-position_x;
y= y+position_y;
if(place_meeting(x,y,obj_Player)){
with(obj_Player){
x= x+obj_Pendulum.position_x;
y= y+obj_Pendulum.position_x;
}
}
Code:
//Collision to the walls
// Vertical
repeat(abs(vsp)) {
if (!place_meeting(x, y + sign(vsp), obj_Ground))
y += sign(vsp);
else {
vsp = 0;
break;
}
}
// Horizontal
repeat(abs(hsp)) {
// Move up slope
if (place_meeting(x + sign(hsp), y, obj_Ground) && place_meeting(x + sign(hsp), y - 1, obj_Ground) && !place_meeting(x + sign(hsp), y - 2, obj_Ground))
y -= 2;
else if (place_meeting(x + sign(hsp), y, obj_Ground) && !place_meeting(x + sign(hsp), y - 1, obj_Ground))
--y;
// Move down slope
if (!place_meeting(x + sign(hsp), y, obj_Ground) && !place_meeting(x + sign(hsp), y + 1, obj_Ground) && !place_meeting(x + sign(hsp), y + 2, obj_Ground) && place_meeting(x + sign(hsp), y + 3, obj_Ground))
y += 2;
else if (!place_meeting(x + sign(hsp), y, obj_Ground) && !place_meeting(x + sign(hsp), y + 1, obj_Ground) && place_meeting(x + sign(hsp), y + 2, obj_Ground))
++y;
if (!place_meeting(x + sign(hsp), y, obj_Ground))
x += sign(hsp);
else {
hsp = 0;
break;
}
}