Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: How do you controle Menus with scripts for button states?  (Read 2875 times)

0 Members and 1 Guest are viewing this topic.

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 352
    • View Profile
    • Jyujinkai's WME Development Blog
How do you controle Menus with scripts for button states?
« on: September 28, 2007, 12:46:35 AM »

How would i go about using a script to control a menu.

Basically i want the button to say "Start Game" or whatever and then after you have done that for the same button on the menu to say "restart game"

I assume it can be done with a global varabile that is set to say true or false or somthing but as you know my programming is lame....

Any ideas?
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe

sychron

  • Wanderer zwischen den Welten
  • Global Moderator
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 223
  • There is no spoon. The enemy gate is down!
    • View Profile
Re: How do you controle Menus with scripts for button states?
« Reply #1 on: September 28, 2007, 04:13:56 AM »

Add a global to base.inc:

global GameStarted = false;

In the button script, set

GameStarted = true;

Then comes the Trick:
Make two button entities, one saying start game, one saying restart game.
Deactivate the restart game (and layer it on top of the start game).

In the scene_init.script, do something like this:

  startButton.Active = !GameStarted;
  restartButton.Active = GameStarted;

So the button images will show up resembling the current state of the game.
Logged
... delete the inner sleep ...
 

Page created in 0.046 seconds with 21 queries.