Browse Source

Menu art verandert

Daniel 10 năm trước cách đây
mục cha
commit
10f73d6e91
2 tập tin đã thay đổi với 47 bổ sung19 xóa
  1. 13 4
      model/gameState/MenuState.java
  2. 34 15
      model/gameState/TitleState.java

+ 13 - 4
model/gameState/MenuState.java

@@ -5,6 +5,7 @@ import image.Images.ImageType;
 
 import java.awt.Color;
 import java.awt.Graphics2D;
+import java.awt.Polygon;
 import java.awt.image.BufferedImage;
 import java.util.ArrayList;
 
@@ -20,6 +21,7 @@ import control.joystick.JoystickEvent;
 public class MenuState extends GameState {
 	private ArrayList<MenuButton> buttons;
 	private int selected;
+	private Polygon triangle;
 
     int frame = 0;
     int maxFrames = 2560;
@@ -48,11 +50,18 @@ public class MenuState extends GameState {
 
 	@Override
 	public void draw(Graphics2D g2) {
-	    g2.drawImage(Images.getImage(ImageType.background), -640 -((frame * 4) % maxFrames), 0, 5120, 1024, null); 
-		for(MenuButton b:buttons){
+//	    g2.drawImage(Images.getImage(ImageType.background), -640 -((frame * 4) % maxFrames), 0, 5120, 1024, null); 
+	    
+	    for(MenuButton b:buttons){
 	    	 b.draw(g2);
-	     }	   
-			
+	     }
+	    
+	    g2.setColor(Color.ORANGE);
+	    triangle = new Polygon();
+	    triangle.addPoint(0, 0);
+	    triangle.addPoint(0, 1024/4);
+	    triangle.addPoint(1280/2, 0);	    
+	    g2.fillPolygon(triangle);
 	}
 	
 	@Override

+ 34 - 15
model/gameState/TitleState.java

@@ -5,6 +5,7 @@ import image.Images.ImageType;
 
 import java.awt.Color;
 import java.awt.Font;
+import java.awt.GradientPaint;
 import java.awt.Graphics2D;
 import java.awt.image.BufferedImage;
 
@@ -20,8 +21,7 @@ public class TitleState extends GameState {
     
     int index = 0;
     int varx = 0;
-    int frame = 0;
-    int maxFrames = 2560;
+    int frame;
 
 	public TitleState(GameStateManager gsm) {
 		super(gsm);
@@ -41,30 +41,49 @@ public class TitleState extends GameState {
 	@Override
 	public void draw(Graphics2D g2) {
 		
-		g2.setColor(Color.WHITE);
+		
+		g2.setColor(new Color(1,1,1, 0.3f));
 		g2.fillRect(0,0,1280,1024);
 		
+		g2.setColor(new Color(0,1,0, 0.7f));
+		g2.fillRect(0,0,100,1024);
+		
+		g2.setColor(new Color(1,1,0, 0.7f));
+		g2.fillRect(100,0,100,1024);
+		
+		g2.setColor(new Color(1,0,0, 0.7f));
+		g2.fillRect(200,0,100,1024);
+		
+		g2.setColor(new Color(0,1,0, 0.7f));
+		g2.fillRect(1180,0,100,1024);
+		
+		g2.setColor(new Color(1,1,0, 0.7f));
+		g2.fillRect(1080,0,100,1024);
+		
+		g2.setColor(new Color(1,0,0, 0.7f));
+		g2.fillRect(980,0,100,1024);
+		
+		GradientPaint gp = new GradientPaint(300, 0, new Color(0,0,1, 0.6f),980,1024 ,new Color(0,0,1, 0.2f));
+		g2.setPaint(gp);
+		g2.fillRect(300, 0, 680, 1024);
+		
 		g2.translate(640, 512);
-	    
-		BufferedImage subImg2 = background.getSubimage(0, 0, 5120, 1024);
-	    g2.drawImage(subImg2, -640 -((frame * 4) % maxFrames), -512, 5120, 1024, null);
-//		
-//		g2.setColor(Color.ORANGE);
-//		g2.fillRect( -25*5 -1, - 18*5 -1, 49*5 + 1, 26*5 + 1);
-//		g2.drawRect( -25*5 -3, - 18*5 -3, 49*5 + 4, 26*5 + 4);
-
+		
 		int image_x = ((frame / 6) % 6) * 49;
 	    BufferedImage subImg = pressStart.getSubimage(image_x, 0, 49, 26);
-	    g2.drawImage(subImg, - 25*5, - 18*5, 49*5, 26*5, null);
-	    
-	    g2.drawImage(colorStrike, -27*8 , -300, 54*8, 18*8, null);
-
+	    g2.drawImage(subImg, - 25*5, 200, 49*5, 26*5, null);
 	
 		Font textFont = new Font("OCR A Extended", Font.BOLD, 15);
 		g2.setFont(textFont);
 		g2.setColor(Color.WHITE);
 		g2.drawString("©2015 Team Hamtaro", - 18*5, 500);
 		
+		g2.setColor(Color.RED);
+		Font textFont2 = new Font("OCR A Extended", Font.BOLD, 130);
+		g2.setFont(textFont2);
+		g2.drawString("Color", -215, -300);
+		g2.drawString("Strike", -250, -170);
+		
 	}
 	
 	@Override