feat(effects): polvet transitori al despegue i a l'aterratge
This commit is contained in:
1 parent
c38c80753a
commit
3e379ce129
11 files changed
+209
-1
No files matched your search
@@ -579,6 +579,15 @@ void Player::startJump() {
|
||||
if (!jump_config.sound_key.empty() && Audio::get() != nullptr) {
|
||||
Audio::get()->playSound(jump_config.sound_key, Audio::Group::GAME);
|
||||
}
|
||||
// Avisem al bus perquè el GameScene puga spawnejar el polvet de
|
||||
// despegue al peu del jugador.
|
||||
if (bus_ != nullptr) {
|
||||
bus_->publish(Event{
|
||||
.name = "player_jumped",
|
||||
.payload = WorldPos{.x = getPosX() + (static_cast<float>(sprite_w) * 0.5F), .y = getGroundFeetY()},
|
||||
.player_id = id_,
|
||||
});
|
||||
}
|
||||
// Prou: la velocitat horitzontal del salt és la `intended_v*` actual
|
||||
// (input del frame). El facing també queda com està. Ja no es
|
||||
// tocaran fins a aterrar.
|
||||
@@ -676,6 +685,13 @@ auto Player::integrateJump(float delta_time) -> bool {
|
||||
if (!jump_config.land_sound_key.empty() && Audio::get() != nullptr) {
|
||||
Audio::get()->playSound(jump_config.land_sound_key, Audio::Group::GAME);
|
||||
}
|
||||
if (bus_ != nullptr) {
|
||||
bus_->publish(Event{
|
||||
.name = "player_landed",
|
||||
.payload = WorldPos{.x = getPosX() + (static_cast<float>(sprite_w) * 0.5F), .y = getGroundFeetY()},
|
||||
.player_id = id_,
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user