I had an idea that I would 'play' my rhythm game first and have the times at which I hit the key output to the console, so I could use those values minus the hard coded in time it takes an object to reach the bar to know when I should begin their fall. I was having trouble so I changed every long to an int because it actually wasn't even that long.
Am I going about this wrong? Do you know a better way to do a rhythm game?
Code:
//these are the hard coded in values from when I played the game myself
public int[] aList = new int[]{
10312, 12162, 13996, 14478, 15379, 16696, 17662, 18529, 19446, 19862, 21662, 22395, 22829, 23196, 23979, 26329, 27612, 28529, 29412, 30329, 31212, 31896, 34379, 35229, 35562, 36596, 37279, 37929,
39645, 41679, 45329, 45796, 46229, 46696, 51579, 52046, 52329, 55529, 56246, 57832, 58546, 58879, 59079, 59312, 59646, 59879, 60112, 60496, 60829, 61179, 61546, 63512, 64196, 64612, 65096,
67212, 67678, 68179, 68679, 70029, 71728, 72629, 73496, 76229, 77596, 79396, 80546, 81279, 81712, 84862, 8512, 85329, 86312, 87629, 88579, 89396, 90312, 90462
};
.....
//this returns the time in milliseconds
public int getTime() {
return (int) ((Sys.getTime() * 1000) / Sys.getTimerResolution());
}
.....
public void update(GameContainer c, int d) throws SlickException {
//make every image
if(aList[aLoc]-magicNumber==(getTime()-startTime)){
aFList.add(new FallingObject(new Image("res/fistA.png"),WIDTH/10*2-radius-5,0-radius,radius));
aLoc++;
}
//move every image
for(FallingObject f: aFList){
f.setY(f.getY()+4);
}
}