Untitled
Never
static void init() { // [HACKATHON 3-2] // TODO: Create button to settings // Uncomment and fill the code below btnSettings = button_create(730, 20, 50, 50, "Assets/settings.png", "Assets/settings2.png"); gr = load_bitmap("Assets/ghost_move_red.png"); grW = al_get_bitmap_width(gr); grH = al_get_bitmap_height(gr); gp = load_bitmap("Assets/ghost_move_pink.png"); gpW = al_get_bitmap_width(gp); gpH = al_get_bitmap_height(gp); go = load_bitmap("Assets/ghost_move_orange.png"); goW = al_get_bitmap_width(go); goH = al_get_bitmap_height(go); gb = load_bitmap("Assets/ghost_move_blue.png"); gbW = al_get_bitmap_width(gb); gbH = al_get_bitmap_height(gb); gameTitle = load_bitmap("Assets/title.png"); gameTitleW = al_get_bitmap_width(gameTitle); gameTitleH = al_get_bitmap_height(gameTitle); stop_bgm(menuBGM); menuBGM = play_bgm(themeMusic, music_volume); } static void draw() { al_clear_to_color(al_map_rgb(0, 0, 0)); const float scale = 0.7; const float offset_w = (SCREEN_W >> 1) - 0.5 * scale * gameTitleW; const float offset_h = (SCREEN_H >> 1) - 0.5 * scale * gameTitleH; //draw title image al_draw_scaled_bitmap( gameTitle, 0, 0, gameTitleW, gameTitleH, offset_w, offset_h, gameTitleW * scale, gameTitleH * scale, 0 ); //draw the words al_draw_text( menuFont, al_map_rgb(255, 255, 255), SCREEN_W / 2, SCREEN_H - 150, ALLEGRO_ALIGN_CENTER, "PRESS \"ENTER\"" ); drawButton(btnSettings); //draw animation int scale_gh = 4.0; ALLEGRO_TIMER * ghost_anim =al_create_timer(1.0f / 64); al_start_timer(ghost_anim); int con = al_get_timer_count(ghost_anim); al_draw_scaled_bitmap(gr, con / 8 * 16, 0, grW / 8, grH, 200, 200, grW / 8 * scale_gh, grH * scale_gh,0); al_draw_scaled_bitmap(gp, con / 8 * 16, 0, grW / 8, grH, 300, 200, grW / 8 * scale_gh, grH * scale_gh, 0); al_draw_scaled_bitmap(go, con / 8 * 16, 0, grW / 8, grH, 400, 200, grW / 8 * scale_gh, grH * scale_gh, 0); al_draw_scaled_bitmap(gb, con / 8 * 16, 0, grW / 8, grH, 500, 200, grW / 8 * scale_gh, grH * scale_gh, 0); }