Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

#1 2024-11-12 05:08:26

radleymartinez
New member
Registered: 2024-11-12
Posts: 1

Checking for a key that is depressed

Hey all,
Just a quick question, so I know you can use waitpadup(); to wait for all buttons to be up, but how do you test if say A and only A has been depressed?

Thanks

Offline

 

#2 2024-11-12 15:25:21

Ardis
Member
From: USA
Registered: 2019-06-06
Posts: 60
Website

Re: Checking for a key that is depressed

This is how I do it. The smartDelay function is just runs any logic that needs to run every frame and runs a wait_vbl_done; afterwards.


if (joypad() & J_START){
            while(joypad() & J_START){
                smartDelay(1,FALSE);
            }
            holdScreen = FALSE;
        }


Also known as Arvex in other places.

Interceptor (Demo)
https://arvex.itch.io/interceptor

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson