From c0880cbf90f827966d408dc1f44b976b9532fb69 Mon Sep 17 00:00:00 2001 From: Zegis Date: Mon, 28 Apr 2014 00:58:13 +0200 Subject: [PATCH] Add better sprites --- Game.cpp | 11 ++++------- Game.h | 1 + TileMap.cpp | 12 +++++------- TileMap.h | 1 + follower.png | Bin 0 -> 878 bytes grass.png | Bin 0 -> 988 bytes map02.txt | 4 ++-- player.png | Bin 0 -> 1988 bytes rock.png | Bin 0 -> 600 bytes treasure.png | Bin 0 -> 2719 bytes 10 files changed, 13 insertions(+), 16 deletions(-) create mode 100644 follower.png create mode 100644 grass.png create mode 100644 player.png create mode 100644 rock.png create mode 100644 treasure.png diff --git a/Game.cpp b/Game.cpp index 30521e2..354eea2 100644 --- a/Game.cpp +++ b/Game.cpp @@ -15,13 +15,9 @@ Game::Game(void): MAXLVL(2) al_register_event_source(evQueue, al_get_keyboard_event_source()); al_register_event_source(evQueue, al_get_timer_event_source(timer)); - playerBMP = al_create_bitmap(50,50); - al_set_target_bitmap(playerBMP); - al_draw_filled_circle(25,25,25,al_map_rgb(255,255,255)); + playerBMP = al_load_bitmap("player.png"); - followerBMP = al_create_bitmap(50,50); - al_set_target_bitmap(followerBMP); - al_draw_filled_ellipse(25,25,25,15,al_map_rgb(187,52 ,224)); + followerBMP = al_load_bitmap("follower.png"); font = al_load_ttf_font("pirulen.ttf",40,0); msgFont = al_load_ttf_font("pirulen.ttf", 18,0); @@ -42,6 +38,7 @@ bool Game::InitializeAllegro() { al_init_font_addon(); al_init_ttf_addon(); + al_init_image_addon(); return true; } @@ -245,7 +242,7 @@ bool Game::CheckForTileCollision(int newX, int newY, bool isFollower) else if(map->getTile(newX,newY) == map->air) return true; - else if(map->getTile(newX,newY) == map->ground && !isFollower) + else if( (map->getTile(newX,newY) == map->ground || map->getTile(newX,newY) == map->grass ) && !isFollower) { map->BreakTile(newX,newY); return true; diff --git a/Game.h b/Game.h index 219a4cf..bac0508 100644 --- a/Game.h +++ b/Game.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "Sprite.h" #include "TileMap.h" #include diff --git a/TileMap.cpp b/TileMap.cpp index df48f49..6105c15 100644 --- a/TileMap.cpp +++ b/TileMap.cpp @@ -7,17 +7,14 @@ TileMap::TileMap(void) al_set_target_bitmap(ground); al_clear_to_color(al_map_rgb(173,102,9)); - treasure = al_create_bitmap(50,50); - al_set_target_bitmap(treasure); - al_clear_to_color(al_map_rgb(231,242,7)); + treasure = al_load_bitmap("treasure.png"); air = al_create_bitmap(50,50); al_set_target_bitmap(air); al_clear_to_color(al_map_rgb(82,223,255)); - rock = al_create_bitmap(50,50); - al_set_target_bitmap(rock); - al_clear_to_color(al_map_rgb(165,172,173)); + rock = al_load_bitmap("rock.png"); + grass = al_load_bitmap("grass.png"); } @@ -68,6 +65,7 @@ void TileMap::LoadMap(string mapName, Sprite* player, Sprite* follower) } else if (mapLine[i] == '0') Images[y][i] = ground; else if (mapLine[i] == 'R') Images[y][i] = rock; + else if (mapLine[i] == 'G') Images[y][i] = grass; else if (mapLine[i] == '1'){ Images[y][i] = air; objects.push_back(new Sprite(treasure,i,y)); @@ -80,7 +78,7 @@ void TileMap::LoadMap(string mapName, Sprite* player, Sprite* follower) void TileMap::BreakTile(int x, int y) { - if(Images[y][x] == ground) + if(Images[y][x] == ground || Images[y][x] == grass) Images[y][x] = air; } diff --git a/TileMap.h b/TileMap.h index 9426e23..4dd680d 100644 --- a/TileMap.h +++ b/TileMap.h @@ -27,6 +27,7 @@ class TileMap ALLEGRO_BITMAP* getTile(int x, int y); ALLEGRO_BITMAP* ground; + ALLEGRO_BITMAP* grass; ALLEGRO_BITMAP* treasure; ALLEGRO_BITMAP* air; ALLEGRO_BITMAP* rock; diff --git a/follower.png b/follower.png new file mode 100644 index 0000000000000000000000000000000000000000..0a93453ed5ae5b627ab50977832e6e1f21785656 GIT binary patch literal 878 zcmV-!1CjiRP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^o5 z7Bn}FL@1j80013nR9JLFZ*6U5Zgc_CX>@2HM@dakWG-a~0008T zNkl>-0$_T_(PS(yVgg}fDZojvs+PBHSZqbi z2E^p4#w<)R#$oVm#_sBN4FDG5wSx3}i2>2ccDRCJEFey5#sy|Qp&lZ(YPDGf+iV8_ z0A*7kab4qga$+Z41jB8%1Jyl@oIFmG5%n&{Ae7tO@Ap(@a4baG6aWBla(rqW@b-8y zV8bw0xZ0gmAXcjtba~zTcOo;!ciU{&gLr$q=(}p4&L6A{9G)X}tuC*j%WGKMl060H zpaN*yC7VDmuh0J&yaLl^6~M;bpiOM3jhF95-4Qc`?xNQ=+aR)HR4K(qm)9VCqq0rM zRr~ShyOk;G1}Iyj$hKB0(`FSJ(0d>N0B$ySP&UP2J_;KYbu!Jj9>oo8vkJJf*^}c_ zfb)mJ{mtesN~SCgkzV-hoK20C$9j2vj(UnBAz@=?V=_hQnNc=l)77#mz{hL(3ay0# zW1yzyQwZ}lLCFDqGfuqxvLbzWc6HldKiywDE%NjCo-CucjT{!4ygs|Sg{S-LzU!d$ z@AUie^Az<6iIr50gceqq$VQwCE9Vx|bEy<1MH~@ov9c+g7M_JRih6M~qisqW)rzc6 zA}J#(>bj=qoN@^c5T+bRI~^gV=W`#KBB9g%vW*hcRsTFNI84fsufs`2YX_07*qoM6N<$ Ef}JjV2><{9 literal 0 HcmV?d00001 diff --git a/grass.png b/grass.png new file mode 100644 index 0000000000000000000000000000000000000000..cb4c16023a96d9896e8100771a3d25fba3225f77 GIT binary patch literal 988 zcmV<210(#2P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^o5 z7B2#F!6zaB0013nR9JLFZ*6U5Zgc_CX>@2HM@dakWG-a~0009s zNkl27GL=w6ILksPcw$r)S1(c6=rqgLVB$9hKO*_5koadbP+?+e) z<%0lQiz=A8+KlCn0Cr^&zMO%cbq&L@1kP_{q39IFwH8(IVIYE^7n;zX$m8Zx67e<} z-@8@hydvCQ+GG}iM=}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