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