Hi all!
I am building a small pong clone for fun and I have an issue when I press the button to enable pause.
Basically the pause is enabling / disabling itself really fast.
This happens if I use btn() and also if I use btnp()...
The source code is available here:
https://github.com/ltpitt/pico-8-pong
Can you please help?
Thanks and happy hacking :)
I ran into this problem. I solved it by having a boolean is_pressed. If it's false, pause and set to true. The if statement for paused checks the state of the boolean before doing anything. Then at the end of the update loop, you can reset the boolean again.
Interesting!
How do you pause?
Is the pause affecting the game?
I don't use it for pause, as there's no functionality for pausing in my game but I did have the problem of pressing a key to get from one "scene" to another after which you could do an "action". But pressing the button to change "scene" would also make the "action" happen immediately because it was still reading the key press. Having a boolean that switched after the first "action" prevented the second "action" happening too quickly.
Mh I am not fully sure I understood...
Can you please jot some pseudo code as example?
There's really not much to explain but here it is in pseudo-code...
is_pressed=false
if button pressed and not is_pressed then
do something
is_pressed=true
end
at the start of the next update loop, set is_pressed back to false.
That's literally all it is.
The other way I considered is having a timer that activates so that button pressed are only re-registered after a few 100 milliseconds or something have passed. That would probably work too.
The basic aim is to just have two conditions be met rather than just btn().
Thanks for your input and kind explanation :)
I am going to implement now!
Nope, the behaviour stays the same :(
I'll look into timers, maybe
Well it probably won't be exact for your implementation. You just need to think about when you want to reset the boolean. The basic idea remains the same - two conditions need to be met rather than one.
I might have some time this weekend since I've mostly finished my to-do list for my little game - I'm doing Pong (well, a spin on Arkanoid really) like you :) If so, I'll throw together some code and post. I'm only on 6771 tokens so I want to add more stuff, but if I can't think of anything, I'll do some code for you. No promises though :D
I'm only on my first Pico-8 game too and I had to learn Lua at the same time so there might be a better way, mind.
Whaaat!
Fantastic :D
I can't wait to see you pong....
I am terrible at LUA so I share your pain :)
Is your game available somewhere?
Did you try my version?
I just need to put a better solution for the AI and version 1.0 is complete :D
Thanks for your time and help.
Quick question (sorry to hijack your thread), but how do you post a thread without a cart?
I see the submit button, but it only allow cart submissions. I'm confused.
I'm avoiding other Pong games in case I get any doubts about my own version :D
My game isn't finished yet so it's not available anywhere yet - I'm not into this new-fangled "release versions as you go" mentality. I'll post it when I can't think of anything else to add!
@sax - I had that problem too to the point where I emailed the PICO-8 author asking how to do it. It's not obvious :)
- Click on "BBS" on the top bar.
- Then you've got "Voxatron", "PICO-8" and "user blogs" boxes at the top. Click on "PICO-8"
- Now there's labels at the top for tags to parts of the BBS. Click on "Discussions".
- Now you'll see a link on the top left of the BBS called "start new thread".
Not very user-friendly!
wow thanks :D
this looks like entering a cheat code to reach an hidden level o_o'
[Please log in to post a comment]