Player is movin

This commit is contained in:
Aaron 2011-08-20 22:52:29 +02:00
parent bdd6ba3eda
commit 480ddca935
4 changed files with 28 additions and 2 deletions

View file

@ -36,5 +36,6 @@ EndProcedure
Procedure DrawRunningGame() Procedure DrawRunningGame()
DrawMap() DrawMap()
DrawPlayer()
DrawHUD() DrawHUD()
EndProcedure EndProcedure

View file

@ -45,4 +45,23 @@ Procedure HandleEventRunningGame()
CurrentState = "MAIN_MENU" CurrentState = "MAIN_MENU"
*ActiveMenu.GameMenu = Menus(CurrentState) *ActiveMenu.GameMenu = Menus(CurrentState)
EndIf 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 EndProcedure

View file

@ -37,9 +37,14 @@ Procedure DrawMap()
Next Next
EndProcedure EndProcedure
Procedure DrawPlayer()
DrawTile(Player\TileNumber, Player\X, Player\Y)
EndProcedure
Procedure DrawHUD() Procedure DrawHUD()
EndProcedure EndProcedure
; ***************************************************************************** ; *****************************************************************************
; * Menu ; * Menu

View file

@ -1,6 +1,8 @@
 
#DATA_PATH = "../data/" #DATA_PATH = "../data/"
#TILE_SIZE = 20 #TILE_SIZE = 20
#MAP_WIDTH = 120
#MAP_HEIGHT = 120
; Global variables ; Global variables
Global Fullscreen = 0 Global Fullscreen = 0
@ -41,7 +43,7 @@ LoadSound(2, #DATA_PATH + "sound/title_song.wav")
; FIXME: JUST FOR DEBUGGING ; FIXME: JUST FOR DEBUGGING
Global Dim TileMap.Tile(120, 120) Global Dim TileMap.Tile(#MAP_WIDTH, #MAP_HEIGHT)
Define x, y Define x, y
For x.i=0 To 120 For x.i=0 To 120
For y.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 TileMap(x, y)\Y = y
Next Next
Next Next
TileMap(3, 3)\TileNumber = 0