This is driving me nuts. When my game switches levels (after the last enemy on the screen is gone) the explosion animation carries over into the next level. I think a laser shot from the player blips on there as well.
I would like the game to show the complete explosion of the last enemy dying rather than go to the next level immediately. Here is some code, let me know if you need to see more of it.
This part is in the main loop
;If there are no enemies left on screen, player has beaten level. Begin next level.
If numofenemies = 0 Then
;Make the player's level increment by one
level = level + 1
;Initalize the new level
InitializeLevel(level)
EndIf
And here is the InitializeLevel() function
Function InitializeLevel(level)
;Delete every bullet
For i.bullet = Each bullet
Delete i
Next
;Display intro text
Text screenwidth / 2,screenheight / 2,"NOW ENTERING Level " + level,True,True
Flip
;Delay for a few seconds
Delay 2000
;Reset player's hitcounter
player\hits = 3
;reset player's frame
player\frame = 7 ;(7 is the middle frame)
;Make the total number of enemies a value between 3 and 5 + the current level
numofenemies = level + Rand(3 , 5) ;Level 1 will have 4-6 enemies, 2 will have 5-7, etc.
;reset health boxes' frame
healthframe = 0
;create the required number of enemies
For e=1 To numofenemies
CreateNewEnemy(level)
Next
End Function
|