The Map will be build now
This commit is contained in:
parent
c7c7c30eb0
commit
bdd6ba3eda
5 changed files with 50 additions and 57 deletions
|
@ -35,6 +35,6 @@ EndProcedure
|
|||
|
||||
|
||||
Procedure DrawRunningGame()
|
||||
DrawGui()
|
||||
DrawMap()
|
||||
DrawHUD()
|
||||
EndProcedure
|
||||
|
|
|
@ -8,69 +8,36 @@ Procedure InitGraphics()
|
|||
GFXTileset = LoadSprite(#PB_Any, "../data/gfx/tileset01.bmp")
|
||||
EndProcedure
|
||||
|
||||
; TODO: Make this dynamic
|
||||
Procedure InitTileset()
|
||||
Tileset(0) = CopySprite(GFXTileset, #PB_Any)
|
||||
ClipSprite(Tileset(0), 0, 0, 16, 16)
|
||||
ClipSprite(Tileset(0), #TILE_SIZE*0, 0, #TILE_SIZE, #TILE_SIZE)
|
||||
|
||||
Tileset(1) = CopySprite(GFXTileset, #PB_Any)
|
||||
ClipSprite(Tileset(1), 16, 0, 16, 16)
|
||||
ClipSprite(Tileset(1), #TILE_SIZE*1, 0, #TILE_SIZE, #TILE_SIZE)
|
||||
|
||||
Tileset(2) = CopySprite(GFXTileset, #PB_Any)
|
||||
ClipSprite(Tileset(2), 32, 0, 16, 16)
|
||||
ClipSprite(Tileset(2), #TILE_SIZE*2, 0, #TILE_SIZE, #TILE_SIZE)
|
||||
|
||||
Tileset(3) = CopySprite(GFXTileset, #PB_Any)
|
||||
ClipSprite(Tileset(3), #TILE_SIZE*3, 0, #TILE_SIZE, #TILE_SIZE)
|
||||
EndProcedure
|
||||
|
||||
Procedure DrawTile(number.i, x.i, y.i)
|
||||
DisplaySprite(Tileset(number), x, y)
|
||||
|
||||
;Debug number.i
|
||||
;Debug x.i
|
||||
;Debug y.i
|
||||
DisplaySprite(Tileset(number), #TILE_SIZE*x, #TILE_SIZE*y)
|
||||
EndProcedure
|
||||
|
||||
Procedure DrawMap()
|
||||
DrawTile(0, 0, 0);
|
||||
DrawTile(0, 16, 0);
|
||||
DrawTile(0, 32, 0);
|
||||
DrawTile(0, 48, 0);
|
||||
DrawTile(0, 64, 0);
|
||||
DrawTile(0, 80, 0);
|
||||
DrawTile(0, 96, 0);
|
||||
Define X.i ,Y.i
|
||||
|
||||
DrawTile(0, 0, 16);
|
||||
DrawTile(0, 16, 16);
|
||||
DrawTile(0, 32, 16);
|
||||
DrawTile(0, 48, 16);
|
||||
DrawTile(0, 64, 16);
|
||||
DrawTile(0, 80, 16);
|
||||
DrawTile(0, 96, 16);
|
||||
|
||||
DrawTile(1, 0, 32);
|
||||
DrawTile(1, 16, 32);
|
||||
DrawTile(1, 32, 32);
|
||||
DrawTile(0, 48, 32);
|
||||
DrawTile(1, 64, 32);
|
||||
DrawTile(1, 80, 32);
|
||||
DrawTile(1, 96, 32);
|
||||
|
||||
DrawTile(0, 0, 48);
|
||||
DrawTile(0, 16, 48);
|
||||
DrawTile(0, 32, 48);
|
||||
DrawTile(0, 48, 48);
|
||||
DrawTile(0, 64, 48);
|
||||
DrawTile(0, 80, 48);
|
||||
DrawTile(0, 96, 48);
|
||||
|
||||
DrawTile(2, 0, 64);
|
||||
DrawTile(2, 16, 64);
|
||||
DrawTile(2, 32, 64);
|
||||
DrawTile(2, 48, 64);
|
||||
DrawTile(2, 64, 64);
|
||||
DrawTile(2, 80, 64);
|
||||
DrawTile(2, 96, 64);
|
||||
For X.i=Cam\X To Cam\X+Cam\Width
|
||||
For Y.i=Cam\Y To Cam\Y+Cam\Height
|
||||
DrawTile(TileMap(X, Y)\TileNumber, X, Y)
|
||||
Next
|
||||
Next
|
||||
EndProcedure
|
||||
|
||||
Procedure DrawGui()
|
||||
Debug "This is an awesome Gui"
|
||||
Procedure DrawHUD()
|
||||
EndProcedure
|
||||
|
||||
; *****************************************************************************
|
||||
|
@ -78,7 +45,7 @@ EndProcedure
|
|||
|
||||
Procedure Menu_GotoCurrent()
|
||||
If *ActiveMenu\Entries()\Selected <> #True
|
||||
FirstElement(*ActiveMenu\Entries());
|
||||
FirstElement(*ActiveMenu\Entries())
|
||||
|
||||
ForEach *ActiveMenu\Entries()
|
||||
If *ActiveMenu\Entries()\Selected = #True
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#DATA_PATH = "../data/"
|
||||
#TILE_SIZE = 20
|
||||
|
||||
; Global variables
|
||||
Global Fullscreen = 0
|
||||
|
@ -8,11 +9,15 @@ Global Screen.ScreenDimension\width = 800
|
|||
Screen.ScreenDimension\height = 600
|
||||
|
||||
; Player
|
||||
Global Player.MapPoint\X = 10
|
||||
Player.MapPoint\Y = 10
|
||||
Global Player.Tile\X = 10
|
||||
Player.Tile\Y = 10
|
||||
Player.Tile\TileNumber = 0
|
||||
|
||||
; Them map
|
||||
Global Dim GameField(50, 50)
|
||||
; Camera
|
||||
Global Cam.Camera\X = 0
|
||||
Cam.Camera\Y = 0
|
||||
Cam.Camera\Width = Screen\Width/#TILE_SIZE
|
||||
Cam.Camera\Height = Screen\Height/#TILE_SIZE
|
||||
|
||||
NewMap GameStates.GameState()
|
||||
Global NewMap Menus.GameMenu()
|
||||
|
@ -26,10 +31,23 @@ Global Font_H2 = LoadFont(2, "Verdana", 18)
|
|||
; Graphics
|
||||
Global GFXLogo.i
|
||||
Global GFXTileset.i
|
||||
Global Dim Tileset.i(2)
|
||||
Global Dim Tileset.i(3)
|
||||
|
||||
; Sounds
|
||||
Global MenuSoundStarted = 0
|
||||
LoadSound(0, #DATA_PATH + "sound/menu_change.wav")
|
||||
LoadSound(1, #DATA_PATH + "sound/menu_select.wav")
|
||||
LoadSound(2, #DATA_PATH + "sound/title_song.wav")
|
||||
|
||||
|
||||
; FIXME: JUST FOR DEBUGGING
|
||||
Global Dim TileMap.Tile(120, 120)
|
||||
Define x, y
|
||||
For x.i=0 To 120
|
||||
For y.i=0 To 120
|
||||
TileMap(x, y)\TileNumber = Random(2)+1
|
||||
TileMap(x, y)\X = x
|
||||
TileMap(x, y)\Y = y
|
||||
Next
|
||||
Next
|
||||
TileMap(3, 3)\TileNumber = 0
|
||||
|
|
|
@ -87,7 +87,7 @@ If OpenWindow(0, 0, 0, Screen\Width, Screen\Height, title, #PB_Window_ScreenCent
|
|||
If CurrentState = "MAIN_MENU" Or CurrentState = "RLY_QUIT"
|
||||
If MenuSoundStarted = 0
|
||||
MenuSoundStarted = PlaySound(2, #PB_Sound_MultiChannel|#PB_Sound_Loop)
|
||||
SoundVolume(2, 70, MenuSoundStarted)
|
||||
SoundVolume(2, 50, MenuSoundStarted)
|
||||
EndIf
|
||||
Else
|
||||
StopSound(2, MenuSoundStarted)
|
||||
|
|
|
@ -32,7 +32,15 @@ Structure GameMenu
|
|||
List Entries.GameMenuItem()
|
||||
EndStructure
|
||||
|
||||
Structure MapPoint
|
||||
Structure Tile
|
||||
X.i
|
||||
Y.i
|
||||
TileNumber.i
|
||||
EndStructure
|
||||
|
||||
Structure Camera
|
||||
X.i
|
||||
Y.i
|
||||
Width.i
|
||||
Height.i
|
||||
EndStructure
|
||||
|
|
Loading…
Reference in a new issue