View Game: ApoTurn4k

ApoTurn4k (http://www.apo-games.de/apoTurn4k/)

By ApoGames, submitted on Dec 2, 2012
Min JRE version: 1.6
2007 downloads.
This game was submitted in the Java4K 2013 Competition.
Source code available! Show source code

(Click on game for focus)

Sorry, your Browser doesn't support Applets
You need Java installed to play this game.
You may use the button below to get it.

Get Java


Description

Are your ready for a real challenge for your brain?
Then better play "ApoTurn4k" right now.
Believe me your brain will rotate!

It's a match 4 game with that certain twist.
Easy to understand but hard to master.

You like the game? Then try the big version of the game and play ApoTurn on your android device. Link: https://play.google.com/store/apps/details?id=org.apogames.turn

Instructions

Click on a tile to rotate it clockwise.
Match 4 or more pieces with the same direction to delete them.
The magenta tile is a joker tile and represents all directions.

User Comments

Total 4 comments:

#1 By Falck, Andy Nov 11, 2015 at 01:28:23
mbt shoes clearance outlet mbt shoes mbt shoes clearance outlet MBT Women Casual Shoes With Simple White Hardwearing Leather - $93.00 : mbtshoes, shoppingmbtshoes.com language:                                              Payment |  Shipping & Returns  |  Wholesale |  Contact Us MBT Women MBT Men MBT Shoes Clearance Contact Us Welcome! Sign In or Register Your cart is empty Currencies US Dollar CNY Euro GB Pound Canadian Dollar Australian Dollar Jappen Yen Norske Krone Swedish Krone Danish Krone Categories MBT Men MBT Shoes Clearance MBT Women MBT Casual Women MBT Sandals Women MBT Sports Women White MBT Shoes Featured -   [more] MBT Black Casual Hardwearing Leather Women Sandals Shoes$514.00  $96.00Save: 81% offMBT Fashion Navy Hardwearing Women Casual Shoes$450.00  $87.00Save: 81% offMBT Bright Gold Hardwearing Leather Women Sandals Shoes$554.00  $96.00Save: 83% offMBT Casual Shoes With Silver Black Hardwearing Leather For Women$407.00  $85.00Save: 79% off Home ::  MBT Women ::  MBT Casual Women ::  MBT Women Casual Shoes With Simple White Hardwearing Leather .jqzoom{ float:left; position:relative; padding:0px; cursor:pointer; width:301px; height:300px; } MBT Women Casual Shoes With Simple White Hardwearing Leather $531.00  $93.00Save: 82% off Please Choose: Size EU 35 2/3US 6UK 3234MM EU 36 1/3US 6.5UK 3.5239MM EU 37 2/3US 7.5UK 4.5248MM EU 37US 7UK 4243MM EU 38 1/3US 8UK 5252MM EU 39 2/3US 9UK 6261MM EU 39US 8.5UK 5.5257MM EU 40 1/3US 9.5UK 6.5266MM Add to Cart: MBT Shoes Outlet are famous for novel design and fine craft. A pair of MTB Shoes is of benefit to your health. It can exercise a large number of muscles,whether you\'re walking or standing. There is no doubt that the leather of MTB shoes is super high quality. These MBT sport shoes from our store will give you wonderfully comfortable foot wearing experience. Compared with other shoes,you will find MBT Shoes are the best daily or travel companion for you. Come to choose your favorite shoes in our Cheap MTB online shop!LeatherColor: White Related Products MBT Comfortable Purple Hardwearing Leather Women Casual Shoes MBT Women Casual Shoes With Special Chocolate Hardwearing Leather MBT Women Casual Shoes With Black Hardwearing Leather MBT Cheap Silver Leather Casual Shoes For Women MBT Shoes on sale with Free Shipping MBT Shoes, Cheap MBT Shoes, MBT Shoes Clearance Welcome to our MBT shoes online store, Our store provides large selection of MBT shoes with cheapest price and high quality guarantee! CATEGORIES Shoes For Men Shoes For Women Customer Care Shipping & Return Contact Us Site Map Payment Methods100% SECURE Copyright © 2014 MBT Shoes Outlet All Rights Reserved. mbt shoes on sale cheap mbt shoes outlet blog outlet About 8tn8.com blog
#2 By Falck, Andy Nov 11, 2015 at 01:28:34
[b][url=http://www.8tn8.com/]mbt shoesmbt shoes on sale cheap mbt shoes
#3 By Falck, Andy Nov 11, 2015 at 01:47:19
UGG Boots Nightfall Tall 5359 Outlet #sddm { margin: 0 auto; padding: 0; z-index: 30; background-color:#F4F4F4; width: 80px; height:23px; float: right; margin-right: 70px;} #sddm li { margin: 0; padding: 0; list-style: none; float: left; font: bold 12px arial} #sddm li a { display: block; margin: 0 1px 0 0; padding: 4px 10px; width: 60px; background: #333; color: #888; text-align: center; text-decoration: none} #sddm li a:hover { background: #49A3FF} #sddm div { position: absolute; visibility: hidden; margin: 0; padding: 0; background: #EAEBD8; border: 1px solid #5970B2} #sddm div a { position: relative; display: block; margin: 0; padding: 5px 10px; width: auto; white-space: nowrap; text-align: left; text-decoration: none; background: #EAEBD8; color: #2875DE; font: 12px arial} #sddm div a:hover { background: #49A3FF; color: #FFF} Language Deutsch Français Italiano Español Português 日本語 Russian Arabic Norwegian Swedish Danish Nederlands Finland Ireland English Welcome! Sign In or Register Your cart is empty Home Ugg Women Boots Ugg Men Boots Ugg Kids Boots Bailey Button Classic Fox Fur Maylin Nightfall Roxy Sandals Shanleigh Slippers Warm Ascot Capulin Classic Hannen Neumel Stoneman Bailey Button Classic Fox Fur Currencies US Dollar Euro GB Pound Canadian Dollar Australian Dollar Jappen Yen Norske Krone Swedish Krone Danish Krone CNY Categories Ugg Women Boots UGG Boots Argyle Knit 5879 UGG Boots Bailey Button 5803 UGG Boots Bailey Button Triplet 1873 UGG Boots Classic Short 5825 UGG Boots Classic Tall 5815 UGG Boots Knightsbridge 5119 UGG Boots Nightfall Tall 5359 UGG Boots Roxy Short 5828 UGG Boots Roxy Tall 5818 UGG Boots Tassel Short 5835 Ugg Kids Boots Ugg Men Boots Featured -   [more] Wholesale Sand UGG Boots Tassel Short 5835 Cheap$477.00  $90.00Save: 81% offWomens Chestnut UGG Boots Nightfall Tall 5359 Wholesale$436.00  $93.00Save: 79% offWomens Chestnut UGG Boots Classic Short 5825 Sale$397.00  $80.00Save: 80% off Home ::  Ugg Women Boots ::  UGG Boots Nightfall Tall 5359 UGG Boots Nightfall Tall 5359 Filter Results by: Items starting with ... A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 Displaying 1 to 4 (of 4 products)   Cheap Sand UGG Boots Nightfall Tall 5359 Online FactoryThe Ugg boots in our store are available in a variety of...$506.00  $93.00Save: 82% off... more info Chocolate UGG Boots Nightfall Tall 5359 Outlet For SaleUGG Boots Nightfall Tall 5359 is must-have for this...$678.00  $93.00Save: 86% off... more info Womens Chestnut UGG Boots Nightfall Tall 5359 WholesaleWomens Chestnut UGG Boots Nightfall Tall 5359 Wholesale...$436.00  $93.00Save: 79% off... more info Womens UGG Boots Nightfall Tall 5359 Black OverstockWomens UGG Boots Nightfall Tall 5359 Black Overstock is...$460.00  $93.00Save: 80% off... more info Displaying 1 to 4 (of 4 products)   Home   Shipping   Wholesale   Order Tracking   Coupons   Payment Methods   Contact Us   NEW UGG BOOTS    UGG BOOTS MENS    UGG BOOTS WOMEN    UGG BOOTS KIDS    DISCOUNT UGG BOOTS   CHEAP UGG BOOTS   Copyright © 2012 All Rights Reserved. some handbags even double as a diaper sacks for on the go moms.Women are actually always trying to find the great accessories and it is not surprising the accessory is often a fancy designer purse.Woman love to match affordable handbags and purses with their outfits and it is always a great way for woman expressing their temperament. Woman will look for the perfect bargain in the local department store where they will likely find a huge selection of purses and also handbags and maybe a beneficial clearance stand.As women age some people change not to mention evolve and so does their choice of accessories.Many women will become thinking about designer sacks and designer purses, instead associated with regular division store types. Some of the most popular plastic bags are those with celebrity faces in it such seeing that Marilyn Monroe and also Elvis.Leather purses are also a treasured of a lot of women, leather is extremely classy and even eye appealing and it is available in a variety of colors.Denim is always a great pick considering that women are able to go simple with this particular style as well as dress it all up together with rhinestones and other purse beautifications. Young teenager girls enjoy the small and yet cute back pack and multi-colored bags that they can make any statement with the help of.But most woman search for classy together with highly cool bags that will attract consideration from people without browsing silly our own standing through.Handbags as well as purses are made to appeal towards other partner who may well compliment about the beautiful bag. Many women will possibly even make their very own purses to show off his or her\'s personal perception of fashion.You may use different materials and different designs; it is all about your temperament and what you have to say to the world.So enjoy your purse make it your have. Whether you buy it at the local agency store and / or online you can find your favorite hand carrier or back pack anywhere.Pick your style, your color, and your own material; then let the purse convey who you are.Let it work for you and most of all enjoy the particular purse of the dreams due to the fact you\'re sure to obtain something in which simply states that, \"this is me.\" Finding the right hand container or purse for you or a loved one can even be a fun method.Also, remember which handbags come up with great gifts for that women in addition to girls in your life. 5359 blog Outlet About uggboot.me blog
#4 By Falck, Andy Nov 11, 2015 at 01:47:34
some handbags even double as a diaper sacks for on the go moms.Women are actually always trying to find the great accessories and it is not surprising the accessory is often a fancy designer purse.Woman love to match affordable handbags and purses with their outfits and it is always a great way for woman expressing their temperament. Woman will look for the perfect bargain in the local department store where they will likely find a huge selection of purses and also handbags and maybe a beneficial clearance stand.As women age some people change not to mention evolve and so does their choice of accessories.Many women will become thinking about designer sacks and designer purses, instead associated with regular division store types. Some of the most popular plastic bags are those with celebrity faces in it suchsome handbags even double as a diaper sacks for on the go moms.Women are actually always trying to find the great accessories and it is not surprising the accessory is often a fancy designer purse.Woman love to match affordable handbags and purses with their outfits and it is always a great way for woman expressing their temperament. Woman will look for the perfect bargain in the local department store where they will likely find a huge selection of purses and also handbags and maybe a beneficial clearance stand.As women age some people change not to mention evolve and so does their choice of accessories.Many women will become thinking about designer sacks and designer purses, instead associated with regular division store types. Some of the most popular plastic bags are those with celebrity faces in it such seeing that Marilyn Monroe and also Elvis.Leather purses are also a treasured of a lot of women, leather is extremely classy and even eye appealing and it is available in a variety of colors.Denim is always a great pick considering that women are able to go simple with this particular style as well as dress it all up together with rhinestones and other purse beautifications. Young teenager girls enjoy the small and yet cute back pack and multi-colored bags that they can make any statement with the help of.But most woman search for classy together with highly cool bags that will attract consideration from people without browsing silly our own standing through.Handbags as well as purses are made to appeal towards other partner who may well compliment about the beautiful bag. Many women will possibly even make their very own purses to show off his or her\'s personal perception of fashion.You may use different materials and different designs; it is all about your temperament and what you have to say to the world.So enjoy your purse make it your have. Whether you buy it at the local agency store and / or online you can find your favorite hand carrier or back pack anywhere.Pick your style, your color, and your own material; then let the purse convey who you are.Let it work for you and most of all enjoy the particular purse of the dreams due to the fact you\'re sure to obtain something in which simply states that, \"this is me.\" Finding the right hand container or purse for you or a loved one can even be a fun method.Also, remember which handbags come up with great gifts for that women in addition to girls in your life.

You need be logged in to write comments. If you need to register click here.

Source code

Note: We recommend you copy+paste this to a better editor. Some special character encoding may have been lost.

* All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import java.applet.Applet; import java.awt.BasicStroke; import java.awt.Event; import java.awt.Color; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.image.BufferedImage; public class Q extends Applet implements Runnable { /* * 0 = mouseX * 1 = mouseY * 2 = points * 3 = level * 4 = width rec around * 5 = moves * 6 = how much you must delete to reach the next level * 7 = current delete */ private final float[] values = new float[15]; public void start() { new Thread(this).start(); } public void run() { // setSize(640, 480); // For AppletViewer, remove later. // Set up the graphics stuff, double-buffering. BufferedImage screen = new BufferedImage(640,480,BufferedImage.TYPE_INT_RGB); Graphics2D g = screen.createGraphics(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Graphics2D appletGraphics = (Graphics2D)getGraphics(); // Some variables to use for the fps. long lastTime = System.nanoTime(); long think = lastTime; values[4] = 624; /* * level 0-6 das eigentliche level * level 7-13 Fallhöhe * level 14-20 Geschwindigkeit * * values 1 = empty * values 2 = up * values 3 = right * values 4 = down * values 5 = left * values 6 = goodie all direction * values 7 = goodie bomb * values 8 = goodie change * values 9 = empty fix * values 10 = up fix * values 11 = right fix * values 12 = down fix * values 13 = left fix * values 14 = all fix * values 15 = bomb fix * values 16 = change fix */ float[][] level = new float[28][7]; boolean[][] bDelete = null; boolean bOldFall = true; // Game loop. while (true) { long now = System.nanoTime(); long delta = now - lastTime; think += delta; // Update / think while (think >= 10000000L) { think -= 10000000L; // wenn das Spiel gestartet wurde if (values[14] > 0) { // verkleiner das Spielfeld if (values[4] > 465) { values[4] -= 2.5f; } else if (values[12] > 0) { values[12] -= 10; } else { // falls es noch kein Level gibt, dann erstelle eins if (level[0][0] == -1) { for (int y = 0; y < 7; y++) { for (int x = 0; x < level[0].length; x++) { int rand = (int)(Math.random() * 100); if (rand < 4) { level[y][x] = 6; } else if (rand < 28) { level[y][x] = 2; } else if (rand < 52) { level[y][x] = 3; } else if (rand < 76) { level[y][x] = 4; } else { level[y][x] = 5; } level[y+7][x] = 465; level[y+14][x] = 3; level[y+21][x] = 0; bOldFall = true; } } bDelete = null; values[5] = 0; values[6] = 200 + values[3] * 75; values[7] = 0; this.values[9] = 0; } int mouseX = -1; int mouseY = -1; // wenn die Maus gedrückt wurde if (values[13] > 0) { values[13] = 0; if ((values[0] >= 480) && (values[0] <= 630) && (values[1] >= 425) && (values[1] <= 465)) { values[14] = 0; break; } else if ((values[0] >= 480) && (values[0] <= 630) && (values[1] >= 375) && (values[1] <= 415)) { level[0][0] = -1; values[3] = 0; values[2] = 0; break; } else if ((values[0] >= 10) && (values[0] < 465) && (values[1] >= 10) && (values[1] < 465)) { // Ins Spielfeld gedrückt mouseX = (int)((values[0] - 10) / 65); mouseY = (int)((values[1] - 10) / 65); } } // Fallen die Dinger? boolean bDown = false; for (int y = 0; y < 7; y++) { for (int x = 0; x < level[0].length; x++) { if ((level[y+7][x] != 0) || (level[y+14][x] != 0)) { level[y+14][x] += 0.02f; if (level[y+14][x] > 5) { level[y+14][x] = 5; } level[y+7][x] -= level[y+14][x]; if (level[y+7][x] <= 0) { level[y+7][x] = level[y+14][x] = 0; } if ((bDelete != null) && (bDelete[y][x])) { level[y+21][x] += 1; } bDown = true; } } } boolean bCheck = false; if ((!bDown) && (bOldFall)) { bCheck = true; } bOldFall = bDown; if ((!bDown) && (bDelete != null)) { for (int x = 0; x < 7; x++) { int count = 0; for (int y = 6; y >= 0; y--) { while ((y - count >= 0) && (bDelete[y-count][x])) { count += 1; values[7] += 1; } level[y+7][x] = 65 * count; level[y+14][x] = 1; if (count != 0) { if (y - count >= 0) { level[y][x] = level[y-count][x]; } else { int rand = (int)(Math.random() * 100); if (rand < 4) { level[y][x] = 6; } else if (rand < 28) { level[y][x] = 2; } else if (rand < 52) { level[y][x] = 3; } else if (rand < 76) { level[y][x] = 4; } else { level[y][x] = 5; } } } } } bDelete = null; bCheck = false; // wurde ins Spielfeld geklickt? } else if ((mouseX >= 0) && (mouseY >= 0) && (!bDown) && (!bCheck)) { if ((level[mouseY][mouseX] > 1) && (level[mouseY][mouseX] < 6)) { values[5] += 1; level[mouseY][mouseX] += 1; if (level[mouseY][mouseX] >= 6) { level[mouseY][mouseX] -= 4; } bCheck = true; } } if (bCheck) { boolean bFound = false; for (int y = 0; y < 7; y++) { int oldValue = -1; int count = 0; int curValue = 0; for (int x = 0; x < 8; x++) { if ((x < 7) && ((oldValue == (int)level[y][x]) || (oldValue + 8 == (int)level[y][x]) || (6 == oldValue) || ((oldValue != -1) && ((6 == (int)level[y][x]) || (6 + 8 == (int)level[y][x]))))) { count += 1; if ((6 == oldValue) && (oldValue != (int)level[y][x])) { oldValue = (int)level[y][x]; if (oldValue >= 9) oldValue -= 8; } } else { if (count >= 4) { if (bDelete == null) { bDelete = new boolean[7][7]; } for (int z = x - count; z < x; z++) { bDelete[y][z] = true; level[y+21][z] = 0; } bFound = true; values[2] += (int)(count * (10 + 2 * values[3]) + 15 * count); } for (int x2 = x-1; x2 >= 0; x2--) { if ((level[y][x2] == 6) || (level[y][x2] == 6 + 8)) { curValue += 1; } else { break; } } count = 1 + curValue; if (x < 7) { oldValue = (int)level[y][x]; if (oldValue >= 9) oldValue -= 8; curValue = 0; } } } } for (int x = 0; x < 7; x++) { int oldValue = -1; int count = 0; int curValue = 0; for (int y = 0; y < 8; y++) { if ((y < 7) && ((oldValue == (int)level[y][x]) || (oldValue + 8 == (int)level[y][x]) || (6 == oldValue) || ((oldValue != -1) && ((6 == (int)level[y][x]) || (6 + 8 == (int)level[y][x]))))) { count += 1; if ((6 == oldValue) && (oldValue != (int)level[y][x])) { oldValue = (int)level[y][x]; if (oldValue >= 9) oldValue -= 8; } } else { if (count >= 4) { if (bDelete == null) { bDelete = new boolean[7][7]; } for (int z = y - count; z < y; z++) { bDelete[z][x] = true; level[z+21][x] = 0; } bFound = true; values[2] += (int)(count * (10 + 2 * values[3]) + 15 * count); } for (int y2 = y-1; y2 >= 0; y2--) { if ((level[y2][x] == 6) || (level[y2][x] == 6 + 8)) { curValue += 1; } else { break; } } count = 1 + curValue; if (y < 7) { oldValue = (int)level[y][x]; if (oldValue >= 9) oldValue -= 8; curValue = 0; } } } } if (bDelete != null) { for (int x = 0; x < 7; x++) { boolean bStart = false; for (int y = 6; y >= 0; y--) { if (bDelete[y][x]) { bStart = true; } if (bStart) { level[y+14][x] = -1f; } } } } if ((!bFound) && (mouseX >= 0) && (mouseY >= 0) && (!bDown) && (level[mouseY][mouseX] > 1) && (level[mouseY][mouseX] < 6)) { int randX, randY; do { randX = (int)(Math.random() * 7); randY = (int)(Math.random() * 7); } while (level[randY][randX] >= 9); level[randY][randX] += 8; } boolean bEnd = false; for (int y = 0; y < 7; y++) { for (int x = 0; x < 7; x++) { if (level[y][x] <= 6) { break; } if (x == 6) { bEnd = true; } } } for (int x = 0; x < 7; x++) { for (int y = 0; y < 7; y++) { if (level[y][x] <= 6) { break; } if (y == 6) { bEnd = true; } } } if (bEnd) { values[14] = 0; } if (values[7] >= values[6]) { level[0][0] = -1; values[3] += 1; } } } } else { if (values[4] < 624) { values[4] += 2.5f; } else { if (values[13] > 0) { if ((values[0] >= 240) && (values[0] <= 400) && (values[1] >= 360) && (values[1] <= 400)) { // Spiel starten values[14] = 1; level[0][0] = -1; values[2] = 0; values[3] = 0; values[6] = 100; } } } values[13] = 0; } } lastTime = now; // Render g.setColor(Color.WHITE); g.fillRect(0, 0, 640, 480); if ((values[14] > 0) && (values[4] <= 465)) { g.setColor(new Color(230, 230, 230)); g.fillRoundRect(6, 6, (int)(values[4]), 464, 30, 30); } g.setColor(Color.DARK_GRAY); g.setStroke(new BasicStroke(3)); g.drawRoundRect(6, 6, (int)(values[4]), 464, 30, 30); if (values[14] <= 0) { g.drawLine(6, 210, (int)(values[4] + 6), 210); g.drawLine(6, 270, (int)(values[4] + 6), 270); g.setColor(Color.BLACK); if (values[4] >= 620) { g.setFont(g.getFont().deriveFont(50f).deriveFont(1)); String s = "ApoTurn4k"; int w = g.getFontMetrics().stringWidth(s); g.drawString(s, 320 - w/2, 255); if (this.values[2] > 0) { s = "Points: "+String.valueOf((int)(this.values[2])); w = g.getFontMetrics().stringWidth(s); g.drawString(s, 320 - w/2, 125); } g.setFont(g.getFont().deriveFont(30f).deriveFont(1)); s = "start"; w = g.getFontMetrics().stringWidth(s); g.drawString(s, 320 - w/2, 390); g.setColor(Color.GRAY); if ((values[0] >= 240) && (values[0] <= 400) && (values[1] >= 360) && (values[1] <= 400)) { g.setColor(Color.YELLOW); } g.drawRoundRect(240, 360, 160, 40, 5, 5); } } else { if (values[4] <= 465) { int mouseX = -1; int mouseY = -1; if ((values[0] >= 10) && (values[0] < 465) && (values[1] >= 10) && (values[1] < 465)) { // Ins Spielfeld gedrückt mouseX = (int)((values[0] - 10) / 65); mouseY = (int)((values[1] - 10) / 65); } g.setClip(10, 10, 455, 455); for (int y = 0; y < 7; y++) { for (int x = 0; x < level[0].length; x++) { g.setStroke(new BasicStroke(5)); if (level[y][x] > 0) { if ((mouseX >= 0) && (mouseX == x) && (mouseY == y)) { if ((level[y][x] >= 2) && (level[y][x] <= 5)) { g.setColor(Color.YELLOW); } else { g.setColor(Color.RED); } g.drawOval(11 + x * 65, 11 + y * 65 - (int)(level[y+7][x]), 58, 58); } if (level[y][x] >= 2) { g.setStroke(new BasicStroke(15)); if ((level[y][x] == 2) || (level[y][x] == 10)) { g.setClip(11 + x * 65, 21 + y * 65 - (int)(level[y+7][x]), 58, 29); g.setColor(Color.GREEN); if ((bDelete != null) && (bDelete[y][x])) { g.setColor(new Color(g.getColor().getRed(), g.getColor().getGreen(), g.getColor().getBlue(), (int)(255 - level[y+21][x] * 2.5))); } g.drawOval(20 + x * 65, 30 + y * 65 - (int)(level[y+7][x]), 40, 40); } else if ((level[y][x] == 3) || (level[y][x] == 11)) { g.setClip(-1 + x * 65 + 29, 11 + y * 65 - (int)(level[y+7][x]), 29, 58); g.setColor(Color.BLUE); if ((bDelete != null) && (bDelete[y][x])) { g.setColor(new Color(g.getColor().getRed(), g.getColor().getGreen(), g.getColor().getBlue(), (int)(255 - level[y+21][x] * 2.5))); } g.drawOval(8 + x * 65, 20 + y * 65 - (int)(level[y+7][x]), 40, 40); } else if ((level[y][x] == 4) || (level[y][x] == 12)) { g.setClip(11 + x * 65, -2 + y * 65 + 29 - (int)(level[y+7][x]), 58, 29); g.setColor(Color.ORANGE); if ((bDelete != null) && (bDelete[y][x])) { g.setColor(new Color(g.getColor().getRed(), g.getColor().getGreen(), g.getColor().getBlue(), (int)(255 - level[y+21][x] * 2.5))); } g.drawOval(20 + x * 65, 7 + y * 65 - (int)(level[y+7][x]), 40, 40); } else if ((level[y][x] == 5) || (level[y][x] == 13)) { g.setClip(22 + x * 65, 11 + y * 65 - (int)(level[y+7][x]), 29, 58); g.setColor(Color.RED); if ((bDelete != null) && (bDelete[y][x])) { g.setColor(new Color(g.getColor().getRed(), g.getColor().getGreen(), g.getColor().getBlue(), (int)(255 - level[y+21][x] * 2.5))); } g.drawOval(31 + x * 65, 20 + y * 65 - (int)(level[y+7][x]), 40, 40); } else if ((level[y][x] == 6) || (level[y][x] == 14)) { g.setColor(Color.MAGENTA); if ((bDelete != null) && (bDelete[y][x])) { g.setColor(new Color(g.getColor().getRed(), g.getColor().getGreen(), g.getColor().getBlue(), (int)(255 - level[y+21][x] * 2.5))); } g.drawOval(20 + x * 65, 20 + y * 65 - (int)(level[y+7][x]), 40, 40); } if (level[y][x] > 8) { g.setClip(11 + x * 65, 11 + y * 65 - (int)(level[y+7][x]), 58, 58); g.setStroke(new BasicStroke(2)); g.setColor(Color.BLACK); g.drawOval(26 + x * 65, 26 + y * 65 - (int)(level[y+7][x]), 30, 30); g.drawLine(26 + x * 65, 41 + y * 65 - (int)(level[y+7][x]), 56 + x * 65, 41 + y * 65 - (int)(level[y+7][x])); g.drawLine(41 + x * 65, 26 + y * 65 - (int)(level[y+7][x]), 41 + x * 65, 56 + y * 65 - (int)(level[y+7][x])); } } } g.setClip(6, 6, 460, 460); } } g.setColor(Color.BLACK); g.setStroke(new BasicStroke(1)); g.setClip(0, 0, 640, 480); g.setStroke(new BasicStroke(3)); g.setFont(g.getFont().deriveFont(20f).deriveFont(1)); String s = "points"; g.drawString(s, 480, 25); s = "level"; g.drawString(s, 480, 310); g.fillOval(540, 265, 50, 50); for (int i = 0; i < String.valueOf((int)this.values[2]).length(); i++) { g.fillOval(580, 15 + i *30, 30, 30); } g.setColor(Color.DARK_GRAY); g.drawOval(540, 265, 50, 50); g.drawLine(470, 30, 580, 30); g.drawLine(470, 290, 540, 290); for (int i = 0; i < String.valueOf((int)this.values[2]).length(); i++) { g.drawOval(580, 15 + i *30, 30, 30); } g.setColor(Color.WHITE); g.setFont(g.getFont().deriveFont(40f).deriveFont(1)); s = String.valueOf((int)(values[3] + 1)); int w = g.getFontMetrics().stringWidth(s); g.drawString(s, 565 - w/2, 305); g.setFont(g.getFont().deriveFont(25f).deriveFont(1)); for (int i = 0; i < String.valueOf((int)this.values[2]).length(); i++) { s = String.valueOf((int)this.values[2]).substring(i, i +1); w = g.getFontMetrics().stringWidth(s); g.drawString(s, 595 - w/2, 40 + i * 30); } g.setColor(Color.BLACK); g.drawRect(480, 50, 30, 238); g.fillRect(480, (int)(288 - (values[7] * 238 / values[6])), 30, (int)(values[7] * 238 / values[6])); g.setFont(g.getFont().deriveFont(30f).deriveFont(1)); s = "menu"; w = g.getFontMetrics().stringWidth(s); g.drawString(s, 555 - w/2, 455); s = "restart"; w = g.getFontMetrics().stringWidth(s); g.drawString(s, 555 - w/2, 405); g.setColor(Color.GRAY); if ((values[0] >= 480) && (values[0] <= 630) && (values[1] >= 425) && (values[1] <= 465)) { g.setColor(Color.YELLOW); } g.drawRoundRect(480, 425, 150, 40, 5, 5); g.setColor(Color.GRAY); if ((values[0] >= 480) && (values[0] <= 630) && (values[1] >= 375) && (values[1] <= 415)) { g.setColor(Color.YELLOW); } g.drawRoundRect(480, 375, 150, 40, 5, 5); } } // Draw the entire results on the screen. appletGraphics.drawImage(screen, 0, 0, null); try { Thread.sleep(10); } catch (Exception e) { /* best practice */ }; if (!isActive()) { return; } } } public boolean handleEvent(Event e) { switch (e.id) { case Event.MOUSE_DOWN: // mouse button pressed values[13] = 1; break; case Event.MOUSE_UP: // mouse button released break; case Event.MOUSE_MOVE: values[0] = e.x; values[1] = e.y; break; case Event.MOUSE_DRAG: values[0] = e.x; values[1] = e.y; break; } return false; } }