OLEGSHA / Progressia

A GPL sandbox survival game
GNU General Public License v3.0
10 stars 4 forks source link

Audio #1

Closed nullkat closed 3 years ago

nullkat commented 3 years ago

It is a contribution of Audio Engine that you can use through AudioManager and sound objects: SoundEffect, Music.

  1. You have to load the audio data you want to use: AudioManager.loadSound("assets/sounds/block_destroy_clap.ogg", "Progressia:BlockDestroy", AudioFormat.MONO);
  2. Then you generate sound object: SoundEffect sfx = new SoundEffect("Progressia:BlockDestroy");
  3. Give it some options sfx.setPosition(getSelection().getPoint()); sfx.setPitch((float) (Math.random() + 1 * 0.5));
  4. Play sfx.play(false);