Log In  


Cart #btnwut-0 | 2024-04-07 | Embed ▽ | License: CC4-BY-NC-SA
1

I cannot figure out what's happening with btn(). It seems totally random. I made this cart so you can see. I thought it was supposed to imitate PICO-8's btn() function, but that's clearly not happening.

Also, if anyone knows how to get data from different controllers, please share. Usually I would do something like btn(btn_num, controller_num) but with btn() acting the way it is... 🤷😂

1


1

Okay, figured it out. Thanks to @Waporwave on the Discord server, I checked to see if I had a controller plugged in. And I did! That was messing with all my values. Unplugged the controller and now it works fine, as expected.

BUT! Also kind of weird that just having the controller plugged in (not being pressed or anything) totally bugged out the arrow keys. So, still something to debug there.


I think picotron is returning raw controller values, and expecting you to deal with the deadzone. It might be nice if the deadzone were a configurable poke value, to avoid this happening by default


Using this program I can see now why I can't properly read my Switch Pro D-Pad.


You can usually fix the issue by rotating your control stick in a circle a couple of times, and induce it by doing that while also playing around with the D-pad/arrow keys, which makes me think it's some kind of automatic calibration issue.


1

the other thing I mentioned is that with keyboard only, diagonals still return not 255 but 181. this seems to be emulating a joystick to keep the vector normalized! maybe could be useful quick way to add that kinda movement to your game


5

This is fixed for 0.1.0f -- and yes, it was broken deadzone code.

The btn() calls process the raw values in two ways:

  1. the magnitude of x,y sticks is clamped to 1.0: more often than not what you want when paying attention to analogue values, and

  2. holding left and right cancel each other out -- reduce the number of carts that require pressing both L and R at the same time without realising it is impossible on some installations

It will still be possible to grab raw values from @5400 though if needed.



[Please log in to post a comment]