Player is movin
This commit is contained in:
parent
bdd6ba3eda
commit
480ddca935
4 changed files with 28 additions and 2 deletions
|
@ -36,5 +36,6 @@ EndProcedure
|
|||
|
||||
Procedure DrawRunningGame()
|
||||
DrawMap()
|
||||
DrawPlayer()
|
||||
DrawHUD()
|
||||
EndProcedure
|
||||
|
|
|
@ -45,4 +45,23 @@ Procedure HandleEventRunningGame()
|
|||
CurrentState = "MAIN_MENU"
|
||||
*ActiveMenu.GameMenu = Menus(CurrentState)
|
||||
EndIf
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
EndProcedure
|
|
@ -37,9 +37,14 @@ Procedure DrawMap()
|
|||
Next
|
||||
EndProcedure
|
||||
|
||||
Procedure DrawPlayer()
|
||||
DrawTile(Player\TileNumber, Player\X, Player\Y)
|
||||
EndProcedure
|
||||
|
||||
Procedure DrawHUD()
|
||||
EndProcedure
|
||||
|
||||
|
||||
; *****************************************************************************
|
||||
; * Menu
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
#DATA_PATH = "../data/"
|
||||
#TILE_SIZE = 20
|
||||
#MAP_WIDTH = 120
|
||||
#MAP_HEIGHT = 120
|
||||
|
||||
; Global variables
|
||||
Global Fullscreen = 0
|
||||
|
@ -41,7 +43,7 @@ LoadSound(2, #DATA_PATH + "sound/title_song.wav")
|
|||
|
||||
|
||||
; FIXME: JUST FOR DEBUGGING
|
||||
Global Dim TileMap.Tile(120, 120)
|
||||
Global Dim TileMap.Tile(#MAP_WIDTH, #MAP_HEIGHT)
|
||||
Define x, y
|
||||
For x.i=0 To 120
|
||||
For y.i=0 To 120
|
||||
|
@ -50,4 +52,3 @@ For x.i=0 To 120
|
|||
TileMap(x, y)\Y = y
|
||||
Next
|
||||
Next
|
||||
TileMap(3, 3)\TileNumber = 0
|
||||
|
|
Loading…
Reference in a new issue