background verandert samen met het logo, test
This commit is contained in:
+2
-1
@@ -22,6 +22,7 @@ public class Images{
|
||||
images.add(ImageIO.read(Main.class.getResource("/image/player2.png")));
|
||||
images.add(ImageIO.read(Main.class.getResource("/image/pressstart.png")));
|
||||
images.add(ImageIO.read(Main.class.getResource("/image/colorstrike.png")));
|
||||
images.add(ImageIO.read(Main.class.getResource("/image/background.png")));
|
||||
|
||||
}catch(IOException e){
|
||||
e.printStackTrace();
|
||||
@@ -35,6 +36,6 @@ public class Images{
|
||||
|
||||
public enum ImageType
|
||||
{
|
||||
player,player2, pressstart, colorstrike
|
||||
player,player2,pressstart,colorstrike,background
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 519 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 556 B After Width: | Height: | Size: 2.3 KiB |
@@ -16,10 +16,11 @@ public class TitleState extends GameState {
|
||||
|
||||
BufferedImage pressStart = Images.getImage(ImageType.pressstart);
|
||||
BufferedImage colorStrike = Images.getImage(ImageType.colorstrike);
|
||||
BufferedImage background = Images.getImage(ImageType.background);
|
||||
|
||||
int index = 0;
|
||||
int varx = 0;
|
||||
int x,y,frame = 0,maxFrames = 5;
|
||||
int x1,y1,x2,y2,x3,y3, frame = 0,maxFrames = 5;
|
||||
|
||||
public TitleState(GameStateManager gsm) {
|
||||
super(gsm);
|
||||
@@ -33,21 +34,30 @@ public class TitleState extends GameState {
|
||||
@Override
|
||||
public void update() {
|
||||
if(frame == maxFrames-1){
|
||||
x = (index % 6)*49;
|
||||
y = 0;
|
||||
|
||||
x1 = -100*index;
|
||||
y1 = 0;
|
||||
|
||||
x2 = (index % 6)*49;
|
||||
y2 = 0;
|
||||
|
||||
index++;
|
||||
index %= 6;
|
||||
x3 = (index %6)*92;
|
||||
y3 = 0;
|
||||
|
||||
index++;
|
||||
index %= 6;
|
||||
}
|
||||
frame++;
|
||||
frame %= (maxFrames);
|
||||
frame++;
|
||||
frame %= (maxFrames);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2) {
|
||||
|
||||
g2.setColor(Color.BLACK);
|
||||
g2.fillRect(0, 0, 1280, 1024);
|
||||
// g2.setColor(Color.BLACK);
|
||||
// g2.fillRect(0, 0, 1280, 1024);
|
||||
|
||||
g2.drawImage(background, x1, y1, null);
|
||||
|
||||
g2.setColor(Color.ORANGE);
|
||||
g2.fillRect(1280/2 -120, 1024/2 - 80, 225, 90);
|
||||
@@ -55,11 +65,13 @@ public class TitleState extends GameState {
|
||||
|
||||
g2.translate(1280/2, 1024/2);
|
||||
|
||||
BufferedImage subImg = pressStart.getSubimage(x, y, 49, 26);
|
||||
BufferedImage subImg = pressStart.getSubimage(x2, y2, 49, 26);
|
||||
g2.drawImage(subImg, varx - 26*5, 0 - 20*5, 49*5, 26*5, null);
|
||||
|
||||
BufferedImage subImg2 = colorStrike;
|
||||
g2.drawImage(subImg2, 0 -27*8 , 0 -300, 54*8, 18*8, null);
|
||||
BufferedImage subImg2 = colorStrike.getSubimage(x3, y3, 92, 29);
|
||||
// g2.drawImage(subImg2, 0 -27*8 , 0 -300, 54*8, 18*8, null);
|
||||
// g2.drawImage(subImg2, 0 -27*8 , 0 -300, 92*8, 24*8, null);
|
||||
g2.drawImage(subImg2, 0 -27*8 , 0 -300, 92*8, 29*8, null);
|
||||
|
||||
varx+=0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user