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1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + diff --git a/assets/textures/actors/robberrodent.aseprite b/assets/textures/actors/robberrodent.aseprite deleted file mode 100644 index 61c7647..0000000 Binary files a/assets/textures/actors/robberrodent.aseprite and /dev/null differ diff --git a/assets/textures/actors/robberrodent.json b/assets/textures/actors/robberrodent.json deleted file mode 100644 index 7fb1943..0000000 --- a/assets/textures/actors/robberrodent.json +++ /dev/null @@ -1,68 +0,0 @@ -{ "frames": [ - { - "filename": "0", - "frame": { "x": 0, "y": 0, "w": 32, "h": 32 }, - "rotated": false, - "trimmed": false, - "spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 }, - "sourceSize": { "w": 32, "h": 32 }, - "duration": 100 - }, - { - "filename": "1", - "frame": { "x": 32, "y": 0, "w": 32, "h": 32 }, - "rotated": false, - "trimmed": false, - "spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 }, - "sourceSize": { "w": 32, "h": 32 }, - "duration": 100 - }, - { - "filename": "2", - "frame": { "x": 64, "y": 0, "w": 32, "h": 32 }, - "rotated": false, - "trimmed": false, - "spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 }, - "sourceSize": { "w": 32, "h": 32 }, - "duration": 100 - }, - { - "filename": "3", - "frame": { "x": 96, "y": 0, "w": 32, "h": 32 }, - "rotated": false, - "trimmed": false, - "spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 }, - "sourceSize": { "w": 32, "h": 32 }, - "duration": 100 - }, - { - "filename": "4", - "frame": { "x": 128, "y": 0, "w": 32, "h": 32 }, - "rotated": false, - "trimmed": false, - "spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 }, - "sourceSize": { "w": 32, "h": 32 }, - "duration": 100 - }, - { - "filename": "5", - "frame": { "x": 160, "y": 0, "w": 32, "h": 32 }, - "rotated": false, - "trimmed": false, - "spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 }, - "sourceSize": { "w": 32, "h": 32 }, - "duration": 100 - } - ], - "meta": { - "app": "http://www.aseprite.org/", - "version": "1.2.25-x64", - "image": "robberrodent.png", - "format": "RGBA8888", - "size": { "w": 192, "h": 32 }, - "scale": "1", - "frameTags": [ - { "name": "moveW", "from": 0, "to": 5, "direction": "forward" } - ] - } -} diff --git a/assets/textures/actors/robberrodent.png b/assets/textures/actors/robberrodent.png deleted file mode 100644 index e9f5125..0000000 Binary files a/assets/textures/actors/robberrodent.png and /dev/null differ diff --git a/assets/textures/arne32-palette.png b/assets/textures/arne32-palette.png new file mode 100644 index 0000000..b63f9f2 Binary files /dev/null and b/assets/textures/arne32-palette.png differ diff --git a/assets/textures/objects/beartrap.aseprite b/assets/textures/objects/beartrap.aseprite deleted file mode 100644 index bc24dea..0000000 Binary files a/assets/textures/objects/beartrap.aseprite and /dev/null differ diff --git a/assets/textures/objects/beartrap.gif b/assets/textures/objects/beartrap.gif deleted file mode 100644 index 00eb547..0000000 Binary files a/assets/textures/objects/beartrap.gif and /dev/null differ diff --git a/assets/textures/objects/beartrap.png b/assets/textures/objects/beartrap.png deleted file mode 100644 index 5b02e31..0000000 Binary files a/assets/textures/objects/beartrap.png and /dev/null differ diff --git a/assets/textures/objects/coffin.aseprite b/assets/textures/objects/coffin.aseprite deleted file mode 100644 index 34bb62e..0000000 Binary files a/assets/textures/objects/coffin.aseprite and /dev/null differ diff --git a/assets/textures/objects/coffin.png b/assets/textures/objects/coffin.png deleted file mode 100644 index bf051a8..0000000 Binary files a/assets/textures/objects/coffin.png and /dev/null differ diff --git a/assets/textures/objects/jewel.aseprite b/assets/textures/objects/jewel.aseprite deleted file mode 100644 index a0013f5..0000000 Binary files a/assets/textures/objects/jewel.aseprite and /dev/null differ diff --git a/assets/textures/objects/jewel.png b/assets/textures/objects/jewel.png deleted file mode 100644 index 3e566f5..0000000 Binary files a/assets/textures/objects/jewel.png and /dev/null differ diff --git a/assets/textures/objects/tree.png b/assets/textures/objects/tree.png deleted file mode 100644 index b463d64..0000000 Binary files a/assets/textures/objects/tree.png and /dev/null differ diff --git a/assets/textures/tiles/GS-tiles.png b/assets/textures/tiles/GS-tiles.png deleted file mode 100644 index a75bcc1..0000000 Binary files a/assets/textures/tiles/GS-tiles.png and /dev/null differ diff --git a/assets/textures/tiles/background-sky.aseprite b/assets/textures/tiles/background-sky.aseprite new file mode 100644 index 0000000..358cc5e Binary files /dev/null and b/assets/textures/tiles/background-sky.aseprite differ diff --git a/assets/textures/tiles/background-sky.png b/assets/textures/tiles/background-sky.png new file mode 100644 index 0000000..f3ae0f2 Binary files /dev/null and b/assets/textures/tiles/background-sky.png differ diff --git a/assets/textures/tiles/br-tiles.png b/assets/textures/tiles/br-tiles.png new file mode 100644 index 0000000..3320dfc Binary files /dev/null and b/assets/textures/tiles/br-tiles.png differ diff --git a/assets/textures/tiles/br-tiles.pyxel b/assets/textures/tiles/br-tiles.pyxel new file mode 100644 index 0000000..02925d9 Binary files /dev/null and b/assets/textures/tiles/br-tiles.pyxel differ diff --git a/assets/textures/ui/day-night-icon.aseprite b/assets/textures/ui/day-night-icon.aseprite deleted file mode 100644 index f44e3ca..0000000 Binary files a/assets/textures/ui/day-night-icon.aseprite and /dev/null differ diff --git a/assets/textures/ui/day-night-icon.png b/assets/textures/ui/day-night-icon.png deleted file mode 100644 index 4be54bb..0000000 Binary files a/assets/textures/ui/day-night-icon.png and /dev/null differ diff --git a/assets/textures/ui/font.ase b/assets/textures/ui/font.ase index 62faad7..bec458f 100644 Binary files a/assets/textures/ui/font.ase and b/assets/textures/ui/font.ase differ diff --git a/assets/textures/ui/tombstone-serif-render.png b/assets/textures/ui/tombstone-serif-render.png deleted file mode 100644 index 63b785a..0000000 Binary files a/assets/textures/ui/tombstone-serif-render.png and /dev/null differ diff --git a/assets/textures/ui/ui-element-cloud.aseprite b/assets/textures/ui/ui-element-cloud.aseprite new file mode 100644 index 0000000..759199a Binary files /dev/null and b/assets/textures/ui/ui-element-cloud.aseprite differ diff --git a/assets/textures/ui/ui-element-cloud.png b/assets/textures/ui/ui-element-cloud.png new file mode 100644 index 0000000..fa678c1 Binary files /dev/null and b/assets/textures/ui/ui-element-cloud.png differ diff --git a/assets/textures/ui/ui-element-tombstone.png b/assets/textures/ui/ui-element-tombstone.png deleted file mode 100644 index 1a07123..0000000 Binary files a/assets/textures/ui/ui-element-tombstone.png and /dev/null differ diff --git a/assets/textures/ui/ui-font-cloud-sans.png b/assets/textures/ui/ui-font-cloud-sans.png new file mode 100644 index 0000000..e675f2f Binary files /dev/null and b/assets/textures/ui/ui-font-cloud-sans.png differ diff --git a/assets/textures/ui/ui-font-tombstone-serif.png b/assets/textures/ui/ui-font-tombstone-serif.png deleted file mode 100644 index 39c40ba..0000000 Binary files a/assets/textures/ui/ui-font-tombstone-serif.png and /dev/null differ diff --git a/build/BeagleRescue b/build/BeagleRescue index 64debd5..d193499 100755 Binary files a/build/BeagleRescue and b/build/BeagleRescue differ diff --git a/src/config/config.json b/src/config/config.json index 6481779..0b0e538 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -1,6 +1,6 @@ { -"GameName":"Graveyard Shift", -"WindowName":"Graveyard Shift", +"GameName":"Beagle Rescue", +"WindowName":"Beagle Rescue", "WindowSize":{"w":320,"h":240}, "WindowFullScreen": 0, "GlobalScale": 4 diff --git a/src/ecs/SpriteComponent.h b/src/ecs/SpriteComponent.h index e95252b..575f431 100644 --- a/src/ecs/SpriteComponent.h +++ b/src/ecs/SpriteComponent.h @@ -45,6 +45,7 @@ public: spriteText, spriteObject, spriteTileMap, + spriteBackground, spriteActor, spriteAnimation, spriteAtlas @@ -157,7 +158,7 @@ public: destRect.w = letterWidth*scale; destRect.h = letterHeight*scale; break; - case spriteUIL0: case spriteUIL1: + case spriteUIL0: case spriteUIL1: case spriteBackground: break; case spriteActor: case spriteAnimation: case spriteAtlas: case spriteObject: case spriteTileMap: srcRect.x = srcRect.y = 0; @@ -173,7 +174,7 @@ public: { switch(spriteType) { - case spriteUIL0: case spriteUIL1: case spriteText: + case spriteUIL0: case spriteUIL1: case spriteText: case spriteBackground: destRect.x = static_cast(transform->position.x); destRect.y = static_cast(transform->position.y); break; diff --git a/src/game/Game.cpp b/src/game/Game.cpp index 9bb5c59..650dc10 100644 --- a/src/game/Game.cpp +++ b/src/game/Game.cpp @@ -42,10 +42,10 @@ auto& player(manager.addEntity()); auto& enemy(manager.addEntity()); -auto& scoreboard(manager.addEntity()); -auto& uiInfo(manager.addEntity()); +auto& background(manager.addEntity()); -auto& tree(manager.addEntity()); +// auto& scoreboard(manager.addEntity()); +auto& uiInfo(manager.addEntity()); bool Game::debugCollisionBoxes = false; @@ -94,17 +94,14 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g SDL_LogError(SDL_LOG_CATEGORY_ERROR, "Couldn't initialize SDL audio mixer!, Error: %s", SDL_GetError()); } - assets->AddTexture("terrain", "assets/textures/tiles/GS-tiles2.png"); + assets->AddTexture("terrain", "assets/textures/tiles/br-tiles.png"); assets->AddTexture("player", "assets/textures/actors/owl_anim.png"); - assets->AddTexture("font", "assets/textures/ui/ui-font-tombstone-serif.png"); - assets->AddTexture("textBox", "assets/textures/ui/ui-element-tombstone.png"); - assets->AddTexture("tree","assets/textures/objects/tree.png"); - assets->AddTexture("jewel","assets/textures/objects/jewel.png"); - assets->AddTexture("daynighticon","assets/textures/ui/day-night-icon.png"); - assets->AddTexture("robber","assets/textures/actors/robberrodent.png"); + assets->AddTexture("font", "assets/textures/ui/ui-font-cloud-sans.png"); + assets->AddTexture("textBox", "assets/textures/ui/ui-element-cloud.png"); assets->AddMusicTrack("simonZ","assets/audio/music/sailing16.ogg"); assets->AddSoundClip("bwoop","assets/audio/sfx/bwoop.wav"); - + assets->AddTexture("background","assets/textures/tiles/background-sky.png"); + map = new Map("terrain",globalScale,16); const char* myText = "Beagle Rescue"; @@ -116,39 +113,11 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g myDestRect.w = 140; myDestRect.h = 40; my9Slice = new UINineSlice("textBox"); - my9Slice->MakeSlices("textBox",128,128,16,111,16,111,myDestRect,globalScale); - - const char* sbText = "500"; - scoreboardText = new UIText(sbText, "font", 0, 0, 8, 12, globalScale); - scoreboardText->ParseString(sbText, 190, 22, globalScale); - SDL_Rect scoreboardDestRect = SDL_Rect(); - scoreboardDestRect.x = 164; - scoreboardDestRect.y = 8; - scoreboardDestRect.w = 140; - scoreboardDestRect.h = 40; - scoreboard9Slice = new UINineSlice("textBox"); - SDL_Rect jewelSrcRect = SDL_Rect(); - jewelSrcRect.x = 0; - jewelSrcRect.y = 0; - jewelSrcRect.w = 24; - jewelSrcRect.h = 22; - SDL_Rect jewelDestRect = SDL_Rect(); - jewelDestRect.x = 0; - jewelDestRect.y = 0; - jewelDestRect.w = 24*globalScale; - jewelDestRect.h = 22*globalScale; - scoreboard9Slice->MakeSlices("textBox",128,128,16,111,16,111,scoreboardDestRect,globalScale); - scoreboard.addComponent(172*globalScale,16*globalScale,24,22,globalScale); - scoreboard.addComponent("jewel", SpriteComponent::spriteUIL1, jewelSrcRect, jewelDestRect); - scoreboard.addGroup(groupUI_Layer1); - - tree.addComponent(292*globalScale,168*globalScale,192,142,globalScale); - tree.addComponent("tree",SpriteComponent::spriteObject); - tree.addGroup(groupObjects); + my9Slice->MakeSlices("textBox",32,32,14,17,14,17,myDestRect,globalScale); //ecs implementation - map->LoadMap("assets/maps/GS-Night.txt",48,32, globalScale); + map->LoadMap("assets/maps/br-map.txt",60,25, globalScale); player.addComponent(50*globalScale,50*globalScale,40,40,globalScale); player.addComponent("player", SpriteComponent::spriteAnimation, "assets/textures/actors/owl_anim.json"); @@ -156,9 +125,13 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g player.addComponent("player"); player.addGroup(groupPlayers); - enemy.addComponent(180*globalScale,180*globalScale,32,32,globalScale); - enemy.addComponent("robber", SpriteComponent::spriteAnimation, "assets/textures/actors/robberrodent.json"); - enemy.addGroup(groupEnemies); + + background.addComponent(0*globalScale,0*globalScale,320,240,globalScale); + background.addComponent("background", SpriteComponent::spriteObject); + background.addGroup(groupObjects); +// enemy.addComponent(180*globalScale,180*globalScale,32,32,globalScale); +// enemy.addComponent("robber", SpriteComponent::spriteAnimation, "assets/textures/actors/robberrodent.json"); +// enemy.addGroup(groupEnemies); } else { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't Initialize SDL: %s", SDL_GetError()); @@ -176,6 +149,7 @@ auto& enemies(manager.getGroup(Game::groupEnemies)); // auto& projectiles(manager.getGroup(Game::groupProjectiles)); auto& gui(manager.getGroup(Game::groupUI_Layer0)); auto& uiText(manager.getGroup(Game::groupUI_Layer1)); +auto& backgrounds(manager.getGroup(Game::groupBackground)); void Game::handleEvents() { @@ -226,7 +200,6 @@ void Game::update() camera.x = player.getComponent().position.x - camera.w/2; camera.y = player.getComponent().position.y - camera.h/2; - if(camera.x < 0) camera.x = 0; if (camera.y < 0) @@ -241,7 +214,18 @@ void Game::update() void Game::render() { SDL_RenderClear(renderer); - for (auto& t : tiles) + + for (auto& b : backgrounds) + { + b->draw(); + } + + for (auto& o : objects) + { + o->draw(); + } + + for (auto& t : tiles) { t->draw(); } @@ -252,11 +236,6 @@ void Game::render() c->draw(); } } - - for (auto& o : objects) - { - o->draw(); - } for (auto& e : enemies) { diff --git a/src/game/Game.hpp b/src/game/Game.hpp index 45f836a..8f3088e 100644 --- a/src/game/Game.hpp +++ b/src/game/Game.hpp @@ -47,6 +47,7 @@ public: groupColliders, groupProjectiles, groupObjects, + groupBackground, groupUI_Layer0, groupUI_Layer1 };