Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

There's a variable state_idle which lets you change the idle behavior (what the object does when nobody is lifting it). Copy liftablestate_idle into a new script "liftablestate_idle_with_gravity", and then add some code for the gravity here (and then don't forget to update the liftables you want to have gravity when idle so they use this script for their idle state instead).

For the gravity code, the easiest would be to just check liftable_free(x,y+4) and if free, move down 4 pixels (constant speed instead of using actual gravity). If you want actual gravity, it's probably easiest to copy player_inertia_y's yspeed code and removing the "shockwave when hitting blocks" bit.

I did as you said and added constant speed if liftable_free(x,y+4) but nothing happens if I go !place_meeting(x,y-1,obj_solid_terrain) it moves and collides with the object but only with that object (as expected) so my question did I call it wrong or does the liftable_free(x,y) need something more? 

liftable_free just checks if the position is free of collisions, you also need to move the object:

if(liftable_free(x,y + 4)){
  y += 4
}

Yea that was my first guess but nothing happens.

Okay, I think I've found the cause: the liftable is colliding with itself (rather, its "idle prop") so we need a special exception for that. Something like this should work better:

var blocked = false;
with(parent_terrain){   if(place_meeting(x,y - 4,other)){     if(id != other.idleprop){       blocked = true;     }   } }
if(!blocked){   y += 4   with(idleprop){     y += 4   } }