' Legacy of HYDON by Niklas Jansson. ' LudumDare 48hr entry, Yule 2009. ' www.androidarts.com Strict Graphics 800,600,0 Const X_MAP_HANDLE:Int = 400 '400 Const Y_MAP_HANDLE:Int = -220 Const MAP_WIDTH_TILES:Byte = 128 Const MAP_HEIGHT_TILES:Byte = 128 Const TILE_W:Int = 80 Const TILE_H:Int = 40 Const GFX_ROWS:Byte = 15 'excl Const GFX_COLS:Byte = 8 Const GFX_PLAYER:Byte = GFX_COLS*12 ' Player row Global TitleImg:TImage = LoadImage("logo_splash2.bmp") Cls DrawImage TitleImg,0,0 Flip Delay 2000 TMap.FLoadAssets() 'TMap.FLoadRawMap() TMap.FLoadDatMap() TPlayer.FDefaultState() While Not KeyHit(KEY_ESCAPE) Cls 'TMap.FScrollControl() 'TMap.FFileControl() If TPlayer.FControl() TPlayer.FFocus() ' Re-Focus on player if done anything. EndIf TMap.FDrawMap() TPlayer.FDrawStatus() 'TMap.FEdit() TMap.FDrawNarrowHUD() TPlayer.FDrawTreasureList() TPlayer.FDrawStats() 'TMap.FDrawCrop() 'TMap.FDrawTileSelection() 'TMap.FTileSelect() Flip Delay 12 Wend End Type TMap Global gfx:TImage, shade:TImage, selectbox:TImage Global Ground:Byte[MAP_WIDTH_TILES, MAP_HEIGHT_TILES] Global Obstacle:Byte[MAP_WIDTH_TILES, MAP_HEIGHT_TILES] 'Global Bucket:TList[MAP_WIDTH_TILES, MAP_HEIGHT_TILES] Global Action:Byte[MAP_WIDTH_TILES, MAP_HEIGHT_TILES] ' Lazy Global SelectedTile:Byte Global XScroll:Int, YScroll:Int Function FLoadAssets() SetMaskColor 255,0,255 gfx = LoadAnimImage("ld_iso_gfx_wip4_small.bmp",TILE_W, TILE_H*3, 0, GFX_COLS*GFX_ROWS,MASKEDIMAGE) MidHandleImage( gfx ) shade = LoadImage("shade3.bmp",MASKEDIMAGE) MidHandleImage( shade ) selectbox = LoadImage("select.bmp",MASKEDIMAGE) MidHandleImage( selectbox ) End Function Function FLoadRawMap() ' Works as a converter. Used this to load a Photoshop Raw 'image'. Local Data:TBank Local x, y, b Local DataFileName:String = "map.raw" Local DataFileSize = FileSize(DataFileName) If DataFileSize < 128^2 Then End ' Safety Data:TBank = CreateBank:TBank( DataFileSize ) ' Allocate mem Data = LoadBank(DataFileName) ' Load it with the binary data For y=0 To MAP_HEIGHT_TILES-1 For x=0 To MAP_WIDTH_TILES-1 b = PeekByte(Data, y * MAP_HEIGHT_TILES + x) Select b Case 0 FWriteSomething (x,y, GFX_COLS*3+2) FWriteSomething (x,y, GFX_COLS*1) 'Wall Case 1 FWriteSomething (x,y, GFX_COLS*1) ' Road Case 2 FWriteSomething (x,y, GFX_COLS*2) ' Cliff Case 3 FWriteSomething (x,y, GFX_COLS*4) ' Tree Case 4 FWriteSomething (x,y, 0) ' Grass Case 5 FWriteSomething (x,y, GFX_COLS*0+4) ' Blight Default FWriteSomething (x,y, 0) End Select Next Next End Function Function FSaveDatMap() Local file:TStream = WriteFile("map.dat") Local x, y For y=0 To MAP_HEIGHT_TILES-1 For x=0 To MAP_WIDTH_TILES-1 WriteByte(file, FReadGround(x,y)) Next Next For y=0 To MAP_HEIGHT_TILES-1 For x=0 To MAP_WIDTH_TILES-1 WriteByte(file, FReadObstacle(x,y)) Next Next CloseStream file EndFunction Function FLoadDatMap() Local file:TStream = ReadFile("map.dat") Local DataFileSize = FileSize("map.dat") If DataFileSize < 128^2 * 2 Then End ' Safety Local x, y, b ' Load Ground For y=0 To MAP_HEIGHT_TILES-1 For x=0 To MAP_WIDTH_TILES-1 b = ReadByte(file) FWriteGround( x, y, b ) Next Next ' Load Obstacles For y=0 To MAP_HEIGHT_TILES-1 For x=0 To MAP_WIDTH_TILES-1 b = ReadByte(file) If b / GFX_COLS = 12 ' If we see the/a player, set his pos. TPlayer.XPos = x TPlayer.YPos = y 'Print "Player spotted at "+x+","+y TPlayer.FWritePlayer() ' Default Angle and Stance TPlayer.FFocus() ' Set scroll to him ElseIf b / GFX_COLS = 13 TPlayer.MaxTreasure:+1 EndIf FWriteObstacle( x, y, b ) Next Next CloseStream file EndFunction Function FDrawMap() Local x:Int, y:Int, xiso:Int, yiso:Int Local xo:Int, yo:Int Local i For y = 0 To 24 For x = 0 To 24 xiso = (x*40) -(y*40) + X_MAP_HANDLE yiso = (y*20) + (x*20) + Y_MAP_HANDLE If xiso <0 Or yiso < -40 Or xiso > 800 Or yiso =>650 ' NJET! Else xo = x + XScroll yo = y + YScroll i = FReadGround(xo,yo) If i < 255 ' If we're inside bounds FDrawGround(xiso, yiso, i) FDrawObstacle(xiso, yiso, FReadObstacle(xo,yo)) EndIf EndIf Next Next End Function Function FScrollControl() If KeyDown(KEY_DOWN) Then YScroll:+1 XScroll:+1 If KeyDown(KEY_UP) Then YScroll:-1 XScroll:-1 If KeyDown(KEY_LEFT) Then YScroll:+1 XScroll:-1 If KeyDown(KEY_RIGHT) Then YScroll:-1 XScroll:+1 End Function Function FFileControl() If KeyHit(KEY_O) Then FSaveDatMap() Delay 100 If KeyHit(KEY_I) Then FLoadDatMap() Delay 100 End Function Function FEdit() If MouseX()=>600 Then Return Local xm:Int ,ym:Int xm = MouseX() - X_MAP_HANDLE ym = MouseY() - Y_MAP_HANDLE - 20 Local xmiso:Int, ymiso:Int Local xiso:Int, yiso:Int Local xpick:Int, ypick:Int xmiso = ym/40.0 + xm/80.0 ' Figure out mouse isometric coords -> cell ymiso = ym/40.0 - xm/80.0 ' TILE H and W, This needs to be float? xpick = xmiso ' Which cell was it again? ypick = ymiso ' I don't know why I do this. ' Iso coordinates again. xiso = (xpick*40) - (ypick*40) + X_MAP_HANDLE yiso = (ypick*20) + (xpick*20) + Y_MAP_HANDLE FDrawSelectBox(xiso, yiso) FDrawCoords(xiso,yiso,xpick+","+ypick) xpick = xmiso +XScroll ' Which cell was it again? ypick = ymiso +YScroll ' I don't know why I do this. ' Iso coordinates again. xiso = (xpick*40) - (ypick*40) + X_MAP_HANDLE yiso = (ypick*20) + (xpick*20) + Y_MAP_HANDLE If MouseDown(1) Then FWriteSomething(xpick, ypick, SelectedTile) If MouseDown(2) Then FClearObstacle(xpick, ypick) End Function Function FDrawTileSelection() SetScale 0.2, 0.2 Local x, y For y = 0 To GFX_ROWS-1 For x = 0 To GFX_COLS-1 DrawImage gfx, 620+x*24, 50+y*24, x + y*GFX_COLS Next Next SetScale 1, 1 End Function Function FTileSelect() If MouseX()<600 Then Return Local xm:Int ,ym:Int xm = MouseX() - 610 ym = MouseY() - 40 xm:/24 ym:/24 ' BOUNDS If xm < 0 Or xm => GFX_COLS Or ym < 0 Or ym => GFX_ROWS Then Return DrawRect 610+xm*24, 40+ym*24, 24, 24 If MouseDown(1) Then SelectedTile = xm + ym*GFX_COLS End Function Function FWriteSomething:Byte(x,y,i) If x < 0 Or x => MAP_WIDTH_TILES Or y < 0 Or y => MAP_HEIGHT_TILES Then Return Local row = i/GFX_COLS Select row Case 0 i = Int((i / 2))*2 + Rnd(2) FWriteGround:Byte(x, y, i) Case 1 If i<12 Then i = Int((i / 2))*2 + Rnd(2) ' Exception for floor tiles FWriteGround:Byte(x, y, i) Case 2 ' Cliff i = row * 8 + Rnd(8) FWriteObstacle:Byte(x, y, i) Case 3 ' Walls If i-(row*8) > 4 Then Return FWriteObstacle:Byte(x, y, i) Case 4 ' Tree i = row * 8 + Rnd(3) FWriteObstacle:Byte(x, y, i) Case 5 ' Tomb and Dead Tree If i-(row*8) > 5 Then Return i = Int(((i-(row*8)) / 3))*3 + Rnd(3) + row*8 FWriteObstacle:Byte(x, y, i) Case 6 'Slime i = row * 8 + Rnd(4) FWriteObstacle:Byte(x, y, i) Case 7 'Knight i = row * 8 + Rnd(8) FWriteObstacle:Byte(x, y, i) Case 8 'Long i = row * 8 + Rnd(4) FWriteObstacle:Byte(x, y, i) Case 9 'Wyrm i = row * 8 + Rnd(8) FWriteObstacle:Byte(x, y, i) Case 10 'Roper i = row * 8 + Rnd(4) FWriteObstacle:Byte(x, y, i) Case 11 'BlightMan i = row * 8 + Rnd(4) FWriteObstacle:Byte(x, y, i) Case 12 'Hero i = row * 8 + Rnd(8) FWriteObstacle:Byte(x, y, i) Case 13 'Items 'i = row * 8 + Rnd(7)+1 FWriteObstacle:Byte(x, y, i) Case 14 'Hits and misses i = row * 8 + Rnd(8) FWriteObstacle:Byte(x, y, i) End Select End Function 'SWAP Function FSwapObstacle(x, y, xo, yo) FWriteObstacle(x+xo, y+yo, FReadObstacle(x, y) ) ' copy FWriteObstacle(x, y, 0) ' Clear old pos FWriteAction(x+xo, y+yo, FReadAction(x, y) ) ' copy FWriteAction(x, y, 0) ' Clear old pos End Function Function FReadAction:Byte(x,y) If x < 0 Or x => MAP_WIDTH_TILES Or y < 0 Or y => MAP_HEIGHT_TILES Then Return Return Action[x,y] End Function Function FWriteAction:Byte(x,y,i) If x < 0 Or x => MAP_WIDTH_TILES Or y < 0 Or y => MAP_HEIGHT_TILES Then Return Action[x,y] = i End Function ' GROUND Function FReadGround:Byte(x,y) If x < 0 Or x => MAP_WIDTH_TILES Or y < 0 Or y => MAP_HEIGHT_TILES Then Return 255 Return Ground[x,y] End Function Function FWriteGround:Byte(x,y,i) If x < 0 Or x => MAP_WIDTH_TILES Or y < 0 Or y => MAP_HEIGHT_TILES Then Return Ground[x,y] = i End Function Function FDrawGround(x,y,i) SetBlend MASKBLEND SetColor 255,255,255 DrawImage gfx, x, y, i 'Err End Function ' OBSTACLE Function FReadObstacle:Byte(x,y) If x < 0 Or x => MAP_WIDTH_TILES Or y < 0 Or y => MAP_HEIGHT_TILES Then Return Return Obstacle[x,y] End Function Function FWriteObstacle:Byte(x,y,i) If x < 0 Or x => MAP_WIDTH_TILES Or y < 0 Or y => MAP_HEIGHT_TILES Then Return Obstacle[x,y] = i End Function Function FClearObstacle:Byte(x,y) Obstacle[x,y] = 0 End Function Function FDrawObstacle(x,y,i) If i < GFX_COLS*2 Then Return ' Don't draw if tile is ground. Yeah, well I don't have 256 tiles now anyways. FDrawShade(x,y) SetBlend MASKBLEND SetColor 255,255,255 DrawImage gfx, x, y, i End Function ' EFFECTS AND HUD Function FDrawTile(x, y, i) SetBlend MASKBLEND SetColor 255,255,255 DrawImage gfx, x, y, i End Function Function FDrawShade(x,y) SetBlend SHADEBLEND SetAlpha 1 SetColor 255,255,255 DrawImage shade, x, y 'DrawOval x,y,60,30 End Function Function FDrawSelectBox(x,y) SetBlend MASKBLEND SetColor 255,255,255 DrawImage selectbox, x, y End Function Function FDrawCoords(x,y,s:String) SetBlend ALPHABLEND SetColor 0,0,0 DrawText s, x-20+1, y+30+1 SetColor 255,255,255 DrawText s, x-20, y+30 End Function Function FDrawHUD() SetBlend ALPHABLEND SetAlpha 0.85 SetColor 180,180,180 DrawRect 600,0,200,600 SetAlpha 1.0 SetColor 255,255,255 DrawLine 600,0,600,599 End Function Function FDrawNarrowHUD() SetBlend ALPHABLEND SetAlpha 0.85 SetColor 180,180,180 DrawRect 660,0,140,600 SetAlpha 1.0 SetColor 255,255,255 DrawLine 660,0,660,599 End Function Function FDrawCrop() SetBlend ALPHABLEND SetAlpha 0.85 SetColor 0,0,0 DrawRect 0,600,800,200 SetAlpha 1.0 SetColor 255,255,255 DrawLine 0,599,799,599 DrawText "800x600 CROP", 20, 610 End Function End Type Type TPlayer Global Angle, Stance, XPos, YPos Global Health, MaxHealth, Att, Def, XP Global Treasure[10], MaxTreasure, TreasureCount Global HStatus ' Take damage/block Global XEnemyStatus Global YEnemyStatus Global HEnemyStatus Global Tick4 Function FControl() If KeyHit(KEY_W) Then FClearStatus() FGoForward() FAIMove() FTick() Return True If KeyHit(KEY_A) Then FClearStatus() FTurnLeft() FAIMove() FTick() Return True If KeyHit(KEY_D) Then FClearStatus() FTurnRight() FAIMove() FTick() Return True If KeyHit(KEY_S) Then FClearStatus() FChangeStance() FAIMove() FTick() Return True Return False End Function Function FTick() Tick4:+1 If tick4 = 4 Then Tick4 = 0 End Function Function FDefaultState() Att = 10 Def = 10 MaxHealth = 10 Health = 10 FClearStatus() End Function Function FWritePlayer() TMap.FWriteObstacle(XPos, YPos, GFX_PLAYER + Angle + Stance * 4) End Function Function FGoForward() Local xo, yo, row, bumpinto, enemysta Select Angle Case 0 yo=1 Case 1 xo=-1 Case 2 yo=-1 Case 3 xo=1 End Select bumpinto = TMap.FReadObstacle(XPos + xo, YPos + yo) ' Move player If bumpinto = 0 TMap.FSwapObstacle(XPos, YPos, xo, yo) Xpos = XPos + xo YPos = YPos + yo 'FWritePlayer() Else ' Check for stuff to attack or pick up. row = bumpinto / GFX_COLS enemysta = (bumpinto - (row * GFX_COLS))/4 ' Should not be calc. for terrain bits Select row Case 13 ' Collect Treasure TreasureCount:+1 Treasure[bumpinto - row * GFX_COLS]:+1 TMap.FClearObstacle(XPos + xo, YPos + yo) Health = MaxHealth ' regen If TreasureCount=MaxTreasure-2 Then FVictory() 'If TreasureCount=1 Then FVictory() ' Def calues Case 6 FCombat(xo, yo, 10.0, enemysta) ' Slime Case 7 FCombat(xo, yo, 90.0, enemysta) ' Knight Case 8 FCombat(xo, yo, 40.0, enemysta) ' Runner Case 9 FCombat(xo, yo, 30.0, enemysta) ' Wyrm Case 10 FCombat(xo, yo, 50.0, enemysta) ' Roper Case 11 FCombat(xo, yo, 70.0, enemysta) ' Poop man End Select EndIf End Function Function FCombat(xo, yo, enemydef:Float, enemysta) Local playeratt = Att ' Def mode = double def, half att If Stance = 1 Then playeratt:*0.3 If enemysta = 1 Then enemydef:*2.8 If Rnd(1) < Float( playeratt / (enemydef + playeratt) ) TMap.FClearObstacle(XPos + xo, YPos + yo) ' Splash dead HEnemyStatus = 14*GFX_COLS+Rnd(4) XEnemyStatus = XPos + xo YEnemyStatus = YPos + yo Att:+Rnd(2) 'Level up Def:+Rnd(2) MaxHealth:+Rnd(2) Else 'Block HEnemyStatus = 14*GFX_COLS+4+Rnd(4) XEnemyStatus = XPos + xo YEnemyStatus = YPos + yo EndIf End Function Function FDefending(enemyatt:Float, enemysta) ' dun forget enemy stance Local playerdef = Def ' Def mode = double def, half att If Stance = 1 Then playerdef:*2.8 If enemysta = 1 Then enemyatt:*0.3 If Rnd(1) > Float( playerdef / (enemyatt + playerdef) ) 'TMap.FClearObstacle(XPos + xo, YPos + yo) ' Splash dead HStatus = 14*GFX_COLS+Rnd(4) Health = Health - (Rnd(3)+1) If Health = 0 Then FGameOver() Else 'Block HStatus = 14*GFX_COLS+4+Rnd(4) EndIf End Function Function FClearStatus() HEnemyStatus = -1 HStatus = -1 End Function Function FDrawStatus() ' Note that enemies move after, so the splash might miss Local xiso, yiso If HStatus => 0 xiso = ((XPos-TMap.XScroll)*40) - ((YPos-TMap.YScroll)*40) + X_MAP_HANDLE yiso = ((YPos-TMap.YScroll)*20) + ((XPos-TMap.XScroll)*20) + Y_MAP_HANDLE TMap.FDrawTile(xiso,yiso, HStatus) EndIf If HEnemyStatus => 0 'xiso = ((TMap.XScroll-XPos)*40) - ((TMap.YScroll-YPos)*40) + X_MAP_HANDLE 'yiso = ((TMap.YScroll-YPos)*20) + ((TMap.XScroll-XPos)*20) + Y_MAP_HANDLE xiso = ((XEnemyStatus-TMap.XScroll)*40) - ((YEnemyStatus-TMap.YScroll)*40) + X_MAP_HANDLE yiso = ((YEnemyStatus-TMap.YScroll)*20) + ((XEnemyStatus-TMap.XScroll)*20) + Y_MAP_HANDLE 'Print xiso + ", " + yiso + ", " +XPos+", " + YPos TMap.FDrawTile(xiso,yiso, HEnemyStatus) EndIf End Function Function FTurnLeft() Angle:-1 If Angle < 0 Then Angle = 3 FWritePlayer() End Function Function FTurnRight() Angle:+1 If Angle > 3 Then Angle = 0 FWritePlayer() End Function Function FChangeStance() Stance = 1 - Stance FWritePlayer() End Function Function FAIMove() ' Stuff around player animates Local x, y, enemy, ang, sta, charge For y = -10 To 10 For x = -10 To 10 TMap.FWriteAction(x+XPos, y+YPos, 1) 'Reset local action points Next Next For y = -10 To 10 For x = -10 To 10 If TMap.FReadAction(x+XPos, y+YPos) = 1 ' If have not moved yet TMap.FWriteAction(x+XPos, y+YPos, 0) enemy = TMap.FReadObstacle(x+XPos, y+YPos) If enemy => 6 * GFX_COLS And enemy < 12 * GFX_COLS ang = enemy Mod GFX_COLS If ang => 4 Then sta = 1 ' Protective stance ang = ang Mod 4 charge = False If x+XPos = XPos And y+YPos < YPos And ang = 0 Then charge=True If x+XPos = XPos And y+YPos > YPos And ang = 2 Then charge=True If y+YPos = YPos And x+XPos < XPos And ang = 3 Then charge=True If y+YPos = YPos And x+XPos > XPos And ang = 1 Then charge=True If charge = True If Rnd(6) > 0 Then FAIGoForward(x+XPos, y+YPos, ang, enemy/GFX_COLS) Else ' Random movement Select enemy/GFX_COLS Case 6 ' SLIME AI If Tick4 = 0 ' Moves 1/4 Select Int(Rnd(5)) Case 0 FAITurnLeft(x+XPos, y+YPos, ang, 0, 6) Case 1 FAITurnRight(x+XPos, y+YPos, ang, 0, 6) Default FAIGoForward(x+XPos, y+YPos, ang, 6) End Select EndIf Case 7 ' KNIGHT AI If Tick4 <2 ' Moves 1/2 Select Int(Rnd(6)) Case 0 FAITurnLeft(x+XPos, y+YPos, ang, sta, 7) Case 1 FAITurnRight(x+XPos, y+YPos, ang, sta, 7) Case 2 FAIChangeStance(x+XPos, y+YPos, ang, sta, 7) Case 3 FAIChangeStance(x+XPos, y+YPos, ang, 0, 7) ' Go def Default FAIGoForward(x+XPos, y+YPos, ang, 7) End Select EndIf Case 8 ' LONG AI 'If Tick4 <2 ' Select Int(Rnd(9)) ' Erratic runner. Case 0 FAITurnLeft(x+XPos, y+YPos, ang, 0, 8) Case 1 FAITurnRight(x+XPos, y+YPos, ang, 0, 8) Case 2 ' freeze Case 3 ' freeze Default FAIGoForward(x+XPos, y+YPos, ang, 8) End Select 'EndIf Case 9 ' WYRM AI If Tick4 <3 ' Moves 1/2 Select Int(Rnd(6)) Case 0 FAITurnLeft(x+XPos, y+YPos, ang, sta, 9) Case 1 FAITurnRight(x+XPos, y+YPos, ang, sta, 9) Case 2 FAIChangeStance(x+XPos, y+YPos, ang, sta, 9) Case 3 FAIChangeStance(x+XPos, y+YPos, ang, 1, 9) ' Go off Default FAIGoForward(x+XPos, y+YPos, ang, 9) End Select EndIf Case 10 ' ROPER AI If Tick4 <2 ' Moves 1/2 Select Int(Rnd(7)) Case 0 FAITurnLeft(x+XPos, y+YPos, ang, 0, 10) Case 1 FAITurnRight(x+XPos, y+YPos, ang, 0, 10) Case 2 ' freeze Default FAIGoForward(x+XPos, y+YPos, ang, 10) End Select EndIf Case 11 ' MEAT MAN AI If Tick4 <2 ' Moves 1/2 Select Int(Rnd(5)) Case 0 FAITurnLeft(x+XPos, y+YPos, ang, 0, 11) Case 1 FAITurnRight(x+XPos, y+YPos, ang, 0, 11) Case 2 ' freeze Case 3 ' freeze Default FAIGoForward(x+XPos, y+YPos, ang, 11) End Select EndIf End Select EndIf EndIf EndIf Next Next End Function Function FAIChangeStance(x, y, ang:Int, sta:Int, what:Int) sta = 1 - sta TMap.FWriteObstacle(x, y, what * GFX_COLS + ang + sta*4) End Function Function FAITurnLeft(x, y, ang:Int, sta:Int, what:Int) ang:-1 If ang < 0 Then ang = 3 TMap.FWriteObstacle(x, y, what * GFX_COLS + ang + sta*4) End Function Function FAITurnRight(x, y, ang:Int, sta:Int, what:Int) ang:+1 If ang > 3 Then ang = 0 TMap.FWriteObstacle(x, y, what * GFX_COLS + ang + sta*4) End Function Function FAIGoForward(x, y, ang:Int, what:Int) ' what is row num Local xo, yo, row, bumpinto, enemysta Select ang Case 0 yo=1 Case 1 xo=-1 Case 2 yo=-1 Case 3 xo=1 End Select bumpinto = TMap.FReadObstacle(x + xo, y + yo) enemysta = (TMap.FReadObstacle(x, y)-(what*GFX_COLS))/4 ' Move If bumpinto = 0 TMap.FSwapObstacle(x, y, xo, yo) Else ' Check for stuff to attack or pick up. row = bumpinto / GFX_COLS Select row Case 12 ' Attack Player FDefending(15.0, enemysta) 'Print enemysta End Select EndIf End Function Function FFocus() TMap.XScroll = XPos -12 TMap.YScroll = YPos -12 End Function Function FDrawStats() SetColor 0, 0, 0 DrawText "HP "+Health+"/"+MaxHealth, 680-1, 500-1 DrawText "Str "+Att, 680-1, 520-1 DrawText "Def "+Def, 680-1, 540-1 SetColor 255, 255, 255 DrawText "HP "+Health+"/"+MaxHealth, 680, 500 DrawText "Str "+Att, 680, 520 DrawText "Def "+Def, 680, 540 End Function Function FDrawTreasureList() Local i SetColor 0, 0, 0 DrawText "Loot "+TreasureCount+"/"+MaxTreasure, 680-1, 20-1 SetColor 255, 255, 255 DrawText "Loot "+TreasureCount+"/"+MaxTreasure, 680, 20 For i = 0 To GFX_COLS If Treasure[i] > 0 TMap.FDrawTile(740, i*50-24, 13 * GFX_COLS+i) ' Treasure row SetColor 0, 0, 0 DrawText "x "+Treasure[i], 766+1, i*50+1 SetColor 255, 255, 255 DrawText "x "+Treasure[i], 766, i*50 EndIf Next End Function Function FGameOver() Local TitleImg:TImage = LoadImage("gameover.bmp") Cls DrawImage TitleImg,0,0 Flip Delay 2000 End End Function Function FVictory() Local TitleImg:TImage = LoadImage("victory.bmp") Cls DrawImage TitleImg,0,0 Flip Delay 4000 End End Function End Type