Hi! Today I started making a video game for the psp. It is a simple puzzle game and right now I am about 5% through, if even that.
An example piece of code I have right now is:
SceCtrlData pad;
while(1) {
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_UP) {
flipScreen();
convert(x, y, outX, outY);
blitAlphaImageToScreen(0 ,0 ,27, 27, grid, outX, outY);
if (y == 0 && x < 9) {
x++;
} else if (y == 9 && x > 0) {
x--;
} else if (x == 0 && y > 0) {
y--;
} else if (x == 9 && y < 9) {
y++;
}
convert(x, y, outX, outY);
blitAlphaImageToScreen(0 ,0 ,27, 27, gun, outX, outY);
flipScreen();
}
grid is the background square, and gun is the object moving around.
The game is a 10x10 grid and on the outskirts of the grid the object moves around clockwise or counter-clockwise depending on what the user pushes.
My problem is when I push up, even if it moves around like I want it to, it moves way to fast. If I tap up slightly it might move 3 squares when I really want it to move 1 squares distance. I'm glad the psp is being responsive but is there a way to slow it down?
I tried to run a while loop in between and just have a number count up to slow it down, and surprisingly it had little to no effect on the speed. Also, I really don't want to put excess number crunching that is not required.
Is there a time pause command I can use or a library that can do that anyone knows about?
Also, when I hold down a button to move my object around the top 5 pixels horizontal flickers a lot which makes the background look bad. Anyone know the solution to this problem as well?
Thank you for any help!!
