Hi Prithak
yep a QB64 MusicMaker!
fine idea!
my feedbacks
1. Input must be improved because you can run in an overflow of input from keyboard with error by _soundPlaying():_sndstop():_sndclose() in sequence! I got this issue both with lines 55,56,57 (type$() = "loop") both with lines 62 or 63 (type$()="orange")
2. try to compact the code of the same area in the same place of the code
here I post your code with my suddivision in different function areas
3. I prefer to use a codeblock like a sub or function with parameter instead of goto and global variables
Here your code with comments
'INITIALIZATION AREA
SCREEN _NEWIMAGE(500, 600, 32)
r = 100
g = 200
b = 255
red& = _LOADIMAGE("music/red.png")
blue& = _LOADIMAGE("music/blue.png")
orange& = _LOADIMAGE("music/orange.png")
green& = _LOADIMAGE("music/green.png")
'DECLARATION AREA OF VARIABLES AND CONSTANTS
DIM location$(12)
DIM type$(12)
DIM h&(12)
DIM pic&(12)
DIM x(12)
DIM y(12)
' SECOND INITIALIZATION AREA
OPEN "music.txt" FOR INPUT AS #1
FOR i = 1 TO 12
INPUT #1, location$(i)
INPUT #1, type$(i)
IF type$(i) = "pink" THEN pic&(i) = _LOADIMAGE("music/red.png")
IF type$(i) = "orange" THEN pic&(i) = _LOADIMAGE("music/green.png")
IF type$(i) = "loop" THEN pic&(i) = _LOADIMAGE("music/blue.png")
READ x(i), y(i)
NEXT i
CLOSE #1
'MAIN LOOP
DO
here: ' NO INSTRUCTIONS JUMPS HERE
' INPUT MANAGER
k$ = UCASE$(INKEY$)
' GRAPHIC INTERFACE
FOR i = 1 TO 12
_PUTIMAGE (x(i), y(i))-(x(i) + 90, y(i) + 90), pic&(i)
NEXT i
maketiles
' COMMAND ENGINE
IF LEN(k$) THEN
IF k$ = "Q" THEN k = 10: GOTO there
IF k$ = "W" THEN k = 11: GOTO there
IF k$ = "E" THEN k = 12: GOTO there
k = VAL(k$)
IF k = 7 THEN k = 1: GOTO there
IF k = 8 THEN k = 2: GOTO there
IF k = 9 THEN k = 3: GOTO there
IF k = 1 THEN k = 7
IF k = 2 THEN k = 8
IF k = 3 THEN k = 9
'SOUND MAKER AREA
there: ' A LABEL WITH MANY GOTO? BETTER A SUB/FUNCTION WITH PARAMETER?
c = k
IF type$(k) = "loop" THEN
IF _SNDPLAYING(l&) = -1 THEN
_SNDSTOP l&
_SNDCLOSE l&
END IF
l& = _SNDOPEN(location$(k), "SYNC")
_SNDLOOP l&
ELSEIF type$(k) = "orange" THEN
IF _SNDPLAYING(l&) = -1 THEN _SNDSTOP l&: _SNDCLOSE l&
IF _SNDPLAYING(h&) = -1 THEN _SNDSTOP h&: _SNDCLOSE h&
o& = _SNDOPEN(location$(k), "SYNC")
_SNDPLAY o&
ELSE
IF _SNDPLAYING(h&) = -1 THEN
_SNDSTOP h&
_SNDCLOSE h&
END IF
h& = _SNDOPEN(location$(k), "SYNC")
_SNDPLAY h&
END IF
END IF
' DEBUG AREA
LOCATE 1, 1: PRINT c
' SECOND GRAPHIC AREA
_DISPLAY
CLS 'HOW MUCH TIME IS THERE BETWEEN SHOWING OUTPUT AND ERASE OF SCREEN?
LOOP
' DATA SETTINGS
DATA 100,100,200,100,300,100,100,200,200,200,300,200,100,300,200,300,300,300,100,400,200,400,300,400
'SUB OF GRAPHIC AREA
SUB maketiles ()
FOR i = 100 TO 300 STEP 100
FOR j = 100 TO 400 STEP 100
LINE (i, j)-(i + 90, j + 90), _RGB32(255, 255, 255), B
NEXT j
NEXT i
END SUB