Tuesday, July 9, 2013

Integrating audio and physics

Implementation
  1. Setup One sound for every object
    1. This allows simultaneous sounds for all objects
  2. Setup arrays for similar objects
  3. Setup the appropriate looping for each object
  4. Load all the files e.g. droid, wall and crates
  5. Develop code that triggers each sound

One sound for every object

Maxim maxim;
AudioPlayer droidSound, wallSound;
AudioPlayer[] crateSounds;

Use arrays  for similar objects

crates = new Body[7];
crates[0] = physics.createRect(300, height-crateSize, 300+crateSize, height);

Sound Logic Pseudo-code

test for each object type
  cue player
  set speed of sound based on impulse
  play wall sound



No comments:

Post a Comment