How To Use Action Blocks and Actions

From Blocksworld Wiki
Jump to: navigation, search

Overview


Before beginning this How To it is recommended that you learn How To Build and Publish a World.


All blocks are programmable with Actions. Action Blocks have unique actions and specific functions which are unavailable to other blocks.
For example, Motors can make things spin, Rockets can provide thrust and the Magnet can attract other blocks.
In this How To you will learn the basics of using Action Blocks and Actions to control your contraptions. We wont cover any specific Action Block in-depth, but we will learn the general concepts behind all Action Blocks and Actions.
We will start with a very simple example and then expand to more complicated examples. At the end of this How To you should have a good understanding of the basic programming potential in Blocksworld!
Let's get started...


Step-by-Step Instructions


Basic Example


In this basic example we will learn how to use the Action Panel to change the color of a block both automatically and by pressing a button.
Step 6. Cube programmed to constantly turn red.
  1. Build a new world.
  2. Drag a cube from the Build Panel onto the ground.
  3. With the cube selected drag the Action Panel out so that it is fully visible.
    • The Action Panel is a small grey tab on the left-most side of the screen. However, it is only visible when a block is selected.
  4. Notice that the the Action Panel has a green tile labeled Does with an arrow pointing to the right.
    Step 13. Cube programmed to turn red and blue. Both commands are being triggered at the same time so ultimately the cube will turn and apparently stay blue because that is the last command.
    • When you drag an action to the left of Does it becomes a Condition.
    • When you drag an action to the right of Does it becomes a Command.
    • The Action Panel will constantly check for conditions and trigger commands.
  5. Open the Colors tab of the Build Panel.
  6. Drag the color Red to the right side of Does on the first row.
  7. Start Play Mode by pressing the play button in the upper left corner.
    • Notice that as soon as you enter Play Mode the cube turns red! This is because we programmed the cube with the command to turn Red.
  8. Return to Build Mode by pressing the build button in the upper left corner (crossed wrench and screwdriver).
    Step 16. Cube programmed to constantly turn red and turn blue while the L Button is pressed.
  9. Select the cube and if necessary drag the Action Panel out so that it is fully visible again.
  10. Open the Colors tab of the Build Panel.
  11. Drag the color Blue to the right side of Does on the second row.
    • Notice that both commands are set to trigger with the same condition.
  12. Start Play Mode.
    • Notice that because both commands trigger simultaneously the last command will take precedent and the cube will appear to turn and stay blue.
  13. Return to Build Mode.
  14. Open the Actions tab of the Build Panel.
  15. Select the cube and if necessary drag the Action Panel out so that it is fully visible again.
  16. With the cube still selected, drag the L Button action to the left side of Does on the second row.
    • The L Button action is now a condition. In other words; the command to the right side of does will trigger while the L Button is pressed.
  17. Start Play Mode.
  18. Press the L Button.
    • Notice that the cube only turns blue after pressing the L Button!
    • Also notice that the cube will return to red as soon as you release the L Button!


The color red in this example is interchangeable with lots of other actions! For example, you could set the cube to Explode after pressing the L Button, or the cube could present a written message with Speak.
Continue with the Intermediate Example below to learn more!


Intermediate Example



Advanced Example




Step-by-Step Gallery


Basic Step-by-Step Gallery



Intermediate Step-by-Step Gallery



Advanced Step-by-Step Gallery



Tips and Tricks


It can often be helpful to find and purchase an unlocked model in the Model Shop and to try and reverse engineer how it was built and programmed.
Don't be afraid to try all sorts of combinations to see what happens! Often some of the coolest contraptions are created by experimenting with action block functionality.