• 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 Creating Walls that Destroy Push Crates and Themselves on Collision

L

Lee Hartsell

Guest
Hey everyone!

I'm creating a simple puzzle adventure game where you have to use various crates to obtain keys and flip switches to open doors within a maze. You also must avoid search lights and guards while solving the puzzles.

So far, I've got most features in no problem. I have some walls that certain crates will destroy, the warden's patrol the room, and they push crates they collide with as players do. The level restarts when the timer ends, or if the searchlights or guards collide with the player.

Obviously, though, I am having some problems with a key feature. I want a wall that destroys both the crate that is pushed into it, and itself.

Currently, I can get the destroyer wall to destroy both itself and the crate, but only after the player moves in the opposite direction after pushing the crate into the wall...if that makes sense. Otherwise, nothing happens save that the crate does stop at the destroyer wall.

Below is the code I used for the destroyer wall that at least destroyed both, albeit not on contract.

Code:
if (place_meeting(x + obj_player.hspd, y, obj_par_block)) {
    var block = instance_place(x + obj_player.hspd, y, obj_par_block);
    with (block) {
        instance_destroy();
    }
    instance_destroy();
}


if (place_meeting(x, y + obj_player.vspd, obj_par_block)) {
    var block = instance_place(x, y + obj_player.vspd, obj_par_block);
        with (block) {
            instance_destroy();
            }
            instance_destroy();
}
Thanks!
Lee
 
Top