예제 #1
0
/*--------------------------------------------------------*/
void RANSUU_INIT() //乱数の初期化 このやり方はSDKのexampleフォルダの中にあります
{
	waitpad(J_A);
	seed.b.l = DIV_REG;
	waitpadup();
	seed.b.h = DIV_REG;

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

}
예제 #2
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);
}
예제 #3
0
int main (void) {
	char* p = bg_map;
	
	//Setup rand
	rand_seed = DIV_REG;
	
	//Turn off
	disable_interrupts();
	DISPLAY_OFF;
	
	//Setup LCD
	SHOW_BKG;
	SHOW_SPRITES;
	SHOW_WIN;
	
	//Load bg
	BGP_REG = OBP1_REG = 0xE4;
	OBP0_REG = 0xE1;
	
	set_bkg_data(0, background_tileset_size, background_tileset);
	for (y = 0; y < bg_map_height; ++y ) {
		set_bkg_tiles(0, y, bg_map_width, 1, p);
		p += bg_map_width;
	}
	
	//Load window
	x = 0;
	for (i = 0; i < 21; ++i ) {
		set_win_tiles(x, 0, ground_map_width, ground_map_height, ground_map);
		x += ground_map_width;
	}
	WX_REG = 0;
	WY_REG = 120;
	
	//Load Sprite
	
	set_sprite_data(0, sprites_size, sprites_data);
	SPRITES_8x16;
	
	//Load Bird
	
	setupBird();
	
	//Reset
	resetGame();
	
	//Turn on display
	DISPLAY_ON;
	enable_interrupts();
	
	//Finish rand
	rand_seed |= DIV_REG << 8;
	initarand(rand_seed);
	
	//RunLoop
	while (1) {
		joy = joypad();
		wait_vbl_done();
		
		switch (gameState) {
			case GAME_STATE_INTRO: {
				introLoop();
			}
				break;
			case GAME_STATE_GAME: {
				gameLoop();
			}
				break;
			case GAME_STATE_DEAD: {
				deadLoop();
			}
				break;
		}
	}
	
	return 0;
}