I just started to experiment with the minim sound library because I'm planning on making a small music-related game, and i stumbled upon problems. My question is: whats the best, most precise and efficiant way to play sample patterns?
let's say I have 8 different .wav samples, each 2 seconds (= 1 bar at 120 bpm). I want them to play synchronized and I want to be able to switch them on and off during the game.
I tried to control the samples (.play(), .rewind() ) with a timer-class, based on millis(); but it caused some delay.
I also tried to .loop() every sample and only control the volume, but it wasn't in sync either..
I've tried the whole thing with AudioPlayer, AudioSnippet and AudioSample, but none of them worked properly!
It really has to be precise, because the game is about keeping the rythm of the music/timer.
Any thoughts? Maybe minim isnt the right choice? Should I try THE BEADS?
I just need to know the best way to handle this kind of issue.
I'm currently working on a simple 2D shooter game. Basically, there's one instance of my player-class and 50 instances of my creep-class on the map. They change position every loop. Something like this:
class Creep {
float x;
float y;
PImage sprite;
...
}
I need to find a way to sort all those instances depending on their Y-position before they are being drawn to the window, so that they're overlapping correctly! e.g. there's creep_a at y=5 and another creep_b at y=6. the game has to draw creep_a first, so that creep_b appears to be in front of it!
My first thought was to create an arrayList for all moving objects (player and creeps), which is then sorted by comparing every Y-position. But no matter how hard I try, I can't find a way to make it work.
I hope you guys understand what my problem is (and excuse my poor english)
Please let me know how you would solve that problem!