GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Help using light as an obstacle

I've read through a lot of the tutorials on this site, and they've all been extremely helpful with getting me up to speed on GameSalad. I'm still building my first prototype, but the game I'm making is a stealth platformer where each level takes place in a dark hallway and uses the light from ceiling lamps as an obstacle. To progress, you find the light's matching switch and turn it off. If you don't and you walk into the light, it's an instant level restart.

I've made the mechanic work to where I can "turn the ceiling lamp off" and change the image from a lit lamp to an unlit lamp, but I need help making the light itself. Is there a lighting tool I could use or a way to manipulate an specialized "Light" actor to work like this? I'm having trouble figuring out where to start.

Thank you!

Comments

  • tiger27tiger27 Posts: 127Member
    edited June 2015

    @Cllezark You would have to create a new actor called light; you will also need a boolean attribute titled "LampOn?". Then put in this simple code:

    In the Lamp:

    If attribute Game.LampOn? is true
    
    Spawn Actor Light
    in the direction 0 relative to actor
    in the position (whatever x and y you need)
    

    In the Light:

    If attribute Game.LampOn? is false
    
    destroy this actor
    

    Hope this helps.

  • GnarlyGnarly canadaPosts: 840Member

    If there is an example you have seen that would be helpful. I know of no light tool.

    Does the light move? Flicker? Some transparency. Shouldn't be too hard.... But maybe an example to show what you want...

  • CllezarkCllezark Posts: 2Member

    Thank you for all the help! I think I got it down now.

Sign In or Register to comment.