GUI not showing up despite being asked nicely [SOL-VEED]

Started by Akatosh, Sat 26/07/2008 16:01:17

Previous topic - Next topic

Akatosh

Exactly. The platformer I'm currently working on sport a (critical) GUI by the name of gBlurb, carrying three buttons called btnCrash, btnEvade, and btnDestroy. Now, at the start of every new level, I need the button graphics to update and the GUI to become visible so the player knows what to do. Here's the script I've been using:

Code: ags


some crap about placing enemies etc.

//update button graphics
  ViewFrame *frame = Game.GetViewFrame(enemyView[1],0,0);
  btnCrash.NormalGraphic= frame.Graphic;
  
  frame = Game.GetViewFrame(enemyView[0],0,0);
  btnEvade.NormalGraphic=frame.Graphic;
  
  frame = Game.GetViewFrame(enemyView[2],0,0);  
  btnDestroy.NormalGraphic=frame.Graphic;

//extra life?
  if (lives<3) lives++; else GiveScore(1);

//reset timer
  timeleft=GetGameSpeed()*10+level*GetGameSpeed();

//play background music
  PlayMusic(Random(4));

//show gui
  gBlurb.Visible=true;
  WaitKey(99999);
  gBlurb.Visible=false;


Everything works just fine, up until the point the GUI should become visible. The extra life is added, the sound is played etc. - just gBlurb isn't shown. I'm totally at a loss here. Mind pointing out my probably soul-crushingly obvious mistake?  :-[

Khris

My guess is there's a keypress still in the buffer or something and thus the GUI is turned back off immediately.

Akatosh

Don't think so. Inserting another WaitKey(1) right before the other one doesn't cause it to work, either.

/EDIT: *facepalm*

After trying WaitKey(100) instead, I found the problem:
999.999 is too high a number to store as int - it just goes negative, causing the game not to pause at all. Gah! Well, thanks for trying to help. Somebody punch me in the face, please.

SMF spam blocked by CleanTalk