Dreamball:Creating and Using Buttons

From Valve Developer Community
Jump to: navigation, search

Introduction

This page will show you how to make use of pre-made buttons (or also known as switches).

Pre-made button - in game shot

The button

In general, buttons are just a simple trigger that does all the working, there's no real fanciness to them at all. We'll discuss them a little still, for any beginners.

When you place the prefab, you use the trigger in the center of the button to fire off your events. The same trigger will automatically do the button down anim / sounds / sprites for you. Take a look at it's properties, it should be self explanatory for any regular Hammer users.

Adding the button

To use the button simply place the "prefabs/gameplay/button.vmf" prefab into your map. It's good to go as it is. To use it's functionality use the trigger brush in the middle of the button. Use this to fire off any event for the map when the button is pushed. For example you could have a gate that's shut, now add an output to the button trigger to open the gate on touch. Now when you roll on the button it'll open the gate and the button will be pushed down and the 4 sprites will show automatically.

Pre-made button - in Hammer shot
Note:if you want to place multiple buttons, make sure you rename all the 'button1' names to 'button2', to make them each unique.
Tip:The button / button base model's have various skins.

Have a look at the sdk_buttons.vmf map example to see different kinds of events the button using.

See also

  • "Dreamball Dev Kit/SDK_content/prefabs/gameplay/button.vmf" - a pre-made button setup
  • "Dreamball Dev Kit/SDK_content/mapsrc/sdk_buttons.vmf" - an example map of using buttons with different events
  • More info on triggers
  • Dreamball Level Creation