View Game: Sokobond4k

Sokobond4k

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

(Click on game for focus)


You need Java installed to play this game.
You may use the button below to get it.

Get Java


Description

Sokobond4k is an elegantly designed puzzle game about chemistry.

It's logical, minimalist, and crafted with love and science.

It is a 4k version of the great "Sokobond" game by Alan Hazelden and Harry Lee.

Instructions

Play the game with cursor keys.

Press r to restart a level.
Press n to start the next level.
Press p to start the previous level.

User Comments

No comments have been made.

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.AWTEvent; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.event.KeyEvent; import java.awt.geom.Ellipse2D; import java.awt.image.BufferedImage; public class D extends Applet implements Runnable { private boolean[] keys = new boolean[256]; public void start() { enableEvents(AWTEvent.KEY_EVENT_MASK); new Thread(this).start(); } public void run() { // setSize(400, 400); // für den AppletViewer // Graphische Grundlagen für das Double Buffering BufferedImage screen = new BufferedImage(480,480,BufferedImage.TYPE_INT_RGB); Graphics2D g = screen.createGraphics(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Graphics2D appletGraphics = (Graphics2D)getGraphics(); // Variablen zum Zeitmessen und genau Timen wann geupdatet werden soll long lastTime = System.nanoTime(); long think = 0; final String[] EXPLANATIONS = new String[] { "H20 - Water", "Water is the least toxic compound.", "", "H20 - Water", "Water is the only substance naturally", "found in three states of matter.", "H20 - Water", "The earth's surface and the human body", "are both 70% water.", "H2O2 - hydrogen peroxide", "One litre of pure H2O2 can release", "over 300 litres of pure oxygen.", "NH3 - Ammonia", "Your kidney secrete ammonia", "to neutralise acid.", "NH3 - Ammonia", "Two thirds of all ammonia", "on earth comes from cows.", "CH4 - methane", "Earthquakes can release CH4", "into the ocean from undersea reserves", "CH4 - methane", "CH4 is highly flammable.", "", "NH2OH - hydroxylamine", "Many integrated circuits in computers", "were washed with NH2OH-based cleaners.", "CH3OH - methanol", "CH3OH is also called wood alcohol.", "", "", "NASA's helium balloons can float", "as high as 33 km.", "", "Helium molecules are small", "enough to leak through glass.", "", "Near absolute zero, helium forms", "a superfluid a liquid which climbs walls.", "", "Helium is a colorless, tasteless and odorless gas.", "", }; final String[] LEVELS = new String[] { "ihcf" + "000111111" + "000122221" + "111122221" + "122221421" + "122251221" + "124222221" + "122221111" + "111111000", "febd" + "111111" + "142251" + "122221" + "142111" + "111100", "hebc" + "00111110" + "11122211" + "15242421" + "11122211" + "00111110", "ggcd" + "1111111" + "1225221" + "1221221" + "1241421" + "1221221" + "1225221" + "1111111", "geeb" + "1111111" + "1242621" + "1222221" + "1242421" + "1111111", "ggdf" + "1111111" + "1222221" + "1222221" + "1414141" + "1222221" + "1226221" + "1111111", "iieb" + "000111000" + "001171100" + "011222110" + "112424211" + "122222221" + "112424211" + "011222110" + "001121100" + "000111000", "ieec" + "011111110" + "114222411" + "122272221" + "114222411" + "011111110", "hggd" + "11111111" + "12222221" + "12224221" + "15242261" + "12224221" + "12222221" + "11111111", "igcd" + "111111111" + "122222221" + "122424221" + "125222721" + "122424221" + "122222221" + "111111111", "igcc" + "111111111" + "122222221" + "124222321" + "111242111" + "001222100" + "001252100" + "001111100", "ihfd" + "111111111" + "122222221" + "123232321" + "111424111" + "001242100" + "001222100" + "001262100" + "001111100", "ghdd" + "1111111" + "1222221" + "1226221" + "1223221" + "1424241" + "1212121" + "1222221" + "1111111", "ggef" + "0011110" + "0112211" + "1122421" + "1226221" + "1242241" + "1122321" + "0111111", "hhge" + "11111111" + "12222221" + "12224161" + "12222221" + "11414231" + "01222221" + "01112221" + "00011111", // "ijeg" + // "001111100" + // "001222100" + // "111424111" + // "122222221" + // "122262221" + // "122121221" + // "124262421" + // "122121221" + // "122222221" + // "111111111", // // "gide" + // "1110111" + // "1221221" + // "1425241" + // "1222221" + // "1227221" + // "1222221" + // "1425241" + // "1221221" + // "1110111" }; String s = ""; int t = 0; int u = 0; int v = 0; int w = 0; int x = 0; int y = 0; int j = 0; int i = 0; int a = 0; int b = 0; int playerX = 0; int playerY = 0; int curLevel = 0; int[][] level = new int[1][1]; int[][] connection = new int[1][1]; int[][] which = new int[1][1]; int[][] movement = new int[1][1]; int[][] bool = new int[1][1]; float[][] ion = new float[1][1]; int[] z = new int[10]; ion[0][0] = which[0][0] = level[0][0] = connection[0][0] = -1; final BasicStroke stroke = new BasicStroke(2); final BasicStroke basicStroke = new BasicStroke(1); boolean bWin = false; boolean bRun = false; // Game loop. while (true) { long now = System.nanoTime(); long delta = now - lastTime; think += delta; // Update / think // Wenn 10 ms vergangen sind, dann denke nach while (think >= 10000000L) { think -= 10000000L; if (level[0][0] == -1) { bRun = bWin = false; s = LEVELS[curLevel]; x = s.substring(0, 1).charAt(0) - 96; y = s.substring(1, 2).charAt(0) - 96; playerX = s.substring(2, 3).charAt(0) - 97; playerY = s.substring(3, 4).charAt(0) - 97; level = new int[y][x]; connection = new int[y][x]; which = new int[y][x]; bool = new int[y][x]; ion = new float[y][x]; movement = new int[y*2][x]; a = 2; for (j = 0; j < y;="" j++)="" {="" for="" (i="0;" i="">< x;="" i++)="" {="" level[j][i]="s.substring(4" +="" j="" *="" x="" +="" i,="" 5="" +="" j="" *="" x="" +="" i).charat(0)="" -="" 48;="" ion[j][i]="-1;" if="" (level[j][i]=""> 2) { ion[j][i] = (int)(Math.random() * 359); which[j][i] = a; if ((i == playerX) && (j == playerY)) { which[j][i] = 1; } a += 1; } } } keys = new boolean[256]; } if (!bWin) { for (j = 0; j < level.length;="" j++)="" {="" for="" (i="0;" i="">< level[0].length;="" i++)="" {="" if="" (ion[j][i]="">= 0) { ion[j][i] += 0.4f; if (ion[j][i] >= 360) ion[j][i] -= 360; } } } if (!bRun) { u = w = y = x = 0; t = v = 1; boolean bReady = true; if (keys[KeyEvent.VK_LEFT]) { x = -1; w = 0; bReady = false; } if ((keys[KeyEvent.VK_RIGHT]) && (bReady)) { x = +1; v = -1; w = level[0].length - 1; bReady = false; } if ((keys[KeyEvent.VK_UP]) && (bReady)) { y = -1; u = 0; bReady = false; } if ((keys[KeyEvent.VK_DOWN]) && (bReady)) { y = +1; t = -1; u = level.length - 1; bReady = false; } if ((x != 0) || (y != 0)) { bReady = true; z = new int[10]; b = a = 0; z[a] = 1; do { for (j = u; j < level.length="" &&="" j="">= 0; j += t) { for (i = w; i < level[0].length="" &&="" i="">= 0; i += v) { if (which[j][i] == z[b]) { if (level[j+y][i+x] <= 1)="" {="" bready="false;" }="" if="" ((which[j+y][i+x]="" !="z[b])" &&="" (which[j+y][i+x]=""> 0) && (bReady)) { a += 1; z[a] = which[j+y][i+x]; } } } } b += 1; } while (b <= a);="" if="" (bready)="" {="" brun="true;" move="" for="" (j="u;" j=""></=>< level.length="" &&="" j="">= 0; j += t) { for (i = w; i < level[0].length="" &&="" i="">= 0; i += v) { for (b = 0; b <= a;="" b++)="" {="" if="" (which[j][i]="=" z[b])="" {="" which[j+y][i+x]="which[j][i];" level[j+y][i+x]="level[j][i];" if="" ((i="=" playerx)="" &&="" (j="=" playery))="" {="" playerx="i+x;" playery="j+y;" }="" connection[j+y][i+x]="connection[j][i];" ion[j+y][i+x]="ion[j][i];" ion[j][i]="connection[j][i]" =="" which[j][i]="0;" level[j][i]="2;" movement[j+y][i+x]="-x" *="" 40;="" movement[j+y+level.length][i+x]="-y" *="" 40;="" }="" }="" }="" }="" connection="" check="" for="" (j="u;" j=""></=>< level.length="" &&="" j="">= 0; j += t) { for (i = w; i < level[0].length="" &&="" i="">= 0; i += v) { for (b = 0; b <= a;="" b++)="" {="" if="" (which[j][i]="=" z[b])="" {="" int="" replace="0;" int="" replacewith="0;" if="" ((connection[j][i]/1000)%10="" +="" (connection[j][i]/100)%10="" +="" (connection[j][i]/10)%10="" +="" (connection[j][i])%10=""></=>< level[j][i]-3)="" {="" test="" up="" if="" ((which[j-1][i]=""> 0) && (which[j-1][i] != z[b]) && (((connection[j-1][i]/1000)%10 + (connection[j-1][i]/100)%10 + (connection[j-1][i]/10)%10 + (connection[j-1][i])%10) < level[j-1][i]-3))="" {="" connection[j][i]="" +="100;" connection[j-1][i]="" +="1;" bool[j-1][i]="1;" if="" (which[j-1][i]="=" 1)="" {="" replace="which[j][i];" replacewith="1;" }="" else="" {="" replacewith="which[j][i];" replace="which[j-1][i];" }="" for="" (y="0;" y="">< level.length;="" y++)="" {="" for="" (x="0;" x="">< level[0].length;="" x++)="" {="" if="" (which[y][x]="=" replace)="" {="" which[y][x]="replaceWith;" }="" }="" }="" }="" }="" if="" ((connection[j][i]/1000)%10="" +="" (connection[j][i]/100)%10="" +="" (connection[j][i]/10)%10="" +="" (connection[j][i])%10="">< level[j][i]-3)="" {="" test="" down="" if="" ((which[j+1][i]=""> 0) && (which[j+1][i] != z[b]) && (((connection[j+1][i]/1000)%10 + (connection[j+1][i]/100)%10 + (connection[j+1][i]/10)%10 + (connection[j+1][i])%10) < level[j+1][i]-3))="" {="" connection[j][i]="" +="1;" bool[j][i]="1;" connection[j+1][i]="" +="100;" if="" (which[j+1][i]="=" 1)="" {="" replace="which[j][i];" replacewith="1;" }="" else="" {="" replacewith="which[j][i];" replace="which[j+1][i];" }="" for="" (y="0;" y="">< level.length;="" y++)="" {="" for="" (x="0;" x="">< level[0].length;="" x++)="" {="" if="" (which[y][x]="=" replace)="" {="" which[y][x]="replaceWith;" }="" }="" }="" }="" }="" if="" ((connection[j][i]/1000)%10="" +="" (connection[j][i]/100)%10="" +="" (connection[j][i]/10)%10="" +="" (connection[j][i])%10="">< level[j][i]-3)="" {="" test="" left="" if="" ((which[j][i-1]=""> 0) && (which[j][i-1] != z[b]) && (((connection[j][i-1]/1000)%10 + (connection[j][i-1]/100)%10 + (connection[j][i-1]/10)%10 + (connection[j][i-1])%10) < level[j][i-1]-3))="" {="" connection[j][i]="" +="1000;" connection[j][i-1]="" +="10;" bool[j][i-1]="10;" if="" (which[j][i-1]="=" 1)="" {="" replace="which[j][i];" replacewith="1;" }="" else="" {="" replacewith="which[j][i];" replace="which[j][i-1];" }="" for="" (y="0;" y="">< level.length;="" y++)="" {="" for="" (x="0;" x="">< level[0].length;="" x++)="" {="" if="" (which[y][x]="=" replace)="" {="" which[y][x]="replaceWith;" }="" }="" }="" }="" }="" if="" ((connection[j][i]/1000)%10="" +="" (connection[j][i]/100)%10="" +="" (connection[j][i]/10)%10="" +="" (connection[j][i])%10="">< level[j][i]-3)="" {="" test="" right="" if="" ((which[j][i+1]=""> 0) && (which[j][i+1] != z[b]) && (((connection[j][i+1]/1000)%10 + (connection[j][i+1]/100)%10 + (connection[j][i+1]/10)%10 + (connection[j][i+1])%10) < level[j][i+1]-3))="" {="" connection[j][i]="" +="10;" bool[j][i]="10;" connection[j][i+1]="" +="1000;" if="" (which[j][i+1]="=" 1)="" {="" replace="which[j][i];" replacewith="1;" }="" else="" {="" replacewith="which[j][i];" replace="which[j][i+1];" }="" for="" (y="0;" y="">< level.length;="" y++)="" {="" for="" (x="0;" x="">< level[0].length;="" x++)="" {="" if="" (which[y][x]="=" replace)="" {="" which[y][x]="replaceWith;" }="" }="" }="" }="" }="" }="" }="" }="" }="" }="" }="" }="" else="" {="" brun="false;" for="" (j="0;" j="">< level.length;="" j++)="" {="" for="" (i="0;" i="">< level[0].length;="" i++)="" {="" for="" (a="0;" a="">< 2;="" a++)="" {="" if="" (movement[j="" +="" a="" *="" level.length][i]="" !="0)" {="" brun="true;" if="" (movement[j="" +="" a="" *="" level.length][i]="">< 0)="" {="" movement[j="" +="" a="" *="" level.length][i]="" +="2;" if="" (movement[j="" +="" a="" *="" level.length][i]="">= 0) movement[j][i] = 0; } if (movement[j + a * level.length][i] > 0) { movement[j + a * level.length][i] -= 2; if (movement[j + a * level.length][i] <= 0)="" movement[j][i]="0;" }="" }="" }="" }="" }="" win="" check="" if="" (!brun)="" {="" bool="new" int[level.length][level[0].length];="" bwin="true;" for="" (j="0;" j=""></=>< level.length;="" j++)="" {="" for="" (i="0;" i="">< level[0].length;="" i++)="" {="" if="" (which[j][i]=""> 0) { if ((connection[j][i]/1000)%10 + (connection[j][i]/100)%10 + (connection[j][i]/10)%10 + (connection[j][i])%10 != level[j][i] - 3) { bWin = false; } } } } } } } if ((keys[KeyEvent.VK_N]) || ((keys[KeyEvent.VK_SPACE]) && (bWin))) { curLevel += 1; if (curLevel >= LEVELS.length) curLevel = 0; level[0][0] = -1; think += 10000000L; } if (keys[KeyEvent.VK_P]) { curLevel -= 1; if (curLevel < 0)="" curlevel="LEVELS.length" -="" 1;="" level[0][0]="-1;" think="" +="10000000L;" }="" if="" (keys[keyevent.vk_r])="" {="" level[0][0]="-1;" think="" +="10000000L;" }="" }="" lasttime="now;" renderabschnitt="" hintergrund="" malen="" g.setcolor(color.white);="" g.fillrect(0,="" 0,="" 480,="" 480);="" g.setfont(new="" font(font.monospaced,="" font.bold,="" 19));="" y="(240" -="" level.length="" *="" 20);="" x="(240" -="" level[0].length="" *="" 20);="" for="" (j="0;" j="">< level.length;="" j++)="" {="" for="" (i="0;" i="">< level[0].length;="" i++)="" {="" if="" (level[j][i]="=" 1)="" {="" g.setcolor(new="" color(255,="" 210,="" 80));="" g.fillrect(i="" *="" 40="" +="" 2="" +="" x,="" j="" *="" 40="" +="" 2="" +="" y,="" 36,="" 36);="" }="" if="" (level[j][i]="">= 2) { g.setColor(new Color(238, 238, 238)); g.fillRect(i * 40 + 2 + x, j * 40 + 2 + y, 36, 36); } } } for (j = 0; j < level.length;="" j++)="" {="" for="" (i="0;" i="">< level[0].length;="" i++)="" {="" if="" (connection[j][i]=""> 0) { w = (connection[j][i]/10)%10; if ((w > 0) && ((bool[j][i] < 10)="" ||="" (bool[j][i]=""> 20))) { g.setColor(Color.BLACK); for (a = 0; a < w;="" a++)="" {="" g.fillrect(i="" *="" 40="" +="" 20="" +="" x="" +="" movement[j][i],="" j="" *="" 40="" +="" movement[j+level.length][i]="" +="" 20="" +="" y="" -="" 2="" -="" (w-1)="" *="" 5="" +="" a="" *="" 5,="" 40,="" 3);="" }="" }="" w="(connection[j][i])%10;" if="" ((w=""> 0) && ((bool[j][i] <= 0)="" ||="" (bool[j][i]="">= 10))) { g.setColor(Color.BLACK); for (a = 0; a < w;="" a++)="" {="" g.fillrect(i="" *="" 40="" +="" movement[j][i]="" +="" 20="" +="" x="" -="" 1="" -="" (w-1)="" *="" 5="" +="" a="" *="" 5,="" j="" *="" 40="" +="" movement[j+level.length][i]="" +="" 20="" +="" y="" -="" (w-1)="" *="" 5="" +="" a="" *="" 5,="" 3,="" 40);="" }="" }="" }="" if="" (level[j][i]="">= 3) { g.setColor(new Color(255, 255, 255)); if (level[j][i] == 4) { g.setColor(new Color(255, 136, 110)); } if (level[j][i] == 5) { g.setColor(new Color(163, 194, 255)); } if (level[j][i] == 6) { g.setColor(new Color(163, 210, 136)); } if (level[j][i] == 7) { g.setColor(new Color(255, 210, 110)); } g.fill(new Ellipse2D.Double(i * 40 + 6 + x + movement[j][i], j * 40 + 6 + y + movement[j+level.length][i], 28, 28)); if ((i == playerX) && (j == playerY)) { g.setColor(Color.RED); } else { g.setColor(Color.BLACK); } g.setStroke(stroke); g.draw(new Ellipse2D.Double(i * 40 + 6 + x + movement[j][i], j * 40 + 6 + y + movement[j+level.length][i], 28, 28)); g.setStroke(basicStroke); g.setColor(Color.BLACK); s = "He"; if (level[j][i] == 4) { s = "H"; } if (level[j][i] == 5) { s = "O"; } if (level[j][i] == 6) { s = "N"; } if (level[j][i] == 7) { s = "C"; } g.drawString(s, i * 40 + 20 - g.getFontMetrics().stringWidth(s)/2 + x + movement[j][i], j * 40 + 26 + y + movement[j+level.length][i]); if (ion[j][i] >= 0) { for (w = 0; w < level[j][i]="" -="" 3="" -="" ((connection[j][i]/1000)%10="" +="" (connection[j][i]/100)%10="" +="" (connection[j][i]/10)%10="" +="" (connection[j][i])%10);="" w++)="" {="" double="" io="360d" (level[j][i]="" -="" 3);="" double="" ioa="ion[j][i]" +="" io="" *="" w;="" if="" (io=""> 360) ioa -= 360; g.setColor(Color.WHITE); g.fill(new Ellipse2D.Double((i * 40 + 18 + x + (16d) * Math.sin(Math.toRadians(ioa)) + movement[j][i]), (j * 40 + 18 + y - (16d) * Math.cos(Math.toRadians(ioa)) + movement[j+level.length][i]), 6, 6)); g.setColor(Color.BLACK); g.draw(new Ellipse2D.Double((i * 40 + 18 + x + (16d) * Math.sin(Math.toRadians(ioa)) + movement[j][i]), (j * 40 + 18 + y - (16d) * Math.cos(Math.toRadians(ioa)) + movement[j+level.length][i]), 6, 6)); } } } } } g.setColor(Color.BLACK); s = "Press 'r' to restart"; if (bWin) { g.setColor(new Color(238, 238, 238, 200)); g.fillRect(10, 300, 460, 110); g.setColor(Color.BLACK); g.setFont(g.getFont().deriveFont(30f).deriveFont(1)); if (EXPLANATIONS.length > curLevel*3) { g.drawString(EXPLANATIONS[curLevel*3], 240 - g.getFontMetrics().stringWidth(EXPLANATIONS[curLevel*3])/2, 340); g.setFont(g.getFont().deriveFont(14f).deriveFont(1)); g.drawString(EXPLANATIONS[curLevel*3+1], 240 - g.getFontMetrics().stringWidth(EXPLANATIONS[curLevel*3+1])/2, 375); g.drawString(EXPLANATIONS[curLevel*3+2], 240 - g.getFontMetrics().stringWidth(EXPLANATIONS[curLevel*3+2])/2, 397); // s = EXPLANATIONS[curLevel*2+1].replaceAll("^(\\S*\\s){1,6}", ""); // if (s != null) { // g.drawString(EXPLANATIONS[curLevel*2+1].substring(0, EXPLANATIONS[curLevel*2+1].indexOf(s)), 240 - g.getFontMetrics().stringWidth(EXPLANATIONS[curLevel*2+1].substring(0, EXPLANATIONS[curLevel*2+1].indexOf(s)))/2, 370); // } // g.drawString(s, 240 - g.getFontMetrics().stringWidth(s)/2, 394); } if (EXPLANATIONS.length <= curlevel*3)="" {="" g.drawstring("congratulations",="" 240="" -="" g.getfontmetrics().stringwidth("congratulations")/2,="" 370);="" }="" s="Press space to start the next level" ;="" }="" g.setfont(g.getfont().derivefont(14f).derivefont(1));="" g.drawstring(s,="" 240="" -="" g.getfontmetrics().stringwidth(s)/2,="" 475);="" g.drawstring("level:="" "+(curlevel+1)+"/"+levels.length,="" 10,="" 26);="" g.setfont(g.getfont().derivefont(30f).derivefont(1));="" g.drawstring("sokobond4k",="" 240="" -="" g.getfontmetrics().stringwidth("sokobond4k")/2,="" 30);="" render="" das="" ganze="" auf="" den="" bildschirm="" appletgraphics.drawimage(screen,="" 0,="" 0,="" null);="" try="" {="" thread.sleep(5);="" }="" catch="" (exception="" e)="" {="" *="" nicht="" schã¶n="" aber="" selten="" */="" };="" if="" (!isactive())="" {="" return;="" }="" }="" }="" @override="" public="" void="" processevent(awtevent="" e)="" {="" if="" (e.getid()="=" keyevent.key_pressed)="" {="" keys[((keyevent)e).getkeycode()]="true;" }="" if="" (e.getid()="=" keyevent.key_released)="" {="" keys[((keyevent)e).getkeycode()]="false;" }="" }=""></=></=></=>