• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Q:Solid

Z

zendraw

Guest
so i have object1 which is checked as solid, and object2 which is not.
when object2 collides with objeect1, it runs this code
Code:
if (image_alpha)
{
    with (other)
    {
        if (place_free(x+sign(other.hspeed), y)) {x+=sign(other.hspeed)};
        if (place_free(x, y+sign(other.vspeed))) {y+=sign(other.vspeed)};
    }
}
in other words it makes it move 1 pixel every frame while in collision event. but for some reason object2 stops, and object1 doesnt move. this code works only when i uncheck object1 as solid.

also, another example.
object1 is solid, object2 is not.
object1 has this code
if (place_free(x+image_xscale*4, y)) {x+=image_xscale*4}
but when it collides with object2 it doesnt move.

why the hell is it doing this? where is the logic in this? and how can one go around this without having to create a net with parents and multiple place_meeting checks? yoyo, BIG fail.
 

NicoFIDI

Member
The place you ask it's not free if the object you are moving it's there.
In other words, the block you are trying to move prevents him from moving.
Try make It not solid before you check and solid after the check :3
 

NicoFIDI

Member
your code looks like this?...
Code:
if (image_alpha)
{
    with (other)
    {
        object_set_solid(object_id, false);
        if (place_free(x+sign(other.hspeed), y)) {x+=sign(other.hspeed)};
        if (place_free(x, y+sign(other.vspeed))) {y+=sign(other.vspeed)};
        object_set_solid(object_id, true);
    }
}
 
Last edited:
Z

zendraw

Guest
no i set the inbuild var solid. will thry this way also later

altho are you sure it will work with the other case i presented?
 

NicoFIDI

Member
The thing with the image_scale it's that you should flip the image to move it backwards, if you have a reason to do that then i dont se why It wouldnt work.
It's a number after all.
It have some behaviour behind, but still a number.
 
Top