Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

what are switches?

It's always interesting to see someone who understands this concept try to explain it to someone who doesn't.
It's a relatively simple concept, but it's difficult to explain in entirely different terms, without referring to itself.

Since your next question will most likely be, "What is a variable?", check this out.. http://www.rmxp.org/forums/http://dev.r ... 43#p341743

If that clicked, then the switch is now easy. A switch is a variable that can only have 2 values: '0' or '1'.
Which can also be referred to as 'OFF' or 'ON', and 'false' or 'true'. In the case of event commands, they are called 'OFF' or 'ON'.
A switch is used to remember the 'state' of something. For example, you have an event that controls a door (or chest). It has 2 graphics (door open, door closed), and some code to animate the door opening & closing. Each time your player interacts with 'door', it changes from one 'state' to the other. It's either closed or open. So if you associate a switch that state ('OFF' = closed, 'ON' = open), then by looking at that switch you can tell what state the door is in.

There are several tutorials on "chests" & "doors", which are probably the simplest use of switches. Go check them out.

Be Well
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top