// 4-bit sprite viewer, just to demonstrate how to get a sprite on screen // This is an adaption of the 8-bit viewer I did, it just a slight cahnge in // the way the sprite is initialised // I know its all been done before but if you are still stuck this might help // Author : Paul Bircham [Doodle] // Date : 3/7/98 // Notice : Please feel free to use this source, or parts in your program // as long as a thanks in your demos credits are given to me // Contact : If you have any questions about this program feel free to e-mail me at doodlek@globalnet.co.uk // with any of your questions and I will try and answer them #include #include "pad.h" #define Screen_Width 320 // Screen resolution variables. #define Screen_Height 240 #define Sprite_Add 0x80090000 // memory address of sprite #define OT_LENGTH 2 //Ordering Table length #define MOVESPEED 1 #define TOP_WALL 15 // collision boundaries for the screen #define BOTTOM_WALL (Screen_Height-15) #define LEFT_WALL 15 // so sprite doesnt move off the screen #define RIGHT_WALL (Screen_Width-15) // PROTOTYPE FUNCTIONS void InitGraphics(); void InitOTs(); void InitControllers() ; void InitSprite(); void InitBox() ; void MoveSprite(); // GLOBALS AND SYSTEM RELATED STUFF GsOT WorldOT[2]; GsOT_TAG OTTags[2][1<BOTTOM_WALL) { sprite1.y = BOTTOM_WALL ; } else sprite1.y += MOVESPEED ; } if (PadStatus&PADLright) { if ((sprite1.x+MOVESPEED)>RIGHT_WALL) { sprite1.x = RIGHT_WALL ; } else sprite1.x += MOVESPEED ; } if (PadStatus&PADLleft) { if ((sprite1.x-MOVESPEED)