2011-08-20 14:49:54 +02:00
|
|
|
; In this file, we handle alle the events
|
|
|
|
|
|
|
|
Procedure HandleEventMenu()
|
|
|
|
If KeyboardReleased(#PB_Key_Up)
|
2011-08-20 18:30:12 +02:00
|
|
|
PlaySound(0, #PB_Sound_MultiChannel)
|
2011-08-20 14:49:54 +02:00
|
|
|
Menu_GotoCurrent()
|
|
|
|
*ActiveMenu\Entries()\Selected = #False
|
|
|
|
|
|
|
|
If ListIndex(*ActiveMenu\Entries()) = 0
|
|
|
|
LastElement(*ActiveMenu\Entries())
|
|
|
|
Else
|
|
|
|
PreviousElement(*ActiveMenu\Entries())
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
*ActiveMenu\Entries()\Selected = #True
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
If KeyboardReleased(#PB_Key_Down)
|
2011-08-20 18:30:12 +02:00
|
|
|
PlaySound(0, #PB_Sound_MultiChannel)
|
2011-08-20 14:49:54 +02:00
|
|
|
Menu_GotoCurrent()
|
|
|
|
*ActiveMenu\Entries()\Selected = #False
|
|
|
|
|
|
|
|
If ListIndex(*ActiveMenu\Entries()) = (ListSize(*ActiveMenu\Entries())-1)
|
|
|
|
FirstElement(*ActiveMenu\Entries())
|
|
|
|
Else
|
|
|
|
NextElement(*ActiveMenu\Entries())
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
*ActiveMenu\Entries()\Selected = #True
|
|
|
|
EndIf
|
|
|
|
|
2011-08-20 17:49:22 +02:00
|
|
|
; We go to the target game state
|
2011-08-20 14:49:54 +02:00
|
|
|
If KeyboardReleased(#PB_Key_Return)
|
2011-08-20 18:30:12 +02:00
|
|
|
PlaySound(1, #PB_Sound_MultiChannel)
|
2011-08-20 17:49:22 +02:00
|
|
|
Menu_GotoCurrent()
|
2011-08-20 17:57:26 +02:00
|
|
|
CurrentState = *ActiveMenu\Entries()\TargetState
|
2011-08-20 17:49:22 +02:00
|
|
|
*ActiveMenu.GameMenu = Menus(CurrentState)
|
2011-08-20 14:49:54 +02:00
|
|
|
EndIf
|
2011-08-20 17:49:22 +02:00
|
|
|
|
2011-08-20 17:57:26 +02:00
|
|
|
|
2011-08-20 14:49:54 +02:00
|
|
|
EndProcedure
|
|
|
|
|
|
|
|
Procedure HandleEventRunningGame()
|
2011-08-20 19:44:21 +02:00
|
|
|
If KeyboardReleased(#PB_Key_Q)
|
2011-08-20 17:57:26 +02:00
|
|
|
CurrentState = "MAIN_MENU"
|
|
|
|
*ActiveMenu.GameMenu = Menus(CurrentState)
|
|
|
|
EndIf
|
2011-08-20 22:52:29 +02:00
|
|
|
|
|
|
|
If KeyboardReleased(#PB_Key_Left) And Player\X > 0
|
|
|
|
Player\X-1
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
If KeyboardReleased(#PB_Key_Right) And Player\X <= #MAP_WIDTH
|
|
|
|
Player\X+1
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
If KeyboardReleased(#PB_Key_Up) And Player\Y > 0
|
|
|
|
Player\Y-1
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
If KeyboardReleased(#PB_Key_Down) And Player\Y <= #MAP_HEIGHT
|
|
|
|
Player\Y+1
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-08-20 17:04:33 +02:00
|
|
|
EndProcedure
|