How do I set various difficulty settings?

Blitz3D Forums/Blitz3D Programming/How do I set various difficulty settings?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

this bit of code:
; Go to the main menu screen
Cls
	DrawImage menuimage,0,0

	resume=WaitKey()
; Once player chooses to start, bring up the different difficulty levels for the game
If resume = KeyHit(3)
	End
EndIf

; If the start game was hit, continue, if the quit game was hit, quit
should really be a loop. It doesn't handle a situation such as the player pressing an incorrect key.

You can't do this:
If key = KeyHit(4)
because it will only be true the FIRST time you use it. After that, (unless the player pressed the key again), it will return false. You have to use it like so:
If key = 4

By the way, I would rename your variable "key" to something more intuitive, such as "difficultysetting" or the like.

You should change this section of code:
Cls
	DrawImage difficultyimage,0,0
	key=WaitKey()
to a loop and read something like this:
Repeat
	Cls
	DrawImage difficultyimage,0,0
	key=WaitKey()
	
	Select key
		Case 49
			difficultysetting = 1
		Case 50
			difficultysetting = 2
		;etc...
	End Select
Until difficultysetting > 0