Animated scenes can easily make floors that do things, floors with moving elements, but I need to improve the easing/motion parts of the animations.
This commit is contained in:
parent
2d836a9e2a
commit
f8158a3ea9
4 changed files with 23 additions and 21 deletions
|
|
@ -197,14 +197,14 @@
|
|||
},
|
||||
"test_floor": {
|
||||
"_type": "Animation",
|
||||
"easing": 0,
|
||||
"easing": 2,
|
||||
"ease_rate": 0.5,
|
||||
"scale_x": 1.0,
|
||||
"scale_y": 1.0,
|
||||
"max_scale": 0.4,
|
||||
"max_scale": 1.01,
|
||||
"simple": true,
|
||||
"frames": 1,
|
||||
"speed": 1.0,
|
||||
"speed": 0.01,
|
||||
"stationary": true,
|
||||
"toggled": false,
|
||||
"looped": false
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@
|
|||
"[floor4|player5|player6|player7|player8|_]"
|
||||
],
|
||||
"background": "test_background",
|
||||
"floor": false,
|
||||
"floor_pos": "floor1",
|
||||
"actors": [
|
||||
{
|
||||
"name": "boss",
|
||||
|
|
@ -21,7 +19,8 @@
|
|||
"scale_x": 0.6,
|
||||
"scale_y": 0.6,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
"y": 0,
|
||||
"at_mid": false
|
||||
},
|
||||
{
|
||||
"name": "player",
|
||||
|
|
@ -30,7 +29,8 @@
|
|||
"scale_x": 0.5,
|
||||
"scale_y": 0.5,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
"y": 0,
|
||||
"at_mid": false
|
||||
}
|
||||
],
|
||||
"fixtures": [
|
||||
|
|
@ -41,7 +41,8 @@
|
|||
"scale_y": 0.5,
|
||||
"cell": "torch1",
|
||||
"x": 66,
|
||||
"y": -50
|
||||
"y": -50,
|
||||
"at_mid": false
|
||||
},
|
||||
{
|
||||
"name": "torch_fixture",
|
||||
|
|
@ -50,7 +51,8 @@
|
|||
"scale_y": 0.5,
|
||||
"cell": "torch2",
|
||||
"x": 132,
|
||||
"y": -30
|
||||
"y": -30,
|
||||
"at_mid": false
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -261,9 +261,9 @@
|
|||
"frame_height": 832
|
||||
},
|
||||
"test_floor":
|
||||
{"path": "assets/bossfights/test_floor.png",
|
||||
"frame_width": 1920,
|
||||
"frame_height": 1080
|
||||
{"path": "assets/boss2/boss_fight_scene_1_floor.png",
|
||||
"frame_width": 1080,
|
||||
"frame_height": 720
|
||||
},
|
||||
"test_player":
|
||||
{"path": "assets/bossfights/test_player.png",
|
||||
|
|
|
|||
18
scene.cpp
18
scene.cpp
|
|
@ -6,8 +6,6 @@ const bool DEBUG=false;
|
|||
const bool YOU_REMOVED_MID_CELL_IDIOT=false;
|
||||
|
||||
namespace scene {
|
||||
using namespace guecs;
|
||||
|
||||
Element config_scene_element(nlohmann::json& config, bool and_play, bool duped) {
|
||||
std::string sprite_name = config["sprite"];
|
||||
auto st = textures::get_sprite(sprite_name, duped);
|
||||
|
|
@ -26,7 +24,9 @@ namespace scene {
|
|||
std::string cell = config["cell"];
|
||||
std::string name = config["name"];
|
||||
|
||||
return {name, st, anim, cell, scale_x, scale_y, x, y};
|
||||
bool at_mid = config["at_mid"];
|
||||
|
||||
return {name, st, anim, cell, scale_x, scale_y, x, y, at_mid};
|
||||
}
|
||||
|
||||
Engine::Engine(components::AnimatedScene& scene) :
|
||||
|
|
@ -52,24 +52,24 @@ namespace scene {
|
|||
|
||||
void Engine::init() {
|
||||
$ui.position(SCREEN_WIDTH-BOSS_VIEW_WIDTH,0, BOSS_VIEW_WIDTH, SCREEN_HEIGHT);
|
||||
$ui.set<Background>($ui.MAIN, {$ui.$parser, THEME.TRANSPARENT});
|
||||
auto& background = $ui.get<Background>($ui.MAIN);
|
||||
$ui.set<guecs::Background>($ui.MAIN, {$ui.$parser, guecs::THEME.TRANSPARENT});
|
||||
auto& background = $ui.get<guecs::Background>($ui.MAIN);
|
||||
background.set_sprite($scene.background, true);
|
||||
|
||||
$ui.layout($layout);
|
||||
|
||||
for(auto& actor : $actors) {
|
||||
actor.pos = position_sprite(actor.st, actor.cell,
|
||||
actor.scale_x, actor.scale_y, false, actor.x, actor.y);
|
||||
actor.scale_x, actor.scale_y, actor.at_mid, actor.x, actor.y);
|
||||
}
|
||||
|
||||
for(auto& fixture : $fixtures) {
|
||||
fixture.pos = position_sprite(fixture.st, fixture.cell,
|
||||
fixture.scale_x, fixture.scale_y, false, fixture.x, fixture.y);
|
||||
fixture.scale_x, fixture.scale_y, fixture.at_mid, fixture.x, fixture.y);
|
||||
}
|
||||
}
|
||||
|
||||
bool Engine::mouse(float x, float y, Modifiers mods) {
|
||||
bool Engine::mouse(float x, float y, guecs::Modifiers mods) {
|
||||
return $ui.mouse(x, y, mods);
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ namespace scene {
|
|||
void Engine::move_actor(const std::string& actor, const std::string& cell_name) {
|
||||
auto& config = $actors.at($actor_name_ids.at(actor));
|
||||
config.cell = cell_name;
|
||||
config.pos = position_sprite(config.st, config.cell, config.scale_x, config.scale_y, YOU_REMOVED_MID_CELL_IDIOT);
|
||||
config.pos = position_sprite(config.st, config.cell, config.scale_x, config.scale_y, config.at_mid);
|
||||
}
|
||||
|
||||
void Engine::animate_actor(const std::string& actor) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue