add skelly bg
This commit is contained in:
parent
c54a7a7bd1
commit
0133fc9f14
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,3 +6,5 @@ build/
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|||||||
37
src/samples/background.h
Normal file
37
src/samples/background.h
Normal 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);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@ -3,6 +3,7 @@
|
|||||||
#include "engine/prefabs/includes.h"
|
#include "engine/prefabs/includes.h"
|
||||||
#include "entities/song.h"
|
#include "entities/song.h"
|
||||||
#include "rapidjson/filereadstream.h"
|
#include "rapidjson/filereadstream.h"
|
||||||
|
#include "background.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
@ -201,6 +202,7 @@ public:
|
|||||||
float miss_flash_timer[LANE_COUNT] = {0};
|
float miss_flash_timer[LANE_COUNT] = {0};
|
||||||
bool game_ended = false;
|
bool game_ended = false;
|
||||||
static constexpr float RESULTS_DELAY_AFTER_LAST_NOTE = 1.0f;
|
static constexpr float RESULTS_DELAY_AFTER_LAST_NOTE = 1.0f;
|
||||||
|
std::shared_ptr<Background> background;
|
||||||
|
|
||||||
void on_enter() override
|
void on_enter() override
|
||||||
{
|
{
|
||||||
@ -250,6 +252,10 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void init_services() override {
|
||||||
|
add_service<TextureService>();
|
||||||
|
}
|
||||||
|
|
||||||
void init() override
|
void init() override
|
||||||
{
|
{
|
||||||
auto font_manager = game->get_manager<FontManager>();
|
auto font_manager = game->get_manager<FontManager>();
|
||||||
@ -271,6 +277,8 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
chart = load_chart(GHHB_CHART_PATH);
|
chart = load_chart(GHHB_CHART_PATH);
|
||||||
|
background = add_game_object<Background>();
|
||||||
|
background->add_tag("background");
|
||||||
}
|
}
|
||||||
|
|
||||||
float lane_center_x(int lane) const
|
float lane_center_x(int lane) const
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user