This piece of code is driving me mad. I'm trying to create a simple bat and ball game to get to grips with thie code. I am not a noob coder, but this is the first time i've tried coding for the wii. I'm using the latest devkitpro with the programmers notepad IDE and GRRLIB librarys.
This snippet of code brings up a continue screen, but i can't for the life of me get it to respond to WPAD_BUTTON_UP, DOWN or HOME. I have all relevent librarys included.
if (score == 0) // upon losing all lives
{
int boo = 1;
while (boo==1)
{
pressed = WPAD_ButtonsDown(0);
GRRLIB_FillScreen(rainbow);
GRRLIB_Printf(lossx, lossy, tex_font1, 0xffffffff, 2, "You Lose, HA! Continue? up=y, down=n");
if ( pressed & WPAD_BUTTON_UP ) //restart game if press up
{
score = 5;
boo = 0;
}
if (pressed & WPAD_BUTTON_DOWN) exit(0); //end game if press down
if ( pressed & WPAD_BUTTON_HOME ) exit(0);
GRRLIB_Render();
}
startGame();
boo=1;
}
Can anybody see any problems with this code? I sure can't...
Thanks,
Sharon
Ignoring button?
Re: Ignoring button?
Try this:
if (WPAD_ButtonsDown(0) && WPAD_BUTTON_DOWN) exit(0); //end game if press down
if (WPAD_ButtonsDown(0) && WPAD_BUTTON_DOWN) exit(0); //end game if press down
Re: Ignoring button?
weird that nobody already answered correctly you on this one (obviously, the "fix" in the above post is wrong )
check wiibrew for some advices on how to read the Wiimote
simply, you need to call WPAD_ScanPads to update the buttons status before checking them
check wiibrew for some advices on how to read the Wiimote
simply, you need to call WPAD_ScanPads to update the buttons status before checking them
-
- Posts: 2
- Joined: Thu Sep 18, 2008 3:34 am
Re: Ignoring button?
Thankyou for your help. I'll try it tomorrow morning, and bring back the result.
Sharon
Sharon
Who is online
Users browsing this forum: No registered users and 1 guest