void main()
{
    printf("Welcome to GAMEBOY\nProgramming");
    printf("\n-------------------\n");
    printf("  (\\" "\\" "_/)    (\\" "\\" "_/)\n");
    printf("  (0.o)    (0.o)\n");
    printf("  (> <)    (> <)\n");
    printf("-------------------\n");
    printf("PROGRAMED BY JAMES \n");
    printf("\nPress Start");
    waitpad(J_START);  // other keys are J_A, J_UP, J_SELECT, etc.
    //printf("\nIsn't it easy!");

    // Turn the display off
    DISPLAY_OFF;

    // Load up the tile data
    set_bkg_data(0,255,logo_tile_data);

    // Switch to VRAM
    VBK_REG = 1;

    // Switch out of VRAM
    VBK_REG = 0;

    // Set screen x,y pos to 0,0 and draw the map 20,18(size of the screen)
    set_bkg_tiles(0,0,20,18,logo_map_data);

    // Show the background
    SHOW_BKG;

    // Turn the display on
    DISPLAY_ON;
}
Ejemplo n.º 2
0
/* Main function */
void main(void)
{
	/* Initialize pseudo "random" number generator */
  	printf("\nWelcome to DruggoGB...\n");
  	waitpad(J_A);
  	waitpadup();
  	puts("...");
  	waitpad(J_A);
  	waitpadup();
  	/* Seed with the DIV register. Gameboy PSRNG has extremely low entropy */
  	seed |= (UWORD)DIV_REG << 8;
  	/* Call initrand passing the div register as the seed */
  	initrand(seed);
  	/* Start the game */
  	startGame();
}
Ejemplo n.º 3
0
void main() {
	int i, j;
	for (i = 0; i < WIDTH*HEIGHT; ++i){
		printf("%c", i);
		waitpad(J_UP);
		waitpadup();
	}
}
Ejemplo n.º 4
0
/*--------------------------------------------------------*/
void RANSUU_INIT() //乱数の初期化 このやり方はSDKのexampleフォルダの中にあります
{
	waitpad(J_A);
	seed.b.l = DIV_REG;
	waitpadup();
	seed.b.h = DIV_REG;

	initarand(seed.w);   // 乱数の初期化

}
void main(){
	int xpos = 8 + GRAPHICS_WIDTH / 2;
	int ypos = 16 + GRAPHICS_HEIGHT / 2;
	int count = 0;
	int joy, i;
	set_sprite_data(0, 1, crosshair_tiledata);
	set_sprite_data(1, 6, explode_tiledata);
	SWITCH_ROM_MBC1(3);
	set_bkg_data(0, 179, title_tiledata);
	set_bkg_tiles(0, 0, 20, 18, title_tilemap);
	SHOW_BKG;
	DISPLAY_ON;
	waitpad(J_START);
	DISPLAY_OFF;
	SWITCH_ROM_MBC1(2);
	set_bkg_data(0, 182, earth_tiledata);
	set_bkg_tiles(0, 0, 20, 18, earth_tilemap);
	set_sprite_tile(0,0);
	move_sprite(0, xpos, ypos);
	SHOW_SPRITES;
	DISPLAY_ON;
	waitpadup();
	while (1){
		wait_vbl_done();
		joy = joypad();
		if (joy & J_UP && ypos > 14)
			--ypos;
		if (joy & J_DOWN && ypos < GRAPHICS_HEIGHT + 13)
			++ypos;
		if (joy & J_LEFT && xpos > 8)
			--xpos;
		if (joy & J_RIGHT && xpos < GRAPHICS_WIDTH + 8)
			++xpos;
		if (joy & J_A || joy & J_B){
			++count;
			move_sprite(count, xpos - 2, ypos - 2);
			for (i = 1; i != 7; ++i){
				set_sprite_tile(count, i);
				wait_vbl_done();
				wait_vbl_done();
			}
			set_sprite_tile(count, 4);
			set_sprite_prop(count, 1 << 4);
			if (count == 39){
				delay(500);
				end();
			}
		}		
		move_sprite(0, xpos, ypos);
	}
}
Ejemplo n.º 6
0
void takeDrug()
{
	randNum = randw()%30; /* Random number modulo 30 is to dertermine fatality */
	drug = randNum%NUMDRUGS; /* Random number modulo 5 (current num of drugs) to dertermine which drug */
	name = drugName[drug]; /* String representing the name of current drug */
	/* Dertermine fatality based on what drug is choosen */
	switch(drug)
	{
		case 0: /* Weed is never fatal */
			fatal = 0;
			break;
		case 1: /* Legals have a 1/30 chance of fatal */
			fatal = (randNum == 5);
			break;
		case 2: /* Alcohol has a 2/30 chance of fatal */
			fatal = (randNum == 10 || randNum == 15);
			break;
		case 3: /* Amphetamine has a 3/30 chance of fatal */
			fatal = (randNum == 3 || randNum == 7 || randNum == 10);
			break;
		case 4: /* Shrooms also have 3/30 */
			fatal = (randNum == 5 || randNum ==9 || randNum == 1);
			break;
		default: /* Fail safe */
			fatal = 0;
			break;
	}
	/* If drug is fatal, inform player, and set mortality bit. Don't increment score */
	if(fatal)
	{ 
		printf("\n\nGOT SO MUNTED FROM\n%s\n",name);
		waitpad(J_A);
		printf("\nYOU WERE FOUND DEAD");
		waitpad(J_A);
		printf("\nIN A POOL OF PISS\n");
		dead=1;
	}
	/* If drug isn't fatal, update score and tell player */
	else 
	{
		++drugsTaken;
		munterPoints += drugPoints[drug];
		moneySpent += drugCost[drug];
		printf("\n\nMean you sussed\n%s\n",name);	
	}
	/* Display score */
	waitpad(J_A);
	printf("\nDrugs Taken:%d",drugsTaken);
	waitpad(J_A);
	printf("\nSpent:$%d ",moneySpent);
	waitpad(J_A);
	printf("\nPoints:%d",munterPoints);
	waitpad(J_A);

}
Ejemplo n.º 7
0
void startGame()
{
	printf("\nSTART!");
	/* Initialize game variables */
	dead = 0;
	munterPoints = 0;
	drugsTaken = 0;
	moneySpent = 0;
	/* Keep taking drugs until player succumbs to over dose */
	while(1){ 
		waitpad(J_A);
		takeDrug();
		printf("\n");
		if(dead) break; 
	} /* Game over man, game over */
	printf("\n\nGame over");
}
Ejemplo n.º 8
0
/**
 * Draws the title screen
 * and halts until START is pushed.
 */
