add skelly bg

This commit is contained in:
James Whiteman 2026-01-31 03:21:21 -08:00
parent c54a7a7bd1
commit 0133fc9f14
3 changed files with 48 additions and 1 deletions

4
.gitignore vendored
View File

@ -5,4 +5,6 @@ build/
# MacOS Cache
.DS_Store
compile_commands.json
compile_commands.json
*.swp
*.swo

37
src/samples/background.h Normal file
View File

@ -0,0 +1,37 @@
#pragma once
#include "engine/prefabs/includes.h"
class Background : public GameObject {
public:
AnimationController *animation;
void init() override {
animation = add_component<AnimationController>();
animation->add_animation("skelly", std::vector<std::string>{
"assets/skelly/skel_1.png",
"assets/skelly/skel_2.png",
"assets/skelly/skel_3.png",
"assets/skelly/skel_4.png",
"assets/skelly/skel_5.png",
"assets/skelly/skel_6.png",
"assets/skelly/skel_7.png",
"assets/skelly/skel_8.png",
"assets/skelly/skel_9.png",
"assets/skelly/skel_10.png",
"assets/skelly/skel_11.png",
"assets/skelly/skel_12.png",
"assets/skelly/skel_13.png",
"assets/skelly/skel_14.png",
"assets/skelly/skel_15.png",
"assets/skelly/skel_16.png",
"assets/skelly/skel_17.png",
"assets/skelly/skel_18.png",
"assets/skelly/skel_19.png",
"assets/skelly/skel_20.png",
"assets/skelly/skel_21.png",
"assets/skelly/skel_22.png"
}, 10.0f);
}
};

View File

@ -3,6 +3,7 @@
#include "engine/prefabs/includes.h"
#include "entities/song.h"
#include "rapidjson/filereadstream.h"
#include "background.h"
#include <algorithm>
#include <cstdio>
#include <unordered_set>
@ -201,6 +202,7 @@ public:
float miss_flash_timer[LANE_COUNT] = {0};
bool game_ended = false;
static constexpr float RESULTS_DELAY_AFTER_LAST_NOTE = 1.0f;
std::shared_ptr<Background> background;
void on_enter() override
{
@ -250,6 +252,10 @@ public:
}
}
void init_services() override {
add_service<TextureService>();
}
void init() override
{
auto font_manager = game->get_manager<FontManager>();
@ -271,6 +277,8 @@ public:
}
}
chart = load_chart(GHHB_CHART_PATH);
background = add_game_object<Background>();
background->add_tag("background");
}
float lane_center_x(int lane) const