well i'm still at the very beginner level in game-dev sad to say. i tried "let's build a roguelike game" tutorial yet i can't seem to fully understand the manifestation of the concept into the logic of every line of code as long as i copy/paste the code examples everything works fine and can even understand enough to modify it a bit yet - that's not really learning cause if i would have to code the whole game by myself i wouldn't know how...
so i thought about starting with something simple - very simple a Tamagotchi program of a cat so i created an cat object (kinda) and here is the result for you - any advice as to how and what to add to it or what to modify in it will be greatly appreciated... the program uses fbsound to play a .wav file of some cat meawo sound and does basic animation...
file "cat_obj.bi"
Code: Select all
#INCLUDE ONCE "fbsound_dynamic.bi"
'ENUM poses
' poses1
' poses2
' poses3
'END ENUM
TYPE cat
x AS integer
DECLARE SUB CP(row AS INTEGER, s AS STRING)
DECLARE SUB display_screen(index AS INTEGER)
'DECLARE SUB make_sound(f AS STRING, t AS integer)
DECLARE SUB animation(f AS STRING, t AS INTEGER)
END TYPE
SUB cat.CP(row AS INTEGER, s AS STRING)
LOCATE row, (100 - LEN(s)) / 2 : PRINT s
END SUB
SUB cat.display_screen(index AS integer)
SELECT CASE index
CASE 0:
CLS
CP 4, "^ ^"
CP 5, "( ) %%%%%%%%%%%%%%%%%%% ( )"
CP 6, "<| (( <|> )) || (( <|> )) |>"
CP 7, "_ _"
CP 8, "_ _"
CP 9, "_ >(::| * |::)< _"
CP 10, " ------- "
CP 11, "( ----- )"
CP 12, "\\---//"
CP 13, "%%%"
CASE 1:
CLS
CP 4, "^ ^"
CP 5, "( ) %%%%%%%%%%%%%%%%%%% ( )"
CP 6, "<| (( <I> )) || (( <I> )) |>"
CP 7, "_ _"
CP 8, "_ _"
CP 9, "_ >(::| * |::)< _"
CP 10, " "
CP 11, "( OOOO )"
CP 12, "\\ //"
CP 13, "%%%"
CASE 2:
cls
CP 4, "^ ^"
CP 5, "( ) %%%%%%%%%%%%%%%%%%% ( )"
CP 6, "<| (( <dOb> )) || (( <dOb> )) |>"
CP 7, "_ _"
CP 8, "_ _"
CP 9, "_ >(::| & |::)< _"
CP 10, " "
CP 11, "( ~~~~~ )"
CP 12, "\\ ~~~ //"
CP 13, "%%%"
END SELECT
END SUB
SUB CAT.ANIMATION(f AS STRING, t AS INTEGER)
DIM i AS INTEGER = 0
DIM AS Integer hWave
fbs_Load_WAVFile(f , @hWave)
fbs_Play_Wave(hWave , t)
DO
IF i >= 3 THEN i = 0
DISPLAY_SCREEN(i)
SLEEP 500
i += 1
LOOP UNTIL INKEY <> ""
fbs_Destroy_Wave(@hWave)
END SUB
'SUB cat.make_sound(f AS STRING, t AS INTEGER)
' DIM AS Integer hWave
' fbs_Load_WAVFile(f , @hWave)
' fbs_Play_Wave(hWave , t)
' SLEEP
' While Inkey <> "":WEND
' fbs_Destroy_Wave(@hWave)
'END SUB
IF fbs_Init()=false then
print "error: FBS_INIT() " & FBS_Get_PlugError()
beep : sleep : end 1
end IF
DIM SHARED fiori AS cat
file "main.bas"
Code: Select all
#INCLUDE ONCE "cat_obj.bi"
SCREEN 19
'fiori.make_sound("cat_sound.wav", 1)
fiori.animation("cat_sound.wav", 1)