crystal-bit / space-shooter

Shoot 'em up game, developed for the Hacktoberfest 2019 event with the Crystal Bit community.
GNU General Public License v3.0
41 stars 34 forks source link

Add audio fade in-out #96

Closed gVirtu closed 5 years ago

gVirtu commented 5 years ago

First off, awesome repo idea, congratulations! :grinning:

I'd never used Godot before and felt like tackling one of the issues, so I picked #94 .

I'm not sure if this is the best way to do it, but I implemented the fade in/out via tweening the volume_db property of the AudioStreamPlayers in the Main scene and Level1 as well.

One challenge was triggering the tween from the SpaceShip since the stream player belongs to the parent (level node), so I experimented with signals and they seemed to be a good fit.

I'm open to any and all feedback to improve this! Cheers! :)


Closes #94

davcri commented 5 years ago

@gVirtu thanks for your help! The code works and the ideas that you had are perfect. Using signals and tweens is an excellent, I'm accepting this.

The only thing that I would improve are:

  1. Code style following the official Godot guidelines (see the README for the link)
  2. The Tween node should be a child of the AudioStreamPlayer (because it's used mainly for tweening that node): in this way it would be possible also to create a separate reusable scene
gVirtu commented 5 years ago

@davcri thank you for the review!! I'll try to get the improvements done soon. 😃