Ejemplo n.º 1
0
int init()
{
	srand(time(0) ^ getpid());
	
	if (SDL_Init(0) < 0)
	{
		fprintf(stderr, "Error initialising SDL: %s\n", SDL_GetError());
		return -1;
	}
	
	if (config_init() == -1 ||
		input_init() == -1 ||
	    graphics_init() == -1 ||
	    sound_init() == -1 ||
	    level_init() == -1 ||
	    bomber_init() == -1 ||
	    bomb_init() == -1)
	{
		return -1;
	}
	
	// load images/animations - its done up ^ in init's
	
	// init calc_delta_time
	calc_delta_time();
	
	return 0;
}
Ejemplo n.º 2
0
void bomb_plant(struct game* game, struct map* map, struct player* player) {
	int x = player_get_x(player);
	int y = player_get_y(player);

	if(player_get_nb_life(player) && player_get_nb_bomb(player) && map_get_cell_type(map, x, y) != CELL_BOMB && map_get_cell_type(map, x, y) != CELL_DOOR) { // if player has at least one bomb and he is not on a bomb
		bomb_init(game, map, x, y, BOMB_NORMAL, player_get_nb_range(player), player);
		map_set_cell_type(map, x, y, CELL_BOMB);
		player_dec_nb_bomb(player);
	}
}