Log In  

Hello.

As I continue to work on my Pico-8 code I am now becoming painfully aware that there is no Breeze ability in Pico-8 if you code conventionally.

Let me explain.

In many programming languages I have written in to them functions to handle the breeze variable.

In it, if it is zero or undefined, nothing happens.

However, if it is >0 then a check is made to see if that key is being held. If it is then the program will run as fast as possible.

In Pico-8 I have it so if you hold down ❎ then the program will breeze on through the rest until breeze=0 is set.

To create breeze I wrote THIS function in place of flip().

function flp()
  if btn(breeze-1)==false then
    flip()
  end
end

Where breeze equals the value to check for the following. LEFT=1, RIGHT=2, UP=3, DOWN=4, πŸ…ΎοΈ=5, and ❎=6

In this if you have a long set of instructions or logo or what have you, you can hold or tap the ❎ key and it will breeze right on through them at maximum speed.

Now this works just fine if you use flip() but how can it be done using a main function such as _update() ?

That is what I don't know ... and if there is no way, I am requesting variable _breeze to be created to introduce this kind of TURBO button.

If zero or not defined, nothing happens.
if >0 then when the same button is pressed by btn() _breeze=(1, 2, 3, 4, 5, or 6) then the program will run maximum speed.

Here is a sample program:

Cart #takewipeso-0 | 2022-09-04 | Code ▽ | Embed ▽ | No License
1

function _mainloop()
  breeze=❎+1
  cls()
  repeat
    circ(rnd(128),rnd(128),5+rnd(5),rnd(16))
    flp()
  until forever
end

-- smart breeze check
function flp()
  if btn(breeze-1)==false then
    flip()
  end
end
P#116878 2022-09-04 14:26 ( Edited 2022-09-04 16:59)


[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2022-12-07 00:57:43 | 0.005s | Q:10