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 2021-06-26 04:26:06

MrTadpole
New member
Registered: 2021-06-26
Posts: 2

Immune inputs in a switch statement: How, if possible?

Evening, Morning, Afternoon, or whatever 4th dimensional time paradox you reside in.

I'm new to GBDK and I am making a small Space Invaders type thing to get myself some practice. But I ran into a little issue. All my controls are in a switch statement. Left, Right, and A. And I was wondering if there was a way to make the Left and Right controls immune to the A input from the switch statement(That's the best way I can put it). Cause right now the player character will freeze in place if A is held along with Left or Right. If I can't exclude the inputs, could there be any possible work arounds?
Thank you for all the help you can give.

Last edited by MrTadpole (2021-06-26 04:28:45)

Offline

 

#2 2021-06-26 09:33:57

toxa
Member
Registered: 2020-02-13
Posts: 309

Re: Immune inputs in a switch statement: How, if possible?

Code:

if (joy & J_LEFT) {
 ...
} else if (joy & J_RIGHT) {
 ...
}
if (joy & J_A) {
 ...
}

i suggest to look into gbdk-2020 examples which are located in gbdk/examples/gb/

Last edited by toxa (2021-06-26 09:34:48)

Offline

 

#3 2021-06-26 10:37:11

MrTadpole
New member
Registered: 2021-06-26
Posts: 2

Re: Immune inputs in a switch statement: How, if possible?

toxa wrote:

Code:

if (joy & J_LEFT) {
 ...
} else if (joy & J_RIGHT) {
 ...
}
if (joy & J_A) {
 ...
}

i suggest to look into gbdk-2020 examples which are located in gbdk/examples/gb/

Noted. Thanks.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson