Falling Bricks
Informace
Legendární logická hra ve zbrusu novém silně návykovém provedení!
Tento projekt byl vytvořen jako semestrální práce do předmětu
Y36ALG (Algoritmizace).
Popis hry na Wikipedii.
Stáhni a hraj!
Dokumentace
Zdrojové kódy (prohlížení)
- fallingbricks
1: package fallingbricks; 2: import java.awt.*; 3: 4: /** 5: * Score informations 6: * @author Ondrej Macoszek 7: */ 8: public class Score 9: { 10: /** 11: * Score checksum 12: */ 13: public int totalScore = 0; 14: 15: /** 16: * Big font definition 17: */ 18: private Font bigFont = new Font("Arial",Font.PLAIN,30); 19: 20: /** 21: * Medium font definition 22: */ 23: private Font mediumFont = new Font("Arial",Font.PLAIN,20); 24: 25: /** 26: * Small font definition 27: */ 28: private Font smallFont = new Font("Arial",Font.PLAIN,12); 29: 30: /** 31: * Position of score box 32: */ 33: public static Point position; 34: 35: /** 36: * Dimension of score box 37: */ 38: public static Dimension dimension; 39: 40: /** 41: * Background color of score box 42: */ 43: public Color backgroundColor = new Color(231,231,231); 44: 45: /** 46: * Game controller instance 47: */ 48: private Game game; 49: 50: 51: /** 52: * Constructor. Creates link to game instance also. 53: */ 54: public Score() 55: { 56: game = Game.getInstance(); 57: } 58: 59: /** 60: * Render score information 61: * @param g Graphic enviroment 62: */ 63: public void render(Graphics g) 64: { 65: // Clear score box 66: g.setColor(backgroundColor); 67: g.fillRect(position.x, position.y, dimension.width, dimension.height); 68: // Write score 69: g.setColor(Color.BLACK); 70: g.setFont(bigFont); 71: g.drawString("Skóre: "+totalScore, 15, position.y+40); 72: // Write additional help 73: g.setFont(smallFont); 74: g.drawString("ZmáÄknutÃm klávesy P zastavÃÅ¡ hru.", 15, position.y+dimension.height-20); 75: } 76: 77: /** 78: * Render game over 79: * @param g Graphic enviroment 80: */ 81: public void renderGameOver(Graphics g) 82: { 83: // Clear score box 84: g.setColor(backgroundColor); 85: g.fillRect(position.x, position.y, dimension.width, dimension.height); 86: // Write game over banner in center of canvas 87: g.setColor(backgroundColor); 88: g.fillRect(0, position.y/2-30, dimension.width, 40); 89: g.setColor(Color.BLACK); 90: g.setFont(bigFont); 91: g.drawString("KONEC HRY", 30, position.y/2); 92: // Write score 93: g.setColor(Color.BLACK); 94: g.drawString("Skóre: "+totalScore, 15, position.y+40); 95: // Write additional help 96: g.setFont(smallFont); 97: g.drawString("ZmáÄkni ENTER a hraj znova!", 15, position.y+dimension.height-20); 98: } 99: } 100:
