#45885 - Lord_Rafa - Thu Jun 16, 2005 12:07 am
Hi I make a galaxian game whit the PA lib but I don know how put a background and sprites from bmp image this is my code:
Code: |
#include "PA.h"
#include "gfx/cruiser1.raw.c" #include "gfx/ship7.c" #include "gfx/ship7.h" #include "gfx/sprite.pal.c" #include "gfx/fond.raw.c" #include "gfx/fond.map.c" #include "gfx/bg.pal.c" void PA_test(const char *text); s16 x = 0; s16 y = 0; s16 A = 0; s16 D = 0; s16 M = 0; s16 N = 0; s16 S = 0; s16 B = 0; s16 fin = 0; int main(int argc, char ** argv) { PA_Init(); PA_InitVBL(); PA_LoadPal(PAL_SPRITE0, sprite_Palette); PA_LoadPal(PAL_SPRITE1, sprite_Palette); PA_LoadPal(PAL_BG1, bg_Palette); PA_LoadSpriteExtPal(1, 2, (void*)sprite_Palette); PA_CreateSprite(1, 0, (void*)cruiser1_Bitmap, OBJ_SIZE_32X32, 1, 0, 223, 160); PA_CreateSprite(1, 3, (void*)cruiser1_Bitmap, OBJ_SIZE_32X32, 1, 0, 112, 0); x = 224; y = 160; A = -1; B = -1; M = 112; N = 1; PA_LoadSimpleBg(1, 3, fond_Tiles, fond_Map, BG_256X256, 1, 1); PA_InitText(0, 0); PA_SetTextCol(0, 20, 20, 20); while (fin == 0) { if ( (x>=0) && (x<=224)) { x += Pad.Held.Right - Pad.Held.Left; } if (x<0) { x=0; } if (x>224) { x=224; } PA_SetSpriteXY(1,0,x,y); if (M==224) {N=-1;} if (M==0) {N=1;} M=M+N; PA_SetSpriteX(1,3,M); if ((Pad.Newpress.L)&&(A==-1)) { A=160; D=x; PA_CreateSprite(1, 1, (void*)ship7Data, OBJ_SIZE_16X16, 0, 0, D, A); } if (A>-1) {A=A-1;} PA_SetSpriteY(1,1,A); if (A==0) { PA_DeleteSprite(1,1); if (D==M) { PA_DeleteSprite(1,0); PA_DeleteSprite(1,1); PA_DeleteSprite(1,3); fin = 1; } } if ((Pad.Newpress.R)&&(B==-1)) { B=160; S=x+16; PA_CreateSprite(1, 2, (void*)ship7Data, OBJ_SIZE_16X16, 0, 0, S, B); } if (B>-1) {B=B-1;} PA_SetSpriteY(1,2,B); if (B==0) { PA_DeleteSprite(1,2); S=M; if (S==M) { PA_DeleteSprite(1,0); PA_DeleteSprite(1,1); PA_DeleteSprite(1,3); fin = 1; } } PA_WaitForVBL(); } while (1) { PA_OutputSimpleText(0, 14, 8,"FIN"); } return 0; } void PA_test(const char *text){}; |