GM:S 1.4 Creating Walls that Destroy Push Crates and Themselves on Collision

Discussion in 'Programming' started by Lee Hartsell, Apr 27, 2017.

  1. Lee Hartsell

    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.

    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) {
    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) {
  2. Simon Gust

    Simon Gust Member

    Nov 15, 2016
    Can you tell me what happens when you, instead of + use - in the place_meeting functions?

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice