Problems with Functions

BlitzPlus Forums/BlitzPlus Programming/Problems with Functions

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.

In this game I am making I have a death screen were the player can choose either to retry the game, or exit. The player chooses by pressing either one or two. When the player exits, the game calls on an exit function, which works perfectly. But when the player wants to retry, the program calls on the function that creates the level, but instead of working, the game crashes, what is going wrong?

This is the StartLevel() Function:
Function StartLevel()
While Not KeyHit(1) 	
	Cls
	DrawLevel()
	TestInput()
	TestEnemy()
	TestCollision()
	Timer()
	DrawHUD()
Flip
Wend
End Function



And here is the DeathScreen() Function:
 Function DeathScreen()
While Not KeyHit(1)
Cls
Delete Player 
Delete Computer
Delete Enemy
Delete Enemy2 
Text 260,240, "Game Over!"
Text 263,275, "Continue?"
Text 240,305, "  Yes"
Text 330,305, "No"

If KeyHit(2) Then
	
	StartLevel()	
		
ElseIf KeyHit(3) Then
	
	EndScreen()
	
End If

Flip
Wend
End Function