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
|
|
|
|
2011-08-20 23:51:33 +02:00
|
|
|
; Player movement
|
2011-08-20 22:52:29 +02:00
|
|
|
If KeyboardReleased(#PB_Key_Left) And Player\X > 0
|
|
|
|
Player\X-1
|
2011-08-20 23:51:33 +02:00
|
|
|
|
|
|
|
; Camera positioning
|
|
|
|
If Player\X < (Cam\X + Cam\Padding) And Cam\X > 0
|
|
|
|
Cam\X - 1
|
|
|
|
EndIf
|
2011-08-20 22:52:29 +02:00
|
|
|
EndIf
|
|
|
|
|
2011-08-20 23:51:33 +02:00
|
|
|
If KeyboardReleased(#PB_Key_Right) And Player\X < #MAP_WIDTH
|
2011-08-20 22:52:29 +02:00
|
|
|
Player\X+1
|
2011-08-20 23:51:33 +02:00
|
|
|
|
|
|
|
; Camera positioning
|
|
|
|
If Player\X > (Cam\X + Cam\Width - Cam\Padding) And (Cam\X + Cam\Width) < #MAP_WIDTH
|
|
|
|
Cam\X + 1
|
|
|
|
EndIf
|
2011-08-20 22:52:29 +02:00
|
|
|
EndIf
|
|
|
|
|
|
|
|
If KeyboardReleased(#PB_Key_Up) And Player\Y > 0
|
|
|
|
Player\Y-1
|
2011-08-20 23:51:33 +02:00
|
|
|
|
|
|
|
; Camera positioning
|
|
|
|
If Player\Y< (Cam\Y + Cam\Padding) And Cam\Y > 0
|
|
|
|
Cam\Y - 1
|
|
|
|
EndIf
|
2011-08-20 22:52:29 +02:00
|
|
|
EndIf
|
|
|
|
|
2011-08-20 23:51:33 +02:00
|
|
|
If KeyboardReleased(#PB_Key_Down) And Player\Y < #MAP_HEIGHT
|
2011-08-20 22:52:29 +02:00
|
|
|
Player\Y+1
|
|
|
|
|
2011-08-20 23:51:33 +02:00
|
|
|
; Camera positioning
|
|
|
|
If Player\Y > (Cam\Y + Cam\Height - Cam\Padding) And (Cam\Y + Cam\Height) < #MAP_HEIGHT
|
|
|
|
Cam\Y + 1
|
|
|
|
EndIf
|
|
|
|
EndIf
|
2011-08-20 17:04:33 +02:00
|
|
|
EndProcedure
|