K
Kyle Rider
Guest
I have 2 platforms on the screen, the first one drawn works perfect. On the second one my player is carried the same way platform 1 is going. My head hurts, there must be an easy answer for this.
It may be that I am using a parent to control the platform and the children are just visual.
PARENT CODE
PLAYER CODE
It may be that I am using a parent to control the platform and the children are just visual.
PARENT CODE
Code:
var c1, c2
hspd = dir * spd;
x+=hspd;
//LEFT
if(dir == -1){ // if moving left
c1 = -1; // reset the collision tile checkers
c2 = -1;
c1 = tilemap_get_at_pixel(obj_Game.map, x - 60, y); // check the left edge of the sprite
c2 = tilemap_get_at_pixel(obj_Game.map,x,y); // check below the left edge of the sprite, since ghosts dont like heights
if(c1 == 9){ // if there is something blocking the left or if there would be a fall to the left
dir *= -1; // change the direction
}
}
//RIGHT
else if(dir == 1) // if moving right
{ // Otherwise, check collision to the right
c1 = -1 // reset the collision tile checkers
c2 = -1;
c1 = tilemap_get_at_pixel(obj_Game.map,x + 60,y); // check the right edge of the sprite
c2 = tilemap_get_at_pixel(obj_Game.map,x+12,y); // check below the right edge of the sprite, since ghosts dont like heights
if(c1 == 9){ // if there is something blocking the right or if there would be a fall to the right
dir *= -1; // change the direction
}
}
Code:
x=x+hor_carry;
if place_meeting( x, y-25, par_platform)
{
y = (y & ~31);
if (key_left != 0)
{
sprite_index = spr_vrun;
}
else if (key_right != 0)
{
sprite_index = spr_vrun;
}
else if (key_jump !=0)
{
jumps +=1;
sprite_index = spr_vjump;
}else sprite_index = choose(spr_vidle); // set the sprite to the idle sprite
on_board = true;
hor_carry = par_platform.hspd;
hor_pfspeed = par_platform.spd;
climbing = false; // stop any climbing
jump = false; // stop any jumping
fall = false; // stop any falling
jumps = 0;
}else hor_carry = 0; hor_pfspeed = 0;