3 ms·
In a video game company, something like (it was in Action Script, I don't remember the exact syntax of that language): public class ScoreManager {
by S4M 12y ago
In a video game company, something like (it was in Action Script, I don't remember the exact syntax of that language):
public class ScoreManager {
//some statements
public void updateScore(Action action) {
int n = action.entityDestroyed;
if n < n1 {
playSound1();
score += 100*n;
} else {
playSound2();
score += 200*n;
}
}
}
I had to deal with that piece of code for something, and asked the developer to move the functions playing the sound out of the ScoreManager class so I could reuse it, and he categorically refused without giving me any explanation.
EDIT: typos