Start diggin

This commit is contained in:
Aaron Mueller 2011-08-21 19:59:15 +02:00
parent a43354f7af
commit ebf63aae67
5 changed files with 42 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View file

@ -43,4 +43,4 @@ Procedure DrawRunningGame()
DrawPlayer()
DrawHUD()
EndProcedure
EndProcedure

View file

@ -99,4 +99,42 @@ Procedure HandleEventRunningGame()
Cam\Y + 1
EndIf
EndIf
; Digging!
If KeyboardReleased(#PB_Key_Escape)
Define TargetX.i, TargetY.i
; Determine the pixel to destroy
If Player\Direction = #PLAYER_DIR_LEFT And Player\X < #MAP_WIDTH
TargetX = Player\X + 1
TargetY = Player\Y
EndIf
If Player\Direction = #PLAYER_DIR_RIGHT And Player\X > 0
TargetX = Player\X - 1
TargetY = Player\Y
EndIf
If Player\Direction = #PLAYER_DIR_UP And Player\Y > 0
TargetX = Player\X
TargetY = Player\Y -1
EndIf
If Player\Direction = #PLAYER_DIR_DOWN And Player\X < #MAP_HEIGHT
TargetX = Player\X
TargetY = Player\Y + 1
EndIf
; Do something with the block
If TileIsType(#TILESET_TYPE_WALL, TargetX, TargetY)
TileMap(TargetX, TargetY)\Health - 1
If TileMap(TargetX, TargetY)\Health = -1
TileMap(TargetX, TargetY)\TileNumber = #TILESET_TYPE_FLOOR
EndIf
DrawNoiseWave(TargetX, TargetY)
EndIf
EndIf
EndProcedure

File diff suppressed because one or more lines are too long

View file

@ -50,6 +50,8 @@ Structure Player
Direction.i
EndStructure
Structure Shadow
X.i
Y.i