Can anyone help me??? I try to make a shooting function. Exactly the same as space invaders. I code in PAlib, but i already have this, but I don't know how to let it shoot:
CODE
#include
#include "all_gfx.h"
s16 framecount;
s32 x = 0; s32 y = 166;
int main(void){
PA_Init();
PA_LoadDefaultText(0, 0);
int bullet.x = 0;
int bullet.y = 180;
PA_LoadSpritePal(0, // Screen
0, // Palette number
(void*)red_Pal); // Palette name
PA_CreateSprite(0, 0, (void*)red_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 160);
while(1){
PA_SetSpriteXY(0, // screen
0, // sprite
x, // x position
y); // y...
if(Pad.Held.Left){
x--;
}
if(Pad.Held.Right){
x++;
}
if(Pad.Newpress.A){
PA_CreateSprite(0, 1, (void*)bullet_Sprite, OBJ_SIZE_8X8, 1, 0, 0, 0);
PA_SetSpriteXY(0, 1, bullet.x, bullet.y++);
PA_SetSpriteXY(0, 0, x, 160);
}
if(Pad.Released.A){
PA_SetSpriteXY(0, 0, x, 160);
}
PA_WaitForVBL();
}
return 0;
}
BTW, srry for double post, but it was in the wi-fi folder!
CODE
#include
#include "all_gfx.h"
s16 framecount;
s32 x = 0; s32 y = 166;
int main(void){
PA_Init();
PA_LoadDefaultText(0, 0);
int bullet.x = 0;
int bullet.y = 180;
PA_LoadSpritePal(0, // Screen
0, // Palette number
(void*)red_Pal); // Palette name
PA_CreateSprite(0, 0, (void*)red_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 160);
while(1){
PA_SetSpriteXY(0, // screen
0, // sprite
x, // x position
y); // y...
if(Pad.Held.Left){
x--;
}
if(Pad.Held.Right){
x++;
}
if(Pad.Newpress.A){
PA_CreateSprite(0, 1, (void*)bullet_Sprite, OBJ_SIZE_8X8, 1, 0, 0, 0);
PA_SetSpriteXY(0, 1, bullet.x, bullet.y++);
PA_SetSpriteXY(0, 0, x, 160);
}
if(Pad.Released.A){
PA_SetSpriteXY(0, 0, x, 160);
}
PA_WaitForVBL();
}
return 0;
}
BTW, srry for double post, but it was in the wi-fi folder!