void showTitle() {
	UWORD seed;

	// Load titlescreen and seed RNG
	DISPLAY_OFF;
	LCDC_REG = B8(01000001);
	set_bkg_data(0, title_dataLen, title_data);
	set_bkg_tiles(0, 0, 20, 18, title_tiles);
	DISPLAY_ON;

	waitpad(J_START);
	seed = DIV_REG;

	waitpadup();
	seed |= (UWORD)DIV_REG << 8;
	initarand(seed);
}
Ejemplo n.º 9
0
void main(void){
	UBYTE i, x, y, dx, dy;
	
    printf("Press start!"); 
	waitpad(J_START);
	plot (10, 10, WHITE);
	plot (20, 10, LTGREY);
	plot (30, 10, DKGREY);
	plot (40, 10, BLACK);
	
	x=50;
	y=50;
	dx=1;
	dy=0;
	
	while (1) {
		i = joypad();
		if(i & J_UP){
			dx=0;
			dy=-1;
		}
		if(i & J_DOWN){
			dx=0;
			dy=1;
		}
		if(i & J_LEFT){
			dx=-1;
			dy=0;
		}
		if(i & J_RIGHT){
			dx=1;
			dy=0;
		}
		
		x += dx;
		y += dy;
		
		plot(x,y,BLACK);
		
		delay(50);
	}
}
Ejemplo n.º 10
0
void main() {
	printf("Simple test program\n");
	printf("Press Start\n");
	waitpad(J_START);
	printf("Done");
}