-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed how the images work in a jar file
- Loading branch information
suncloudsmoon
committed
Jul 20, 2020
1 parent
c04689d
commit 15c1063
Showing
20 changed files
with
48 additions
and
37 deletions.
There are no files selected for viewing
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,38 @@ | ||
import java.awt.Image; | ||
import java.awt.image.BufferedImage; | ||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
import javax.imageio.ImageIO; | ||
|
||
public class Hut { | ||
|
||
private static BufferedImage hut; | ||
private static Image hut; | ||
private static int[] x = new int[3]; // Access this by x[1] etc | ||
private static int[] y = new int[3]; | ||
|
||
public static Image hutImage() { | ||
public Image hutImage() { | ||
try { | ||
hut = ImageIO.read(new File("Hut.png")); | ||
hut = ImageIO.read(getClass().getClassLoader().getResource("Hut.png")); | ||
} catch (IOException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
|
||
return hut; | ||
} | ||
|
||
// Make sure the huts don't interfere with each other! | ||
public static int[] posX() { | ||
for (int i = 0; i < 3; i++) { | ||
x[i] = (int)(Math.random() * 750); | ||
x[i] = (int) (Math.random() * 750); | ||
} | ||
return x; | ||
} | ||
|
||
public static int[] posY() { | ||
for (int i = 0; i < 3; i++) { | ||
y[i] = (int)(Math.random() * 730); | ||
y[i] = (int) (Math.random() * 730); | ||
} | ||
return y; | ||
} | ||
|
||
} |
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
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
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