All pastes #121533 Raw Edit

Untitled

public text v1 · immutable
·published 2006-08-08 02:18 UTC
rendered paste body
// Includes
#include <PA9.h>       // Include for PA_Lib

//include background data
#include "gfx/all_gfx.c"
#include "gfx/all_gfx.h"

//variables
char text[1000];
u8 x=0;
u8 y=0;

// Function: main()
int main(int argc, char ** argv)
{
	PA_Init();    // Initializes PA_Lib
	PA_InitVBL(); // Initializes a standard VBL
	//init text on top screen
	PA_InitText(1,0);
	
	PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31));
	PA_Init8bitBg(0, 0);
	
	PA_LoadTiledBg(1,1, Grass);	
	PA_LoadTiledBg(0,1, Background);	
	
	//load in master pal on both screens
	PA_LoadSpritePal(0,0,(void*)master_Pal);
	PA_LoadSpritePal(1,0,(void*)master_Pal);

	
	// Do not use the provided Graffiti shapes...
	PA_UsePAGraffiti(0); 
	
	//reconigition system
	//slashing
	PA_RecoAddShape('0', "HHGGGFEDCBAA@??"); 
	PA_RecoAddShape('0', "AAAA@?>>=<<;;;;"); 
	PA_RecoAddShape('1', "IIJKKKKLMO01111"); 
	PA_RecoAddShape('1', "O01222344567778"); 
	
	//stabbing
	PA_RecoAddShape('2', "IIIIIIIIIIIIIII");
	PA_RecoAddShape('3', "999999999999999");
	
	//blocking
	PA_RecoAddShape('4', "AAAAAAAAAAAAAAA");
	PA_RecoAddShape('5', "111111111111111");
	
	
	//sword object
	PA_CreateSprite(1,0,(void*)SlashR_Sprite,OBJ_SIZE_64X64,1,0,0,0);
	
	PA_WaitForVBL();
	
	// Infinite loop to keep the program running
	while (1)
	{

		
		char letter = PA_CheckLetter(); // Returns the letter !!!
		if (Stylus.Released){ // only show if released
			//PA_OutputText(1, 0, 19, "Shape Recognized : %s", letter); // Letter recognized
			PA_Clear8bitBg(0);
				if(letter=='0') {
					PA_StartSpriteAnimEx(1,0,0,4,15,ANIM_ONESHOT); 
				}   
				if(letter=='2') {
					PA_StartSpriteAnimEx(1,0,6,13,15,ANIM_ONESHOT);
				}			
		
		}		
		
		//PA_OutputText(1, 4, 22, "Shape : %s", PA_RecoShape); // Write the shape string
		
		if(Stylus.Held) {
			// Simple draw function, draws on the screen...
		PA_8bitDraw(0,1);  // Color : full red... 
		}   
		
		if(Pad.Held.Right) {
		  x+=2;
		}   
		
		if(Pad.Held.Left) {
		  x-=2;
		}   
		
		if(Pad.Held.Up) {
		  y-=2;
		}   
		
		if(Pad.Held.Down) {
		  y+=2;
		}   
		
		PA_SetSpriteXY(1,0,x,y); 
	
		PA_WaitForVBL();
	}
	
	return 0;
} // End of main()