How do I change background scene on an event

Modified: 2008/05/02 16:39 by 131.107.0.102 - Categorized as: Game Creator, How To Guides
Edit

Change background scene on an event

Basic Idea: We don't have built in support for this at the moment, so doing this currently requires a bit of a workaround. You need to work with zindex property to control which background is shown. Another option is to edit the scene or background actor XAML directly, but this should be done only if you are comfortable editing XAML.

Sample Game: http://www.popfly.com/users/team/HowDoI-ChangeBackgroundOnEvent

Details:
  • Backgrounds are actors too and all actors have property zindex that controls their layering order. Using property change behaviors you can change zindex property to control which background will be shown.
  • Add desired background as actors to the game. Select the background, and then set its zindex property to -11. Do this for each of the background actors.
  • In the Scenes area, set the zoom control to the lowest value so that you are able to see the entire scene
  • Place one of the backgrounds on the scene and stretch it to fill the whole scene
  • Define a series of property change behaviors for the scene. If you want to change from Background1 to Background2, this is the set of property changes behaviors you need to define:
    • Property change that sets zindex for Background1 to -11.
    • Property change that sets zindex of Backgroun2 to -10

Scene-Behavior->Propert Change
Image

Property Changes (Click the image to view full size)


  • You need to do the above for every change behavior. In the screenshot above taken from the sample game, PropertyChange1 and PropertyChange2 are triggered by the Right arrow key and whereas PropertyChange3 and PropertyChange4 are triggered by the Left arrow.

Privacy. Terms of Use. Trademarks.
ScrewTurn Wiki version 2.0.22. Some of the icons created by FamFamFam.