We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What command should I use to make my program pause until the user presses a key?
#17
ZS,

Nice try!

Below is your main UI thread code - I always put this at the top of a program.

Code:
GraphicsWindow.BackgroundColor = "White"
GraphicsWindow.FontSize = 40
StartGame()

'Restart Program
Program.Delay(5000)
GraphicsWindow.Clear()
'Timer Should Stop Here But There Is No Such Function In SB To Stop  Timer

StartGame()

Everything else is subroutines, including events.  Note that you only call StartGame 2 times.  In the meantime within the 5 second pause the events do various stuff.  As an event program gets more complex it will be harder to debug; this is why I always recommend the event loop with small delay handling flags set in event subs.

You can use Timer methods Pause and Resume, but trying to do it this way will get complex and very hard to understand - a fun project though Smile
Reply


Messages In This Thread
RE: What command should I use to make my program pause until the user presses a key? - by litdev - 06-27-2024, 09:16 AM

Forum Jump:


Users browsing this thread: 4 Guest(s)