Conversation
|
|
||
| namespace caveexpress { | ||
|
|
||
| const float min_lastSoundDT = 1.f; // time, sec |
There was a problem hiding this comment.
_lastSoundTime exists for this - why do we need a global var here?
There was a problem hiding this comment.
This is a const value for comparing later (twice):
if (_lastSoundDT > min_lastSoundDT) {
while _lastSoundTime is variable, added in Water::update by deltaTime.
There was a problem hiding this comment.
i see - but why do we need _lastSoundDT if we have _lastSoundTime (i don't see why it must be float, we should be able to re-use the existing var, no?)
|
|
looks nice. good job |
|
Fixed issues from comments. |
| // play the sound only once per second | ||
| if (_lastSoundTime < _time + 1000) { | ||
| _lastSoundTime = _time; | ||
| if (_lastSoundDT > min_lastSoundDT) { |
There was a problem hiding this comment.
sorry, I still don't see why this change is needed - what's wrong with the _lastSoundTime < _time + 1000 check here? why must it be float?
There was a problem hiding this comment.
It doesn't work. It triggers many sounds while in water.
I just used float and added dt in update to be sure. I didn't check why _time doesn't work.
Made a const above since it is used twice.
Code was mostly there.
Restored water splash particles and tweaked settings to look cool.
Mostly in water and a bit splash above, not sure why darker.
Looks even better when having packages or for diving.
Screens with refraction: