• 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 Trying to make it so the only walls that are visible on screen are in my player's line of sight

A

AngelofGamin

Guest
however, I seem to run into a problem where all the walls are just permanently invisible when i start a room

this is the code I used:
Code:
if collision_line(x,y,obj_player.x,obj_player.y,obj_wall,1,0)
    {visible=false;}
        else
        {visible=true;}
Also, here's more or less an illustration of what I'm trying to achieve:

unknown-0.png
 
Last edited by a moderator:

Rob

Member
it looks like you're just referencing one instance of obj_wall - you need to use "id" if this code is within the step event of the wall object
 
C

Catastrophe

Guest
Your last argument should be 1 or true, not 0: You don't want want the walls to count themselves or they will always collide:

"notme Whether the calling instance, if relevant, should be excluded (true) or not (false)."

You may even have the 1,0 backwards, as I doubt you need precise collisions on walls.

@Rob I'm assuming obj_wall is just an object_index, so I think it's correct
 
Last edited by a moderator:
A

AngelofGamin

Guest
Your last argument should be 1 or true, not 0: You don't want want the walls to count themselves or they will always collide:

"notme Whether the calling instance, if relevant, should be excluded (true) or not (false)."

You may even have the 1,0 backwards, as I doubt you need precise collisions on walls.

@Rob I'm assuming obj_wall is just an object_index, so I think it's correct
you're a king.
 
Top