Skip to content

Commit dbaaf57

Browse files
swagweenkarnkaul
andauthored
Adjust particle visuals (#23)
* change font and foam texture. add player styles. adjust enemy destruction emitters and player exhaust. # Conflicts: # src/spaced/spaced/game/hud.cpp * fix formatting # Conflicts: # src/spaced/spaced/scenes/game.cpp * fix game.cpp conflicts * add player tint * apply requested changes --------- Co-authored-by: Karn Kaul <karnkaul@gmail.com>
1 parent 3709ad8 commit dbaaf57

File tree

7 files changed

+22
-15
lines changed

7 files changed

+22
-15
lines changed

assets/fonts/Vera.ttf

-64.4 KB
Binary file not shown.

assets/fonts/hesitation.regular.ttf

20.8 KB
Binary file not shown.

assets/images/foam_bubble.png

-18.5 KB
Loading

assets/styles.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
}
3939
},
4040
"loading_screen": {
41-
"background_tint": "#1a1a1aff",
41+
"background_tint": "#231d2aff",
4242
"spinner": {
4343
"size": [
4444
100.000000,
@@ -53,4 +53,4 @@
5353
"outline_width": 10
5454
}
5555
}
56-
}
56+
}

src/spaced/spaced/game/player.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <bave/platform.hpp>
44
#include <spaced/game/player.hpp>
55
#include <spaced/services/resources.hpp>
6+
#include <spaced/services/styles.hpp>
67

78
// temp for testing
89
#include <spaced/game/weapons/gun_beam.hpp>
@@ -94,24 +95,27 @@ void Player::do_inspect() {
9495
}
9596

9697
void Player::setup_ship() {
98+
auto const& rgbas = m_services->get<Styles>().rgbas;
9799
auto const& layout = m_services->get<ILayout>();
98-
auto const x = layout.get_player_x();
99-
ship.transform.position.x = x;
100+
ship.transform.position.x = layout.get_player_x();
100101
auto rounded_quad = RoundedQuad{};
101102
rounded_quad.size = layout.get_player_size();
102103
rounded_quad.corner_radius = 20.0f;
104+
ship.tint = rgbas["black"];
103105
ship.set_shape(rounded_quad);
104106
}
105107

106108
void Player::setup_foam() {
107109
using Modifier = ParticleEmitter::Modifier;
108-
foam_particles.config.quad_size = glm::vec2{20.0f};
110+
foam_particles.config.quad_size = glm::vec2{80.f};
109111
foam_particles.config.velocity.linear.angle = {Degrees{80.0f}, Degrees{100.0f}};
110-
foam_particles.config.velocity.linear.speed = {-200.0f, -100.0f};
111-
foam_particles.config.ttl = {1s, 2s};
112+
foam_particles.config.velocity.linear.speed = {-360.0f, -270.0f};
113+
foam_particles.config.ttl = {2s, 3s};
114+
foam_particles.config.lerp.scale.hi = glm::vec2{0.5f};
115+
foam_particles.config.count = 80;
116+
auto const& rgbas = m_services->get<Styles>().rgbas;
117+
foam_particles.config.lerp.tint = {rgbas["black"], rgbas["black"]};
112118
foam_particles.config.lerp.tint.hi.channels.w = 0x0;
113-
foam_particles.config.lerp.scale.hi = {};
114-
foam_particles.config.count = 500;
115119
foam_particles.modifiers = {Modifier::eTranslate, Modifier::eTint, Modifier::eScale};
116120
foam_particles.set_position(get_exhaust_position());
117121
foam_particles.pre_warm();

src/spaced/spaced/scenes/game.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ using bave::KeyMods;
1919
using bave::PointerMove;
2020
using bave::PointerTap;
2121
using bave::Ptr;
22-
using bave::Rgba;
22+
using bave::random_in_range;
2323
using bave::Seconds;
2424
using bave::Shader;
2525
using bave::Texture;
@@ -56,16 +56,19 @@ void Game::on_loaded() {
5656
m_player.foam_particles.set_texture(foam_texture);
5757

5858
auto const& rgbas = get_services().get<Styles>().rgbas;
59-
auto spawn = [this] {
59+
auto spawn = [this, &rgbas] {
6060
auto ret = std::make_unique<Creep>(get_services(), this);
61-
ret->shape.tint = bave::yellow_v;
61+
ret->shape.tint = random_in_range(0, 1) == 0 ? rgbas["orange"] : rgbas["milk"];
6262
return ret;
6363
};
6464
auto emitter = bave::ParticleEmitter{};
65-
emitter.config.ttl = {0.5s, 1s};
65+
emitter.config.velocity.linear.speed = {-360.0f, -80.0f};
66+
emitter.config.ttl = {0.5s, 3s};
67+
emitter.config.count = 40;
6668
emitter.set_texture(foam_texture);
6769
emitter.config.lerp.tint = {rgbas["orange"], rgbas["milk"]};
68-
emitter.config.lerp.tint.hi.channels.w = 0x0;
70+
emitter.config.lerp.scale.hi = glm::vec2{0.7f};
71+
emitter.config.lerp.tint.hi.channels.w = 0xff;
6972
m_enemy_spawner.emplace(spawn, std::move(emitter));
7073

7174
auto hud = std::make_unique<Hud>(get_services());

src/spaced/spaced/spaced.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void Spaced::render() const { m_scene->render_frame(); }
114114
void Spaced::load_resources() {
115115
auto const loader = Loader{&get_app().get_data_store(), &get_app().get_render_device()};
116116
auto resources = std::make_unique<Resources>();
117-
resources->main_font = loader.load_font("fonts/Vera.ttf");
117+
resources->main_font = loader.load_font("fonts/hesitation.regular.ttf");
118118
resources->spinner = loader.load_texture("images/spinner.png", true);
119119
m_resources = resources.get();
120120
m_services.bind<Resources>(std::move(resources));

0 commit comments

Comments
 (0)