Created
September 17, 2014 17:57
-
-
Save boyanov83/ad60e947594c36299f0a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void draw(Graphics g) throws InterruptedException { | |
if (rain.size() < 60) { | |
rain.add(yy); | |
yy -= 20; | |
rain.add(rnd.nextInt(490)); | |
rain.add(Toolkit.getDefaultToolkit().getImage("rock.png")); | |
} | |
for (int i = 0; i < rain.size(); i += 3) { | |
g.drawImage((Image) rain.get(i + 2), (int) rain.get(i + 1), (int) rain.get(i), null); | |
rain.set(i, ((int) rain.get(i)) + 5); | |
if ((int) rain.get(i) >= 490) { | |
rain.set(i, 10); | |
rain.set(i + 1, rnd.nextInt(490)); | |
} else { | |
collisionObjectSetter(i, rain); | |
} | |
} | |
try { | |
Thread.sleep(2); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment