Help with spinning platform

P

PixelTheWise

Guest
hey guys. i make to ways of moving my platfform in circles, one way with paths and the other with cos and sin. the problems came when i want to translate its movement to the player. it doesnt work
here is my code
Platt 1 Path:
Create Event:
path_start(path0,1,path_action_continue,1)
End Step:
with oPlayer
{
if place_meeting(x,y+1,other)
{
// Move him with the lift
x+=other.x-other.xprevious
y+=other.y-other.yprevious
}
}

Platt 2 Cos and Sin:
Create Event:
RADIAN = 0.017453292519943295769236907684886;

angle = 0;
angle_increment = RADIAN*2;
angle_multiplier = 2;

Step Event:
angle += angle_increment;

x += cos(angle) * angle_multiplier ;
y += sin(angle) * angle_multiplier ;

Begining step:
if (instance_exists(oPlayer)){
if (round(oPlayer.y + 18) > y) || (oPlayer.key_down){
mask_index = -1;

} else {

mask_index = sOneWay;
if (place_meeting(x, y-1, oPlayer)) {
oPlayer.hsp_carry = cos(angle) * angle_multiplier ;
oPlayer.vsp_carry = sin(angle) * angle_multiplier ;
}
}
}
if you need more information let me know. i would aprreciate some help
 
T

Taddio

Guest
You can only use other in collision or in a with(), this aint gonna work as it is
Code:
x+=other.x-other.xprevious
y+=other.y-other.yprevious
 
P

PixelTheWise

Guest
You can only use other in collision or in a with(), this aint gonna work as it is
Code:
x+=other.x-other.xprevious
y+=other.y-other.yprevious
i kind of fix this one. Now the player follow the platform but when i try to move and in on top platform it doesnt move fluid. he move and stop all the time
 
T

Taddio

Guest
Yeah, sorry, I didn't even see it was actually inside yoir with(oplayer) statement, my bad!

Did you try referencing the speed instead of the x,y positions?
Like[in oPlatform end step]
with(oPlayer){
h_spd += other.h_spd;
v_spd += other.v_spd;
}
 
P

PixelTheWise

Guest
Yeah, sorry, I didn't even see it was actually inside yoir with(oplayer) statement, my bad!

Did you try referencing the speed instead of the x,y positions?
Like[in oPlatform end step]
with(oPlayer){
h_spd += other.h_spd;
v_spd += other.v_spd;
}
how i know the v speed and h speed if im using paths?
 
E

Edwin

Guest
how i know the v speed and h speed if im using paths?
You can simulate the speed of x and y with this position calculation:
Code:
x - xprevious;
y - yprevious;
Paths are using path_speed variable, but it shows you only the speed of moving inside path. Path system don't use x and y functions/variables that show you horizontal and vertical speed of the object. hspeed, vspeed variables also don't show you them.
 
Last edited:
Top