Auxhil
Auxhil

Reputation: 21

How do I get more than one keyboard input at a time in Small Basic

I thought this would work, but didn't

GraphicsWindow.KeyDown = KeyDown

Sub KeyDown
   If GraphicsWindow.LastKey = "W" And GraphicsWindow.LastKey = "Space" Then
      Do Stuff
   EndIf
EndSub

I need a solution to this so I can get more than one keyboard input at a time from a user

Upvotes: 2

Views: 1004

Answers (1)

Zock77
Zock77

Reputation: 1017

Here you go! This should do what you need!

GraphicsWindow.KeyDown = KeyDown
GraphicsWindow.KeyUp = KeyUp

While 1 = 1
Program.Delay(10)
If Key["Space"] = "True" And Key["Up"] Then
 TextWindow.WriteLine("DOING STUFF!")
EndIf
EndWhile


Sub Keydown
LastKeyDown = GraphicsWindow.LastKey
Key[LastKeyDown] = "True"
EndSub

Sub KeyUp
LastKeyUp = GraphicsWindow.LastKey
Key[LastKeyUp] = "False"
EndSub

Upvotes: 2

Related Questions