Why if i put a:
PSET(...)
command alone the program will run.
but if i put a :
SFX(0)
command alone i wont hear a thing ? (i have made the '0' sfx in sfx editor)
well, i would assume that SFX only play while the program is running, so if your program immediately terminates (goes to the command prompt) then its probably that you need to keep the program running to hear it. (please note, you can listen to SFX by pressing space in the editor, if that's what this is about)
pset is drawing something on the screen, its just changing the memory adress of that certain pixel into another colour (I think I explained that correctly)
Sfx actually goes to that memory adress, and then reads whats in it.
Did I explain that right?
So SFX(..) makes a request , but then a process or threads exits and there is no one to process that returned data?
Yes
I got all this out of @Krystman 's video on PICO-8 memory
He explains it all, and you can pretty much figure the rest out
something like
sfx(0) repeat flip() until btnp(4) or btnp(5) |
can work if you want something to type at the command line
Just checked - worked on my machine.
If you want to be slightly fancier:
sfx(0) repeat flip() until stat(16)==-1 |
should play the sfx and stop the moment the sfx ends (stat(16) returns the SFX number playing on channel 0, and that's -1 when nothing's playing)
Thanks. I am learning my kid programming, so having to add update and draw for sfx to work was kind of counterintuitive (regarding what a command is as we teach it).
And i mean in contrast with most other commands.
It's pretty counterintuitive, yeah - I'm not sure why the sound card only runs when the game loop is running (either flip() commands or the _update()/_draw() pair of functions) but it does mean you have to do shenanigans to hear sfx() and music() commands output sound.
[Please log in to post a comment]