#include <pspdebug.h>
#include <pspkernel.h>
#include <pspcallbacks.h>
#include <pspctrl.h>
#include "graphics.h"
#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
#define prints PrintTextScreen
PSP_MODULE_INFO("Sprite Movement",0,1,1);
void spritemove();
int main(){
initGraphics();
SetupCallbacks();
SceCtrlData pad;
Color white = RGB(255,255,255);
int x = 200;
int y = 100;
Image*player = loadImage("Player2.png");
while(1){
sceCtrlPeekBufferPositive(&pad,1);
clearScreen(white);
if(pad.Buttons & PSP_CTRL_LEFT ){
spritemove();
x--;
}
blitAlphaImageToScreen(0,0,18,30,player,x,y);
sceDisplayWaitVblankStart();
flipScreen();
}
return 0;
}
void spritemove(){
Image*player = loadImage("Player2.png");
int ctr = 0;
ctr = ctr + 1;
int e = 0;
int d = 0;
int f = 0;
if(ctr >= 40 || ctr <= 0){
ctr = 0;
}
if(ctr == 10){
player = loadImage("Player1.png");
for( d = 0; d < 3; d++){
sceDisplayWaitVblankStart();
}
}
if(ctr == 20){
player = loadImage("Player2.png");
for(f = 0; f < 3; f++){
sceDisplayWaitVblankStart();
}
}
if(ctr == 30){
player = loadImage("Player3.png");
for(e = 0; e < 3; e++){
sceDisplayWaitVblankStart();
}
}
}
Heres the code i normally use in lua (with C modifications) for animating sprites. I believe it should work (hey if it works in LUA technically shouldnt it work in C?). My question is does it?(Im pspless at the moment i cant test it). It compiles fine
There are literally hundreds of "simple" sprite examples on the net in general, and this forum specifically. I even did one that loaded frames for animation from an anigif. Use the d@mn search and read the old threads!