GameSalad

Howdy, Stranger!

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

A little help with some switches

So i plan on have switches in my second game that i am trying to finish. So just to get an idea. There will be a switch in one room, that will open a door in another. Now I know to use a boolean to control that. My question is what about when there are multiple switches on one level?

I dont have code to screenshot, but like i said i understand how to activate one.

Game lvl att
Boolean: switchactive false

Switch actor
When switch is touched, change att switchactive to true

Door actor
If switchactive is true open door.

Now what if there are more switches. Do I have to have more game lvl attributes? like switchactive 2, 3, 4, etc...

I plan on having no more than 6 switches on some levels. Thanks for any help or suggestions

Comments

  • jamie_cjamie_c ImagineLabs.rocks Posts: 5,548Member

    You could use multiple Game Level Attributes, one for each door/switch combination or you might consider building a Table to keep track of which doors should be locked/unlocked.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member

    I never use booleans. I always just step integers. This give me more flexibility going forward and also gives me a neutral state if I want it. Plus you avoid the cross coding with a stepped integer and slims the number of attributes.

  • GamingtilDawnGamingtilDawn Posts: 104Member

    Thank you all for your help. I have an idea now of where to start. :smiley:

  • GnarlyGnarly canadaPosts: 840Member

    Custom booleans is brilliant. That would help beginners with their logic immensely.

    Will never happen.

Sign In or Register to comment.