Checking Instance Position Problem

Discussion in 'Programming' started by buhalda, Apr 1, 2017.

  1. buhalda

    buhalda Guest

    Instead of changing each individual wall, I made a code in the create event:

    depth = -y;
    image_speed = 0;

    if instance_place(16,0,obj_wall_template) && instance_place(-16,0,obj_wall_template)
    {
    image_index = 0;
    }

    if instance_place(16,0,obj_wall_template) && instance_place(0,-16,obj_wall_template)
    {
    image_index = 1;
    }
    and so on...
    Each wall is centered at 8,32 (size is 16x32) at the bottom. I want the code to check if there is a wall for example below 16 of it, and to the right 16 of it, and if those conditions are met, make the image changes so that its an L shaped wall instead of a straight one. But for some reason it doesn't do it. Not very sure which code to use, I've tried a few kinds, none worked. Help, am I using the wrong code? I'm bad at position checking...
    cd2.PNG
     
  2. TheBroman90

    TheBroman90 Member

    Joined:
    Jun 20, 2016
    Posts:
    367
    instance_place is used for getting an id from an instance. I think you should use place_meeting instead.
     
  3. buhalda

    buhalda Guest

    OK it works but with place_meeting instead, also I thought it was relative, apparently you have to put x+ before it
     
    Last edited by a moderator: Apr 2, 2017

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