From 0786afb4d94d52c95d136e8ea9bded60423d0b00 Mon Sep 17 00:00:00 2001 From: cognitivegears Date: Tue, 8 Apr 2014 22:04:44 -0500 Subject: [PATCH 1/2] Refactored and cleaned up code. Modernized some constructs. --- src/com/droidquest/DQ.java | 248 +- src/com/droidquest/Room.java | 603 ++-- src/com/droidquest/RoomDisplay.java | 916 +++--- src/com/droidquest/SoundClip.java | 34 +- src/com/droidquest/Wire.java | 803 +++--- src/com/droidquest/avatars/GameCursor.java | 1451 +++++----- src/com/droidquest/avatars/HelpCam.java | 64 +- src/com/droidquest/avatars/LabCursor.java | 799 +++--- src/com/droidquest/avatars/PaintBrush.java | 547 ++-- src/com/droidquest/avatars/Remote.java | 510 ++-- src/com/droidquest/avatars/SolderingPen.java | 994 ++++--- .../droidquest/chipstuff/ChipCompiler.java | 369 ++- src/com/droidquest/chipstuff/Gate.java | 533 ++-- src/com/droidquest/chipstuff/Port.java | 339 ++- src/com/droidquest/chipstuff/PortSignal.java | 12 +- src/com/droidquest/chipstuff/Signal.java | 43 +- src/com/droidquest/decorations/Arrow.java | 90 +- src/com/droidquest/decorations/Graphix.java | 226 +- src/com/droidquest/decorations/Spark.java | 64 +- src/com/droidquest/decorations/TextBox.java | 37 +- src/com/droidquest/devices/ANDGate.java | 324 +-- src/com/droidquest/devices/Antenna.java | 335 ++- src/com/droidquest/devices/Bumper.java | 440 +-- src/com/droidquest/devices/ChipText.java | 134 +- src/com/droidquest/devices/ContactSensor.java | 288 +- src/com/droidquest/devices/Device.java | 343 ++- .../droidquest/devices/DirectionalSensor.java | 253 +- src/com/droidquest/devices/FlipFlop.java | 363 +-- src/com/droidquest/devices/GenericChip.java | 43 +- src/com/droidquest/devices/Grabber.java | 276 +- src/com/droidquest/devices/NOTGate.java | 297 +- src/com/droidquest/devices/Node.java | 278 +- src/com/droidquest/devices/ORGate.java | 350 +-- src/com/droidquest/devices/PortDevice.java | 80 +- .../droidquest/devices/Prototype16Chip.java | 497 ++-- .../droidquest/devices/Prototype32Chip.java | 587 ++-- src/com/droidquest/devices/PrototypeChip.java | 519 ++-- src/com/droidquest/devices/RoomSensor.java | 300 +- src/com/droidquest/devices/SmallChip.java | 740 +++-- src/com/droidquest/devices/StormShield.java | 157 +- src/com/droidquest/devices/Thruster.java | 372 ++- src/com/droidquest/devices/XORGate.java | 350 +-- src/com/droidquest/items/AmpireBot.java | 680 ++--- src/com/droidquest/items/AutoWire.java | 297 +- src/com/droidquest/items/BinaryKey.java | 97 +- src/com/droidquest/items/BlackCrystal.java | 74 +- src/com/droidquest/items/BlueRobot.java | 92 +- src/com/droidquest/items/Burner.java | 208 +- src/com/droidquest/items/Button.java | 78 +- src/com/droidquest/items/CamDisk.java | 60 +- src/com/droidquest/items/ChipDecompiler.java | 844 +++--- src/com/droidquest/items/Crystal.java | 202 +- src/com/droidquest/items/Disk.java | 145 +- src/com/droidquest/items/ElevatorKey.java | 93 +- src/com/droidquest/items/ElevatorSwitch.java | 130 +- src/com/droidquest/items/EndAnimation.java | 78 +- src/com/droidquest/items/EnergyButton.java | 54 +- src/com/droidquest/items/F12Form.java | 106 +- src/com/droidquest/items/FFButton.java | 86 +- src/com/droidquest/items/Factory.java | 111 +- src/com/droidquest/items/GateKeeper.java | 193 +- src/com/droidquest/items/GenericRobot.java | 875 +++--- src/com/droidquest/items/Ghost.java | 341 ++- src/com/droidquest/items/Handle.java | 152 +- src/com/droidquest/items/Hexagon.java | 68 +- src/com/droidquest/items/HiddenCamera.java | 22 +- src/com/droidquest/items/Initializer.java | 17 +- src/com/droidquest/items/Item.java | 1329 ++++----- src/com/droidquest/items/Key.java | 71 +- src/com/droidquest/items/Magnet.java | 72 +- src/com/droidquest/items/MasterRobot.java | 111 +- src/com/droidquest/items/MazeControl.java | 212 +- src/com/droidquest/items/MazeCreator.java | 179 +- src/com/droidquest/items/MazeLock.java | 48 +- src/com/droidquest/items/NotAButton.java | 153 +- src/com/droidquest/items/OrangeRobot.java | 125 +- src/com/droidquest/items/PC16Button.java | 87 +- src/com/droidquest/items/PC32Button.java | 87 +- src/com/droidquest/items/PCButton.java | 87 +- src/com/droidquest/items/Pellet.java | 123 +- src/com/droidquest/items/Polarizer.java | 153 +- src/com/droidquest/items/PowerSwitch.java | 164 +- src/com/droidquest/items/Sentry.java | 799 +++--- src/com/droidquest/items/Sentry3.java | 241 +- src/com/droidquest/items/SentryT1.java | 319 +-- src/com/droidquest/items/SentryT2.java | 208 +- src/com/droidquest/items/SkyGuard.java | 96 +- src/com/droidquest/items/SkywayFlyer.java | 107 +- src/com/droidquest/items/SlipperyToken.java | 85 +- src/com/droidquest/items/SonicLock.java | 276 +- src/com/droidquest/items/SpeedControl.java | 156 +- src/com/droidquest/items/SpyCam.java | 96 +- src/com/droidquest/items/Square.java | 69 +- src/com/droidquest/items/StormCloud.java | 504 ++-- src/com/droidquest/items/Suitcase.java | 139 +- src/com/droidquest/items/Sweeper.java | 388 ++- src/com/droidquest/items/Switch4A.java | 312 +- src/com/droidquest/items/Switch4B.java | 47 +- src/com/droidquest/items/Switch4C.java | 47 +- src/com/droidquest/items/Switch4D.java | 47 +- src/com/droidquest/items/Token.java | 209 +- src/com/droidquest/items/ToolBox.java | 447 ++- src/com/droidquest/items/Train.java | 175 +- src/com/droidquest/items/TrashCollector.java | 742 +++-- src/com/droidquest/items/Triangle.java | 68 +- src/com/droidquest/items/Turbine.java | 207 +- src/com/droidquest/items/UnBurner.java | 212 +- src/com/droidquest/items/VendingHandle.java | 341 ++- src/com/droidquest/items/WallHandle.java | 271 +- src/com/droidquest/items/Wave.java | 37 +- src/com/droidquest/items/WhiteRobot.java | 114 +- src/com/droidquest/items/WireTester.java | 161 +- src/com/droidquest/items/XitTicket.java | 120 +- src/com/droidquest/levels/Level.java | 1918 ++++++------- src/com/droidquest/levels/MainMenu.java | 624 ++-- src/com/droidquest/levels/RO1.java | 2007 +++++++------ src/com/droidquest/levels/RO2.java | 1886 ++++++------- src/com/droidquest/levels/RO3.java | 1698 ++++++----- src/com/droidquest/levels/RO4.java | 2121 +++++++------- src/com/droidquest/levels/RO5.java | 2247 +++++++-------- src/com/droidquest/levels/RO6.java | 1449 +++++----- src/com/droidquest/levels/ROEndGame.java | 286 +- src/com/droidquest/levels/ROEndGame2.java | 143 +- src/com/droidquest/levels/ROLab.java | 1105 ++++---- src/com/droidquest/levels/ROTut1.java | 1279 +++++---- src/com/droidquest/levels/ROTut2.java | 2453 ++++++++-------- src/com/droidquest/levels/ROTut3.java | 2510 ++++++++--------- src/com/droidquest/levels/ROTutA.java | 967 ++++--- src/com/droidquest/levels/ROTutB.java | 827 +++--- src/com/droidquest/levels/ROTutC.java | 698 +++-- src/com/droidquest/levels/ROTutD.java | 1417 +++++----- src/com/droidquest/levels/ROTutE.java | 663 +++-- src/com/droidquest/levels/ROTutF.java | 719 +++-- src/com/droidquest/materials/AntiPlayer.java | 57 +- src/com/droidquest/materials/AutoRunner.java | 131 +- src/com/droidquest/materials/BatteryIn.java | 128 +- src/com/droidquest/materials/BatteryOut.java | 117 +- src/com/droidquest/materials/BinaryLock.java | 391 +-- .../droidquest/materials/BlueGridSwitch.java | 345 ++- src/com/droidquest/materials/BlueWall.java | 20 +- .../droidquest/materials/CameraDisable.java | 51 +- .../droidquest/materials/CameraEnable.java | 92 +- src/com/droidquest/materials/ChipTester.java | 12 +- src/com/droidquest/materials/ChipTrash.java | 12 +- src/com/droidquest/materials/CoinSlot.java | 49 +- .../materials/CrystalRecharger.java | 81 +- .../materials/DeactivatorSwitch.java | 249 +- .../droidquest/materials/ElevatorDoor.java | 261 +- .../materials/ElevatorInPortal.java | 79 +- .../droidquest/materials/ElevatorLock.java | 139 +- .../materials/ElevatorOutPortal.java | 58 +- src/com/droidquest/materials/ForceField.java | 100 +- src/com/droidquest/materials/HotWires.java | 161 +- src/com/droidquest/materials/Lock.java | 429 +-- src/com/droidquest/materials/LockS1.java | 68 +- src/com/droidquest/materials/Material.java | 189 +- src/com/droidquest/materials/MineField.java | 64 +- src/com/droidquest/materials/Monitor.java | 10 +- src/com/droidquest/materials/MultiButton.java | 252 +- src/com/droidquest/materials/MultiSwitch.java | 282 +- src/com/droidquest/materials/PanicButton.java | 169 +- .../droidquest/materials/PeriscopeDown.java | 59 +- src/com/droidquest/materials/PeriscopeUp.java | 84 +- .../droidquest/materials/PlayerBlocker.java | 103 +- src/com/droidquest/materials/Portal.java | 107 +- .../droidquest/materials/PrototypeBurner.java | 12 +- .../droidquest/materials/RobotBlocker.java | 44 +- src/com/droidquest/materials/SecretReset.java | 50 +- src/com/droidquest/materials/SecretSet.java | 52 +- src/com/droidquest/materials/ShapeEditor.java | 127 +- src/com/droidquest/materials/SkyGuardMat.java | 28 +- .../droidquest/materials/SmallChipBurner.java | 12 +- src/com/droidquest/materials/Switch.java | 457 ++- src/com/droidquest/materials/Switch1.java | 48 +- src/com/droidquest/materials/SwitchA.java | 31 +- src/com/droidquest/materials/SwitchB.java | 85 +- src/com/droidquest/materials/VendingSlot.java | 49 +- src/com/droidquest/materials/XitSlot.java | 109 +- 178 files changed, 31022 insertions(+), 32600 deletions(-) diff --git a/src/com/droidquest/DQ.java b/src/com/droidquest/DQ.java index c54eaa8..4fe2b22 100644 --- a/src/com/droidquest/DQ.java +++ b/src/com/droidquest/DQ.java @@ -2,178 +2,134 @@ package com.droidquest; //This is the source code for DroidQuest 2.7. Copyright 2003 by Thomas Foote. -import java.io.*; -import java.awt.*; -import java.awt.event.*; -import java.awt.image.*; +import com.droidquest.levels.MainMenu; import javax.swing.*; - -import com.droidquest.avatars.GameCursor; -import com.droidquest.chipstuff.Port; -import com.droidquest.decorations.Arrow; -import com.droidquest.decorations.Graphix; -import com.droidquest.decorations.Spark; -import com.droidquest.decorations.TextBox; -import com.droidquest.devices.ANDGate; -import com.droidquest.devices.Device; -import com.droidquest.devices.FlipFlop; -import com.droidquest.devices.NOTGate; -import com.droidquest.devices.Node; -import com.droidquest.devices.ORGate; -import com.droidquest.devices.PortDevice; -import com.droidquest.devices.XORGate; -import com.droidquest.items.Item; -import com.droidquest.items.ToolBox; -import com.droidquest.levels.Level; -import com.droidquest.levels.MainMenu; -import com.droidquest.materials.Material; - -import java.util.Iterator; +import java.awt.*; +import java.awt.event.*; import java.util.Set; -import java.util.Vector; -import java.util.Date; -import java.lang.Integer; -import java.util.Random; -import java.applet.*; -import java.net.URL; -import java.net.MalformedURLException; -public class DQ extends JFrame implements ActionListener -{ - RoomDisplay myRoom; +public class DQ extends JFrame implements ActionListener { + private RoomDisplay myRoom; - public DQ () - { - // Constructor - super("DroidQuest"); - setSize(560+8,384+27+24); - addWindowListener( new WindowAdapter() - { - public void windowClosing(WindowEvent e) - { setVisible(false); dispose(); System.exit(0); } - }); - - setIconImage(new ImageIcon("images/helper0.gif").getImage()); + private DQ() { + // Constructor + super("DroidQuest"); + setSize(560 + 8, 384 + 27 + 24); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + setVisible(false); + dispose(); + System.exit(0); + } + }); - Container contentPane = getContentPane(); - myRoom = new RoomDisplay(); - myRoom.dq=this; + setIconImage(new ImageIcon("images/helper0.gif").getImage()); - addFocusListener(new FocusAdapter() - { - public void focusGained(FocusEvent e) - { - myRoom.requestFocus(); - } - }); + Container contentPane = getContentPane(); + myRoom = new RoomDisplay(); + myRoom.dq = this; - contentPane.add(myRoom); - myRoom.setLocation(0,0); + addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent e) { + myRoom.requestFocus(); + } + }); - JMenuBar menuBar; - JMenu fileMenu; - JMenuItem menuItemSave; - JMenuItem menuItemMain; - JCheckBoxMenuItem menuItemSound; - JMenuItem menuItemExit; + contentPane.add(myRoom); + myRoom.setLocation(0, 0); - menuBar = new JMenuBar(); - setJMenuBar(menuBar); - fileMenu = new JMenu("File"); - fileMenu.setMnemonic(KeyEvent.VK_F); - menuBar.add(fileMenu); + JMenuBar menuBar; + JMenu fileMenu; + JMenuItem menuItemSave; + JMenuItem menuItemMain; + JCheckBoxMenuItem menuItemSound; + JMenuItem menuItemExit; - menuItemSave = new JMenuItem("Save Level",KeyEvent.VK_S); - menuItemMain = new JMenuItem("Main Menu", KeyEvent.VK_M); - menuItemSound = new JCheckBoxMenuItem("Sound", true); - menuItemExit = new JMenuItem("Exit", KeyEvent.VK_X); - fileMenu.add(menuItemSave); - fileMenu.add(menuItemMain); - fileMenu.add(menuItemSound); - fileMenu.add(menuItemExit); + menuBar = new JMenuBar(); + setJMenuBar(menuBar); + fileMenu = new JMenu("File"); + fileMenu.setMnemonic(KeyEvent.VK_F); + menuBar.add(fileMenu); - menuItemSave.addActionListener(this); - menuItemMain.addActionListener(this); - menuItemSound.addActionListener(this); - menuItemExit.addActionListener(this); + menuItemSave = new JMenuItem("Save Level", KeyEvent.VK_S); + menuItemMain = new JMenuItem("Main Menu", KeyEvent.VK_M); + menuItemSound = new JCheckBoxMenuItem("Sound", true); + menuItemExit = new JMenuItem("Exit", KeyEvent.VK_X); + fileMenu.add(menuItemSave); + fileMenu.add(menuItemMain); + fileMenu.add(menuItemSound); + fileMenu.add(menuItemExit); - try - { - System.setErr(System.out); - } - catch (SecurityException e) {} - } + menuItemSave.addActionListener(this); + menuItemMain.addActionListener(this); + menuItemSound.addActionListener(this); + menuItemExit.addActionListener(this); - public static void main(String[] args) - { - DQ dq = new DQ(); - GraphicsConfiguration gc = dq.getGraphicsConfiguration(); - Rectangle bounds = gc.getBounds(); - dq.setLocation(bounds.x + (bounds.width - 568)/2, - bounds.y + (bounds.height - 435)/2 ); - dq.setVisible(true); + try { + System.setErr(System.out); + } + catch (SecurityException e) { + } + } - } + public static void main(String[] args) { + DQ dq = new DQ(); + GraphicsConfiguration gc = dq.getGraphicsConfiguration(); + Rectangle bounds = gc.getBounds(); + dq.setLocation(bounds.x + (bounds.width - 568) / 2, + bounds.y + (bounds.height - 435) / 2); + dq.setVisible(true); - public void actionPerformed(ActionEvent e) - { - if (e.getActionCommand() == "Save Level") - { - FileDialog fd = new FileDialog(this,"Save Level", FileDialog.SAVE); - fd.setDirectory("ROlevels"); - fd.show(); - System.out.println("Dialog returned with " - + fd.getDirectory() - + fd.getFile()); - if (fd.getFile() != null) - myRoom.SaveLevel(fd.getDirectory()+fd.getFile()); - } + } - if (e.getActionCommand() == "Main Menu") - { - int n = JOptionPane.showConfirmDialog(this,"Do you want to quit this level?", - "return to Main Menu", JOptionPane.YES_NO_OPTION); - if (n==0) - { - myRoom.level.Empty(); - myRoom.level = new MainMenu(myRoom); - myRoom.level.Init(); - } - } + public void actionPerformed(ActionEvent e) { + if (e.getActionCommand().equals("Save Level")) { + FileDialog fd = new FileDialog(this, "Save Level", FileDialog.SAVE); + fd.setDirectory("ROlevels"); + fd.show(); + System.out.println("Dialog returned with " + + fd.getDirectory() + + fd.getFile()); + if (fd.getFile() != null) { + myRoom.SaveLevel(fd.getDirectory() + fd.getFile()); + } + } - if (e.getActionCommand() == "Sound") - { - myRoom.useSounds = ((JCheckBoxMenuItem)e.getSource()).getState(); - if (myRoom.useSounds==false) - { - Set keys = myRoom.level.sounds.keySet(); - Iterator iterator = keys.iterator(); - while (iterator.hasNext()) { - String soundFile = iterator.next(); - SoundClip soundClip = myRoom.level.sounds.get(soundFile); - soundClip.audioClip.stop(); - } -// for (int a=0; a keys = myRoom.level.sounds.keySet(); + for (String soundFile : keys) { + SoundClip soundClip = myRoom.level.sounds.get(soundFile); + soundClip.audioClip.stop(); + } + } + } - } + if (e.getActionCommand().equals("Exit")) { + setVisible(false); + dispose(); + System.exit(0); + } + + } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - //Updating Tutorial levels to 2.0 // //ROTUT1 : Robot Anatomy diff --git a/src/com/droidquest/Room.java b/src/com/droidquest/Room.java index 5164277..2ebfcd6 100644 --- a/src/com/droidquest/Room.java +++ b/src/com/droidquest/Room.java @@ -1,14 +1,5 @@ package com.droidquest; -import java.awt.Color; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.Vector; - import com.droidquest.decorations.Arrow; import com.droidquest.decorations.Graphix; import com.droidquest.decorations.TextBox; @@ -16,340 +7,314 @@ import com.droidquest.items.Item; import com.droidquest.levels.Level; import com.droidquest.materials.Material; -public class Room implements Serializable, Cloneable -{ -public transient static Level level; -public transient Room upRoom; -public transient Room downRoom; -public transient Room rightRoom; -public transient Room leftRoom; -public transient Item portalItem = null; +import java.awt.*; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.Vector; -public int[][] RoomArray = { // Array of image references - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} -}; -public transient Material[][] MaterialArray = new Material[12][20]; -public Vector textBoxes = new Vector(); -public Vector wires = new Vector(); -public Vector graphix = new Vector(); -public Vector arrows = new Vector(); -public boolean editable; +public class Room implements Serializable, Cloneable { + public transient static Level level; + public transient Room upRoom; + public transient Room downRoom; + public transient Room rightRoom; + public transient Room leftRoom; + public transient Item portalItem = null; -public Room() - { - upRoom=this; - downRoom=this; - rightRoom=this; - leftRoom=this; - editable=false; - } + public int[][] RoomArray = { // Array of image references + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + }; + public transient Material[][] MaterialArray = new Material[12][20]; + public Vector textBoxes = new Vector(); + public Vector wires = new Vector(); + public Vector graphix = new Vector(); + public Vector arrows = new Vector(); + public boolean editable; -public void writeRef(ObjectOutputStream s) throws IOException - { - s.writeInt(level.rooms.indexOf(upRoom)); - s.writeInt(level.rooms.indexOf(downRoom)); - s.writeInt(level.rooms.indexOf(rightRoom)); - s.writeInt(level.rooms.indexOf(leftRoom)); - s.writeInt(level.items.indexOf(portalItem)); - s.writeInt(wires.size()); - for (int a=0; a(); + for (int a = 0; a < numWires; a++) { + Wire wire = new Wire(); + wires.addElement(wire); + wire.readRef(s, level); + } -public void SetMaterial(int X, int Y, int index) - { - Material mat = (Material) level.materials.elementAt(index); - if (mat != null) - { - RoomArray[Y][X] = index; - MaterialArray[Y][X] = mat; - } - } + for (int a = 0; a < graphix.size(); a++) { + graphix.elementAt(a).GenerateIcons(); + } -public void SetMaterial(int X, int Y, Material mat) - { - int index = level.materials.indexOf(mat); - RoomArray[Y][X] = index; - MaterialArray[Y][X] = mat; - } + GenerateArray(); + } -public void SetMaterialFill(int X1, int Y1, int X2, int Y2, int index) - { - Material mat = (Material) level.materials.elementAt(index); - if (mat != null) - { - for (int Y=Y1; Y<=Y2; Y++) - for(int X=X1; X<=X2; X++) - { - RoomArray[Y][X] = index; - MaterialArray[Y][X] = mat; - } - } - } + public void GenerateArray() { + MaterialArray = new Material[12][20]; + for (int y = 0; y < 12; y++) { + for (int x = 0; x < 20; x++) { + MaterialArray[y][x] = level.materials.elementAt(RoomArray[y][x]); + } + } + } -public void SetMaterialOutline(int X1, int Y1, int X2, int Y2, int index) - { - Material mat = (Material) level.materials.elementAt(index); - if (mat != null) - { - for (int Y=Y1; Y<=Y2; Y++) - { - RoomArray[Y][X1] = index; - MaterialArray[Y][X1] = mat; - RoomArray[Y][X2] = index; - MaterialArray[Y][X2] = mat; - } - - for(int X=X1; X<=X2; X++) - { - RoomArray[Y1][X] = index; - MaterialArray[Y1][X] = mat; - RoomArray[Y2][X] = index; - MaterialArray[Y2][X] = mat; - } - } - } + public void SetMaterial(int X, int Y, int index) { + Material mat = level.materials.elementAt(index); + if (mat != null) { + RoomArray[Y][X] = index; + MaterialArray[Y][X] = mat; + } + } -public void SetMaterialFromRoom(int roomIndex) - { - Room r = (Room) level.rooms.elementAt(roomIndex); - for (int Y=0; Y<12; Y++) - for (int X=0; X<20; X++) - { - RoomArray[Y][X] = r.RoomArray[Y][X]; - MaterialArray[Y][X] = r.MaterialArray[Y][X]; - } - } + public void SetMaterial(int X, int Y, Material mat) { + int index = level.materials.indexOf(mat); + RoomArray[Y][X] = index; + MaterialArray[Y][X] = mat; + } -public void AddTextBox(String t, int X, int Y, int W) - { - TextBox newText = new TextBox(t,X,Y,W); - textBoxes.addElement(newText); - } + public void SetMaterialFill(int X1, int Y1, int X2, int Y2, int index) { + Material mat = level.materials.elementAt(index); + if (mat != null) { + for (int Y = Y1; Y <= Y2; Y++) { + for (int X = X1; X <= X2; X++) { + RoomArray[Y][X] = index; + MaterialArray[Y][X] = mat; + } + } + } + } -public void AddArrow(int X, int Y, int dir, int len, Color col) - { - Arrow newArrow = new Arrow( X, Y, dir, len, col); - arrows.addElement(newArrow); - } + public void SetMaterialOutline(int X1, int Y1, int X2, int Y2, int index) { + Material mat = level.materials.elementAt(index); + if (mat != null) { + for (int Y = Y1; Y <= Y2; Y++) { + RoomArray[Y][X1] = index; + MaterialArray[Y][X1] = mat; + RoomArray[Y][X2] = index; + MaterialArray[Y][X2] = mat; + } -public void AddGraphix(String t, int X, int Y) - { - Graphix newGraphix = new Graphix(t,X,Y); - graphix.addElement(newGraphix); - } + for (int X = X1; X <= X2; X++) { + RoomArray[Y1][X] = index; + MaterialArray[Y1][X] = mat; + RoomArray[Y2][X] = index; + MaterialArray[Y2][X] = mat; + } + } + } -public void AddGraphix(String[] t, int X, int Y) - { - Graphix newGraphix = new Graphix(t,X,Y); - graphix.addElement(newGraphix); - } + public void SetMaterialFromRoom(int roomIndex) { + Room r = level.rooms.elementAt(roomIndex); + for (int Y = 0; Y < 12; Y++) { + for (int X = 0; X < 20; X++) { + RoomArray[Y][X] = r.RoomArray[Y][X]; + MaterialArray[Y][X] = r.MaterialArray[Y][X]; + } + } + } -public void DrawTextBoxes(Graphics g, RoomDisplay rd) - { - for (int a=0; a= textBox.textString.lastIndexOf(" ")) - {indexTo = textBox.textString.length();} - else - {indexTo = textBox.textString.indexOf(" ",indexFrom+1);} - nextWord = textBox.textString.substring(indexFrom, indexTo); - if (nextWord.startsWith(" ")) - { - nextWord = nextWord.substring(1,nextWord.length()); - } - if (!nextWord.endsWith(" ")) - { - nextWord = nextWord + " "; - } - - if (nextWord.startsWith("{BIG}")) - { - g.setFont(rd.bigFont); - } - - else if (nextWord.startsWith("{SML}")) - { - g.setFont(rd.smallFont); - } - - else if (nextWord.startsWith("{BSP}")) - { - FontMetrics fm = g.getFontMetrics(); - advX = fm.stringWidth(" "); - cursX-=advX; - } - - // if (nextWord fits "{rrr,ggg,bbb} " - else if (nextWord.startsWith("{") - && nextWord.endsWith("} ") - && nextWord.length()==14) - { - // extract rrr,ggg,bbb - Integer rr = new Integer(nextWord.substring(1,4)); - Integer gg = new Integer(nextWord.substring(5,8)); - Integer bb = new Integer(nextWord.substring(9,12)); - g.setColor(new Color(rr.intValue(), - gg.intValue(), - bb.intValue())); - } - else - { - FontMetrics fm = g.getFontMetrics(); - if (fm.getAscent() > advY) - {advY = fm.getAscent() ;} - advX = fm.stringWidth(nextWord); - if (cursX+advX > textBox.width + textBox.x) - { - cursX=textBox.x; - cursY+=advY; - advY=fm.getAscent(); - } - g.drawString(nextWord, cursX, cursY); - cursX+=advX; - if (cursX+advX > textBox.width + textBox.x) - { - cursX=textBox.x; - cursY+=advY; - advY=fm.getAscent(); - } - } - indexFrom = indexTo; - } - while (indexFrom < textBox.textString.length()); - } - } + public void AddTextBox(String t, int X, int Y, int W) { + TextBox newText = new TextBox(t, X, Y, W); + textBoxes.addElement(newText); + } -public void DrawGraphix(Graphics g, RoomDisplay rd) - { - for (int a = 0; a< graphix.size(); a++) - { - Graphix grx = (Graphix) graphix.elementAt(a); - grx.Draw(g,rd); - } - } + public void AddArrow(int X, int Y, int dir, int len, Color col) { + Arrow newArrow = new Arrow(X, Y, dir, len, col); + arrows.addElement(newArrow); + } -public void DrawArrows(Graphics g) - { - for (int a = 0; a< arrows.size(); a++) - ((Arrow) arrows.elementAt(a)).Draw(g); - } + public void AddGraphix(String t, int X, int Y) { + Graphix newGraphix = new Graphix(t, X, Y); + graphix.addElement(newGraphix); + } -public Room getUpRoom(Item item) - { - return upRoom; - } + public void AddGraphix(String[] t, int X, int Y) { + Graphix newGraphix = new Graphix(t, X, Y); + graphix.addElement(newGraphix); + } -public Room getDownRoom(Item item) - { - return downRoom; - } + public void DrawTextBoxes(Graphics g, RoomDisplay rd) { + for (int a = 0; a < textBoxes.size(); a++) { + TextBox textBox = textBoxes.elementAt(a); + g.setColor(Color.white); + g.setFont(rd.smallFont); -public Room getLeftRoom(Item item) - { - return leftRoom; - } + int cursX = textBox.x; + int cursY = textBox.y; + int advY = 0; + int advX; + String nextWord; + int indexFrom = 0; + int indexTo; -public Room getRightRoom(Item item) - { - return rightRoom; - } + do { + // Get the next word in the string + if (indexFrom >= textBox.textString.lastIndexOf(" ")) { + indexTo = textBox.textString.length(); + } + else { + indexTo = textBox.textString.indexOf(" ", indexFrom + 1); + } + nextWord = textBox.textString.substring(indexFrom, indexTo); + if (nextWord.startsWith(" ")) { + nextWord = nextWord.substring(1, nextWord.length()); + } + if (!nextWord.endsWith(" ")) { + nextWord = nextWord + " "; + } -public Wire FindWire(int wireIndex) - { - if (wireIndex==-1) return null; - if (wireIndex>=wires.size()) return null; - return (Wire) wires.elementAt(wireIndex); - } + if (nextWord.startsWith("{BIG}")) { + g.setFont(rd.bigFont); + } -public Object clone() - { - Object newObject = null; - try - { - newObject = super.clone(); - } - catch (CloneNotSupportedException e) {} - return newObject; - } + else if (nextWord.startsWith("{SML}")) { + g.setFont(rd.smallFont); + } -public void Erase() - { - upRoom = null; - downRoom = null; - rightRoom = null; - leftRoom = null; - portalItem = null; - arrows.clear(); - graphix.clear(); - for (int a=0; a< wires.size(); a++) - { - Wire wire = (Wire) wires.elementAt(a); - wire.fromPort = null; - wire.toPort = null; - wire.inPort = null; - wire.outPort = null; - } - wires.clear(); - } + else if (nextWord.startsWith("{BSP}")) { + FontMetrics fm = g.getFontMetrics(); + advX = fm.stringWidth(" "); + cursX -= advX; + } + + // if (nextWord fits "{rrr,ggg,bbb} " + else if (nextWord.startsWith("{") + && nextWord.endsWith("} ") + && nextWord.length() == 14) { + // extract rrr,ggg,bbb + Integer rr = new Integer(nextWord.substring(1, 4)); + Integer gg = new Integer(nextWord.substring(5, 8)); + Integer bb = new Integer(nextWord.substring(9, 12)); + g.setColor(new Color(rr.intValue(), + gg.intValue(), + bb.intValue())); + } + else { + FontMetrics fm = g.getFontMetrics(); + if (fm.getAscent() > advY) { + advY = fm.getAscent(); + } + advX = fm.stringWidth(nextWord); + if (cursX + advX > textBox.width + textBox.x) { + cursX = textBox.x; + cursY += advY; + advY = fm.getAscent(); + } + g.drawString(nextWord, cursX, cursY); + cursX += advX; + if (cursX + advX > textBox.width + textBox.x) { + cursX = textBox.x; + cursY += advY; + advY = fm.getAscent(); + } + } + indexFrom = indexTo; + } + while (indexFrom < textBox.textString.length()); + } + } + + public void DrawGraphix(Graphics g, RoomDisplay rd) { + for (int a = 0; a < graphix.size(); a++) { + Graphix grx = graphix.elementAt(a); + grx.Draw(g, rd); + } + } + + public void DrawArrows(Graphics g) { + for (int a = 0; a < arrows.size(); a++) { + arrows.elementAt(a).Draw(g); + } + } + + public Room getUpRoom(Item item) { + return upRoom; + } + + public Room getDownRoom(Item item) { + return downRoom; + } + + public Room getLeftRoom(Item item) { + return leftRoom; + } + + public Room getRightRoom(Item item) { + return rightRoom; + } + + public Wire FindWire(int wireIndex) { + if (wireIndex == -1) { + return null; + } + if (wireIndex >= wires.size()) { + return null; + } + return wires.elementAt(wireIndex); + } + + public Object clone() { + Object newObject = null; + try { + newObject = super.clone(); + } + catch (CloneNotSupportedException e) { + } + return newObject; + } + + public void Erase() { + upRoom = null; + downRoom = null; + rightRoom = null; + leftRoom = null; + portalItem = null; + arrows.clear(); + graphix.clear(); + for (int a = 0; a < wires.size(); a++) { + Wire wire = wires.elementAt(a); + wire.fromPort = null; + wire.toPort = null; + wire.inPort = null; + wire.outPort = null; + } + wires.clear(); + } } diff --git a/src/com/droidquest/RoomDisplay.java b/src/com/droidquest/RoomDisplay.java index 94de385..c3766fc 100644 --- a/src/com/droidquest/RoomDisplay.java +++ b/src/com/droidquest/RoomDisplay.java @@ -1,33 +1,5 @@ package com.droidquest; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.geom.AffineTransform; -import java.awt.image.BufferedImage; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -import javax.swing.ImageIcon; -import javax.swing.JPanel; -import javax.swing.Timer; - import com.droidquest.avatars.LabCursor; import com.droidquest.chipstuff.Port; import com.droidquest.decorations.Graphix; @@ -38,525 +10,459 @@ import com.droidquest.levels.Level; import com.droidquest.levels.MainMenu; import com.droidquest.materials.Material; -public class RoomDisplay extends JPanel -{ - public DQ dq; - Level level; - public Timer timer; - int timerspeed=128; - public boolean useSounds = true; - AffineTransform at = new AffineTransform(); +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; +import java.io.*; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; - public Font bigFont; - public Font smallFont; - private int repeating=0; // Used for repeating keys +public class RoomDisplay extends JPanel { + public DQ dq; + Level level; + public Timer timer; + private int timerspeed = 128; + public boolean useSounds = true; + private AffineTransform at = new AffineTransform(); - //public boolean isFocusTraversable() - // { - // Necessary to get the keyboard focus to work with - // the ScrenDisplay class. - // return(true); - // } + public Font bigFont; + public Font smallFont; - public boolean isFocusable() - { - // Necessary to get the keyboard focus to work with - // the ScrenDisplay class. - return(true); - } + public boolean isFocusable() { + // Necessary to get the keyboard focus to work with + // the ScrenDisplay class. + return (true); + } - public RoomDisplay() - { - setSize(new Dimension(560,384)); - level = new MainMenu(this); - level.Init(); - smallFont = new Font("Courier",Font.BOLD, 20); - bigFont = new Font("Courier",Font.BOLD, 45); - // setFocusable(true); - requestFocus(); + public RoomDisplay() { + setSize(new Dimension(560, 384)); + level = new MainMenu(this); + level.Init(); + smallFont = new Font("Courier", Font.BOLD, 20); + bigFont = new Font("Courier", Font.BOLD, 45); + requestFocus(); - // Resizing Fuctions - addComponentListener(new ComponentAdapter() { - public void componentResized(ComponentEvent e) - { - Dimension d = new Dimension(); - getSize(d); - double w = d.width / 560.0; - double h = d.height / 384.0; - at.setToScale(w,h); - } - }); + // Resizing Fuctions + addComponentListener(new ComponentAdapter() { + public void componentResized(ComponentEvent e) { + Dimension d = new Dimension(); + getSize(d); + double w = d.width / 560.0; + double h = d.height / 384.0; + at.setToScale(w, h); + } + }); - // Key Released Functions - addKeyListener(new KeyAdapter() { - public void keyReleased(KeyEvent e) { - // Event Handler for KeyReleased here - if (level.player.KeyUp(e)) - repaint(); + // Key Released Functions + addKeyListener(new KeyAdapter() { + public void keyReleased(KeyEvent e) { + // Event Handler for KeyReleased here + if (level.player.KeyUp(e)) { + repaint(); + } - if (e.getKeyCode() == e.VK_Q) - { - if (timerspeed>1) - timerspeed /= 2; - timer.setDelay(timerspeed); - } + if (e.getKeyCode() == e.VK_Q) { + if (timerspeed > 1) { + timerspeed /= 2; + } + timer.setDelay(timerspeed); + } - if (e.getKeyCode() == e.VK_W) - { - if (timerspeed<128) - timerspeed*=2; - if ( (timerspeed>=128) && (level.player instanceof LabCursor) ) - timerspeed*=2; - timer.setDelay(timerspeed); - } + if (e.getKeyCode() == e.VK_W) { + if (timerspeed < 128) { + timerspeed *= 2; + } + if ((timerspeed >= 128) && (level.player instanceof LabCursor)) { + timerspeed *= 2; + } + timer.setDelay(timerspeed); + } - } - }); + } + }); - // Key Pressed Functions - addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent e) { - if (level.player.KeyDown(e)) - repaint(); - return; - } - }); + // Key Pressed Functions + addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + if (level.player.KeyDown(e)) { + repaint(); + } + } + }); - // Mouse Functions - addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent e) { - int newX = (int) (e.getX() / at.getScaleX()); - int newY = (int) (e.getY() / at.getScaleY()); - int deltaX = newX - e.getX(); - int deltaY = newY - e.getY(); - e.translatePoint(deltaX,deltaY); - level.player.MouseClick(e); - } - }); + // Mouse Functions + addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + int newX = (int) (e.getX() / at.getScaleX()); + int newY = (int) (e.getY() / at.getScaleY()); + int deltaX = newX - e.getX(); + int deltaY = newY - e.getY(); + e.translatePoint(deltaX, deltaY); + level.player.MouseClick(e); + } + }); - timer = new Timer(timerspeed, new ActionListener() { - public void actionPerformed(ActionEvent e) - { - if (level.portal != null) - { - String filename = level.portal.levelName; - boolean bringStuff = level.portal.bringStuff; - boolean initLevel = level.portal.initLevel; - int x = level.player.x + level.player.getWidth()/2; - int y = level.player.y + level.player.getHeight()/2; - Graphics g = getGraphics(); - level.PlaySound(level.currentViewer.room,Level.TELEPORTSOUND); - boolean tempsound = level.roomdisplay.useSounds; - level.roomdisplay.useSounds = false; - // for (int a=0; a<560; a+=2) - // { - // int c = 255*a/560; - // g.setColor(new Color(c,255-c,0)); - // g.drawRect(x-a-1,y-a-1,a*2+2,a*2+2); - // g.setColor(Color.black); - // g.drawRect(x-a,y-a,a*2,a*2); - // long timeout = System.currentTimeMillis() + 1; - // do {} while (System.currentTimeMillis() < timeout); - // } - // g.setColor(Color.black); - // for (int a=0; a<560; a++) - // { - // g.drawRect(x-a,y-a,a*2,a*2); - // long timeout = System.currentTimeMillis() + 1; - // do {} while (System.currentTimeMillis() < timeout); - // } - if (bringStuff) - { - System.out.println("Saving carried items."); - level.WriteInventory(); - } + timer = new Timer(timerspeed, new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (level.portal != null) { + String filename = level.portal.levelName; + boolean bringStuff = level.portal.bringStuff; + boolean initLevel = level.portal.initLevel; - FileInputStream f; - try - { - f = new FileInputStream(filename); - try {f.close();} catch (IOException ie){} - } - catch(FileNotFoundException ie) - { - // filename does not exist - RoomDisplay rd = level.roomdisplay; - String classname = "com.droidquest.levels."+filename.substring(0,filename.length()-4); - Constructor constructor = null; - try - { - Class newlevel = Class.forName(classname); - Class[] arglist = {Class.forName("com.droidquest.RoomDisplay")}; - constructor = newlevel.getConstructor(arglist); - constructor.setAccessible(true); - } - catch (ClassNotFoundException ce) { - ce.printStackTrace(); - } - catch (NoSuchMethodException ne) { - ne.printStackTrace(); - }; - try - { - Object[] args = {rd}; - level = (Level) constructor.newInstance(args); - rd.SaveLevel(); - } - catch(InstantiationException ie2) - { - System.out.println("Instantiation"); - System.exit(0); - } - catch(IllegalAccessException ie2) - { - System.out.println("Illegal Access"); - System.exit(0); - } - catch(IllegalArgumentException ie2) - { - System.out.println("Illegal Argument"); - System.exit(0); - } - catch(InvocationTargetException ie2) - { - System.out.println("Invocation Target"); - Throwable t = ie2.getTargetException(); - ie2.printStackTrace(); - System.out.println(t.getClass()); - System.exit(0); - }; - } - // { - // look for a class that matches the name "filename" without the ".lvl" - // if found, create it and save it, then load the file. - // } + level.PlaySound(level.currentViewer.room, Level.TELEPORTSOUND); + boolean tempsound = level.roomdisplay.useSounds; + level.roomdisplay.useSounds = false; + if (bringStuff) { + System.out.println("Saving carried items."); + level.WriteInventory(); + } - System.out.println("Loading level " + filename); - LoadLevel(filename); - if (initLevel) - { - System.out.println("Initializing Level"); - level.Init(); - } - if (bringStuff) - { - System.out.println("Loading carried items."); - level.LoadInventory(); - } - x = level.player.x + level.player.getWidth()/2; - y = level.player.y + level.player.getHeight()/2; + FileInputStream f; + try { + f = new FileInputStream(filename); + try { + f.close(); + } + catch (IOException ie) { + } + } + catch (FileNotFoundException ie) { + // filename does not exist + RoomDisplay rd = level.roomdisplay; + String classname = "com.droidquest.levels." + filename.substring(0, filename.length() - 4); + Constructor constructor = null; + try { + Class newlevel = Class.forName(classname); + Class[] arglist = {Class.forName("com.droidquest.RoomDisplay")}; + constructor = newlevel.getConstructor(arglist); + constructor.setAccessible(true); + } + catch (ClassNotFoundException ce) { + ce.printStackTrace(); + } + catch (NoSuchMethodException ne) { + ne.printStackTrace(); + } + try { + Object[] args = {rd}; + level = (Level) constructor.newInstance(args); + rd.SaveLevel(); + } + catch (InstantiationException ie2) { + System.out.println("Instantiation"); + System.exit(0); + } + catch (IllegalAccessException ie2) { + System.out.println("Illegal Access"); + System.exit(0); + } + catch (IllegalArgumentException ie2) { + System.out.println("Illegal Argument"); + System.exit(0); + } + catch (InvocationTargetException ie2) { + System.out.println("Invocation Target"); + Throwable t = ie2.getTargetException(); + ie2.printStackTrace(); + System.out.println(t.getClass()); + System.exit(0); + } + } + // { + // look for a class that matches the name "filename" without the ".lvl" + // if found, create it and save it, then load the file. + // } - // for (int a=560; a>0; a-=2) - // { - // int c = 255*a/560; - // g.setColor(new Color(255-c,c,0)); - // g.drawRect(x-a-1,y-a-1,a*2+2,a*2+2); - // g.setColor(Color.black); - // g.drawRect(x-a,y-a,a*2,a*2); - // long timeout = System.currentTimeMillis() + 1; - // do {} while (System.currentTimeMillis() < timeout); - // } - // g.setColor(Color.black); - // for (int a=560; a>0; a--) - // { - // g.drawRect(x-a,y-a,a*2,a*2); - // long timeout = System.currentTimeMillis() + 1; - // do {} while (System.currentTimeMillis() < timeout); - // } - level.roomdisplay.useSounds = tempsound; - level.PlaySound(level.currentViewer.room,Level.TRANSPORTSOUND); - } - Electricity(); - for (int a = 0; a < level.items.size(); a++) - { - Item item = (Item) level.items.elementAt(a); - item.Animate(); - if (item.room == level.currentViewer.room) - item.Decorate(); - } - for (int a=0; a6) - { - level.sparks.removeElement(spark); - a--; - } - } - } - }); + level.roomdisplay.useSounds = tempsound; + level.PlaySound(level.currentViewer.room, Level.TRANSPORTSOUND); + } + Electricity(); + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + item.Animate(); + if (item.room == level.currentViewer.room) { + item.Decorate(); + } + } + for (int a = 0; a < level.materials.size(); a++) { + level.materials.elementAt(a).Animate(); + } + for (int a = 0; a < level.rooms.size(); a++) { + Room room = level.rooms.elementAt(a); + for (int b = 0; b < room.graphix.size(); b++) { + Graphix graphix = room.graphix.elementAt(b); + graphix.Animate(); + } + } - Image tempImage= new BufferedImage(200,200,BufferedImage.TYPE_4BYTE_ABGR); - Graphics g = tempImage.getGraphics(); - Image tempIcon; - ImageIcon tempImageIcon; + repaint(); + for (int a = 0; a < level.sparks.size(); a++) { + Spark spark = (Spark) level.sparks.elementAt(a); + spark.Age(); + if (spark.age > 6) { + level.sparks.removeElement(spark); + a--; + } + } + } + }); - for (int a = 0; a= level.gameCursor.x - && device.ports[b].x+device.x <= level.gameCursor.x + level.gameCursor.getWidth() - && device.ports[b].y+device.y >= level.gameCursor.y - && device.ports[b].y+device.y <= level.gameCursor.y + level.gameCursor.getHeight()) - if (((LabCursor)level.gameCursor).hot) - device.ports[b].value = true; - } - } - } - } + void Electricity() { + if (!level.electricity) { + return; + } - for (int a=0; a= level.gameCursor.x + && device.ports[b].x + device.x <= level.gameCursor.x + level.gameCursor.getWidth() + && device.ports[b].y + device.y >= level.gameCursor.y + && device.ports[b].y + device.y <= level.gameCursor.y + level.gameCursor.getHeight()) { + if (((LabCursor) level.gameCursor).hot) { + device.ports[b].value = true; + } + } + } + } + } + } + } + } + + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item.isDevice()) { + Device device = (Device) item; + device.Function(); + } + } - boolean nodeChanged; - int counter=0; - do - { - nodeChanged=false; - for (int a=0; a= level.gameCursor.x - && device.ports[b].x+device.x <= level.gameCursor.x + level.gameCursor.getWidth() - && device.ports[b].y+device.y >= level.gameCursor.y - && device.ports[b].y+device.y <= level.gameCursor.y + level.gameCursor.getHeight()) - if (((LabCursor)level.gameCursor).hot) - device.ports[b].value = true; - } - } - if (device.isNode()) - { - if (device.Function()) - nodeChanged=true; + boolean nodeChanged; + int counter = 0; + do { + nodeChanged = false; + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item.isDevice()) { + Device device = (Device) item; + for (int b = 0; b < device.ports.length; b++) { + Wire wire = device.ports[b].myWire; + if (wire != null) { + if (wire.inPort != null && wire.outPort != null) { + wire.value = wire.outPort.value; + wire.inPort.value = wire.value; + } + } + else if (device.ports[b].type == Port.TYPE_INPUT) { + device.ports[b].value = false; + if (level.gameCursor instanceof LabCursor) { + if (device.room == level.gameCursor.room) { + if (device.ports[b].x + device.x >= level.gameCursor.x + && device.ports[b].x + device.x <= level.gameCursor.x + level.gameCursor.getWidth() + && device.ports[b].y + device.y >= level.gameCursor.y + && device.ports[b].y + device.y <= level.gameCursor.y + level.gameCursor.getHeight()) { + if (((LabCursor) level.gameCursor).hot) { + device.ports[b].value = true; + } + } + } + } + } + } + if (device.isNode()) { + if (device.Function()) { + nodeChanged = true; + } - } - } - } - counter++; - } - while (nodeChanged && counter<1000); + } + } + } + counter++; + } + while (nodeChanged && counter < 1000); - } + } - public void SaveLevel() - { - String temp = level.getClass().toString(); - System.out.println("Class name is " + temp); - String[] path = temp.split("\\."); - for (int a=0; a< path.length; a++) - System.out.println(a + " = " + path[a]); - // String filename = temp.substring(6); - String filename = path[path.length-1]; - SaveLevel(filename+".lvl"); - } + void SaveLevel() { + String temp = level.getClass().toString(); + System.out.println("Class name is " + temp); + String[] path = temp.split("\\."); + for (int a = 0; a < path.length; a++) { + System.out.println(a + " = " + path[a]); + } + // String filename = temp.substring(6); + String filename = path[path.length - 1]; + SaveLevel(filename + ".lvl"); + } - public void SaveLevel(String filename) - { - System.out.println("Saving level " + filename); - try - { - FileOutputStream out = new FileOutputStream(filename); - ObjectOutputStream s = new ObjectOutputStream(out); - level.writeObject(s); - s.flush(); - s.close(); - out.close(); - } - catch (FileNotFoundException e) - { - System.out.println("File Not Found"); - } - catch (IOException e) - { - System.out.println("IO Exception"); - System.out.println(e.getMessage()); - } - } + public void SaveLevel(String filename) { + System.out.println("Saving level " + filename); + try { + FileOutputStream out = new FileOutputStream(filename); + ObjectOutputStream s = new ObjectOutputStream(out); + level.writeObject(s); + s.flush(); + s.close(); + out.close(); + } + catch (FileNotFoundException e) { + System.out.println("File Not Found"); + } + catch (IOException e) { + System.out.println("IO Exception"); + System.out.println(e.getMessage()); + } + } - public void LoadLevel(String filename) - { - timer.stop(); - level.Empty(); - level = new Level(this); - Item.level = level; - Room.level = level; - Material.level = level; + void LoadLevel(String filename) { + timer.stop(); + level.Empty(); + level = new Level(this); + Item.level = level; + Room.level = level; + Material.level = level; - // Add flags for loading Object inventories or running Init() - try - { - FileInputStream in = new FileInputStream(filename); - ObjectInputStream s = new ObjectInputStream(in); - level.readObject(s); - s.close(); - in.close(); - } - catch (FileNotFoundException e) - { - System.out.println("File Not Found"); - return; - } - catch (IOException e) - { - System.out.println("IO Exception"); - System.out.println(e.getMessage()); - e.printStackTrace(); - return; - } + // Add flags for loading Object inventories or running Init() + try { + FileInputStream in = new FileInputStream(filename); + ObjectInputStream s = new ObjectInputStream(in); + level.readObject(s); + s.close(); + in.close(); + } + catch (FileNotFoundException e) { + System.out.println("File Not Found"); + return; + } + catch (IOException e) { + System.out.println("IO Exception"); + System.out.println(e.getMessage()); + e.printStackTrace(); + return; + } - if (level.remote != null) - { - if (level.electricity) - { - level.remote.x = 28; - level.remote.y = -20; - level.remote.carriedBy = level.player; - level.remote.room = level.player.room; - } - else // Electricity is off - { - level.remote.carriedBy = null; - level.remote.room = null; - } - } + if (level.remote != null) { + if (level.electricity) { + level.remote.x = 28; + level.remote.y = -20; + level.remote.carriedBy = level.player; + level.remote.room = level.player.room; + } + else // Electricity is off + { + level.remote.carriedBy = null; + level.remote.room = null; + } + } - timer.start(); - } + timer.start(); + } } diff --git a/src/com/droidquest/SoundClip.java b/src/com/droidquest/SoundClip.java index 9fe9be6..fd84608 100644 --- a/src/com/droidquest/SoundClip.java +++ b/src/com/droidquest/SoundClip.java @@ -5,24 +5,20 @@ import java.applet.AudioClip; import java.net.MalformedURLException; import java.net.URL; -public class SoundClip -{ -public AudioClip audioClip; -public String filename; +public class SoundClip { + public AudioClip audioClip; + private String filename; -public SoundClip(String f) - { - filename = f; - try - { - URL baseURL = new URL("file:" + System.getProperty("user.dir") + "/sounds/"); - URL soundURL; - soundURL = new URL(baseURL, filename); - audioClip = Applet.newAudioClip(soundURL); - } - catch (MalformedURLException e) - { - System.err.println(e.getMessage()); - } - } + public SoundClip(String f) { + filename = f; + try { + URL baseURL = new URL("file:" + System.getProperty("user.dir") + "/sounds/"); + URL soundURL; + soundURL = new URL(baseURL, filename); + audioClip = Applet.newAudioClip(soundURL); + } + catch (MalformedURLException e) { + System.err.println(e.getMessage()); + } + } } diff --git a/src/com/droidquest/Wire.java b/src/com/droidquest/Wire.java index e2f3dc9..0c0e1a6 100644 --- a/src/com/droidquest/Wire.java +++ b/src/com/droidquest/Wire.java @@ -1,439 +1,402 @@ package com.droidquest; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; - import com.droidquest.chipstuff.Port; import com.droidquest.devices.Device; import com.droidquest.levels.Level; -public class Wire implements Serializable -{ -public transient Port fromPort; // Connected First -public transient Port toPort; // Connected 2nd -public transient Port inPort; // Connected to Input -public transient Port outPort; // Connected to Output (Source of Value) -public boolean value; +import java.awt.*; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; -public Wire() {} +public class Wire implements Serializable { + public transient Port fromPort; // Connected First + public transient Port toPort; // Connected 2nd + public transient Port inPort; // Connected to Input + public transient Port outPort; // Connected to Output (Source of Value) + public boolean value; -public Wire(Port f, Port t) - { - if (f.myDevice!=null) - { - if (f.myDevice.room!=null) - { - if (f.myDevice.room.wires==null) - System.out.println("f.myDevice.room.wires is null"); - } - else - System.out.println("f.myDevice.room is null"); - } - else - System.out.println("f.myDevice is null"); - - f.myDevice.room.wires.addElement(this); - f.myDevice.level.PlaySound(f.myDevice.room, Level.ATTACHSOUND); - - if (f.type == Port.TYPE_INPUT) - { - if (t.type == Port.TYPE_INPUT) - { - Remove(); - return; - } - if (t.type == Port.TYPE_OUTPUT) - { - fromPort = f; - toPort=t; - f.myWire = this; - t.myWire = this; - inPort = fromPort; - outPort = toPort; - return; - } - if (t.type == Port.TYPE_UNDEFINED) - { - fromPort = f; - toPort=t; - f.myWire = this; - t.myWire = this; - inPort = fromPort; - outPort = toPort; - t.type = Port.TYPE_OUTPUT; - return; - } - } - if (f.type == Port.TYPE_OUTPUT) - { - if (t.type == Port.TYPE_INPUT) - { - fromPort = f; - toPort=t; - f.myWire = this; - t.myWire = this; - outPort = fromPort; - inPort = toPort; - return; - } - if (t.type == Port.TYPE_OUTPUT) - { - Remove(); - return; - } - if (t.type == Port.TYPE_UNDEFINED) - { - fromPort = f; - toPort=t; - f.myWire = this; - t.myWire = this; - outPort = fromPort; - inPort = toPort; - t.type = Port.TYPE_INPUT; - return; - } - } - if (f.type == Port.TYPE_UNDEFINED) - { - if (t.type == Port.TYPE_INPUT) - { - fromPort = f; - toPort=t; - f.myWire = this; - t.myWire = this; - outPort = fromPort; - inPort = toPort; - f.type = Port.TYPE_OUTPUT; - return; - } - if (t.type == Port.TYPE_OUTPUT) - { - fromPort = f; - toPort=t; - f.myWire = this; - t.myWire = this; - inPort = fromPort; - outPort = toPort; - f.type = Port.TYPE_INPUT; - return; - } - if (t.type == Port.TYPE_UNDEFINED) - { - fromPort = f; - toPort=t; - f.myWire = this; - t.myWire = this; - return; - } - } - } + public Wire() { + } -protected void writeRef(ObjectOutputStream s) throws IOException - { - Level level = fromPort.myDevice.level; - int a; - - s.writeInt(level.items.indexOf(fromPort.myDevice)); // Index of fromport device - a=0; while (((Device)fromPort.myDevice).ports[a] != fromPort) a++; - s.writeInt(a); // Index of fromport (as device.ports[?] + public Wire(Port f, Port t) { + if (f.myDevice != null) { + if (f.myDevice.room != null) { + if (f.myDevice.room.wires == null) { + System.out.println("f.myDevice.room.wires is null"); + } + } + else { + System.out.println("f.myDevice.room is null"); + } + } + else { + System.out.println("f.myDevice is null"); + } - s.writeInt(level.items.indexOf(toPort.myDevice)); // Index of toPort device - a=0; while (((Device)toPort.myDevice).ports[a] != toPort) a++; - s.writeInt(a); // Index of toPort (as device.ports[?] - - s.writeInt(level.items.indexOf(inPort.myDevice)); // Index of inPort device - a=0; while (((Device)inPort.myDevice).ports[a] != inPort) a++; - s.writeInt(a); // Index of inPort (as device.ports[?] - - s.writeInt(level.items.indexOf(outPort.myDevice)); // Index of outPort device - a=0; while (((Device)outPort.myDevice).ports[a] != outPort) a++; - s.writeInt(a); // Index of outPort (as device.ports[?] - } + f.myDevice.room.wires.addElement(this); + f.myDevice.level.PlaySound(f.myDevice.room, Level.ATTACHSOUND); -protected void readRef(ObjectInputStream s, Level level) throws IOException - { - Device tempDevice; - tempDevice = (Device) level.FindItem(s.readInt()); - fromPort = tempDevice.ports[s.readInt()]; - tempDevice = (Device) level.FindItem(s.readInt()); - toPort = tempDevice.ports[s.readInt()]; - tempDevice = (Device) level.FindItem(s.readInt()); - inPort = tempDevice.ports[s.readInt()]; - tempDevice = (Device) level.FindItem(s.readInt()); - outPort = tempDevice.ports[s.readInt()]; - } + if (f.type == Port.TYPE_INPUT) { + if (t.type == Port.TYPE_INPUT) { + Remove(); + return; + } + if (t.type == Port.TYPE_OUTPUT) { + fromPort = f; + toPort = t; + f.myWire = this; + t.myWire = this; + inPort = fromPort; + outPort = toPort; + return; + } + if (t.type == Port.TYPE_UNDEFINED) { + fromPort = f; + toPort = t; + f.myWire = this; + t.myWire = this; + inPort = fromPort; + outPort = toPort; + t.type = Port.TYPE_OUTPUT; + return; + } + } + if (f.type == Port.TYPE_OUTPUT) { + if (t.type == Port.TYPE_INPUT) { + fromPort = f; + toPort = t; + f.myWire = this; + t.myWire = this; + outPort = fromPort; + inPort = toPort; + return; + } + if (t.type == Port.TYPE_OUTPUT) { + Remove(); + return; + } + if (t.type == Port.TYPE_UNDEFINED) { + fromPort = f; + toPort = t; + f.myWire = this; + t.myWire = this; + outPort = fromPort; + inPort = toPort; + t.type = Port.TYPE_INPUT; + return; + } + } + if (f.type == Port.TYPE_UNDEFINED) { + if (t.type == Port.TYPE_INPUT) { + fromPort = f; + toPort = t; + f.myWire = this; + t.myWire = this; + outPort = fromPort; + inPort = toPort; + f.type = Port.TYPE_OUTPUT; + return; + } + if (t.type == Port.TYPE_OUTPUT) { + fromPort = f; + toPort = t; + f.myWire = this; + t.myWire = this; + inPort = fromPort; + outPort = toPort; + f.type = Port.TYPE_INPUT; + return; + } + if (t.type == Port.TYPE_UNDEFINED) { + fromPort = f; + toPort = t; + f.myWire = this; + t.myWire = this; + } + } + } -public void ConnectTo(Port t) - { - fromPort.myDevice.level.PlaySound(fromPort.myDevice.room, Level.DETATCHSOUND); + void writeRef(ObjectOutputStream s) throws IOException { + Level level = fromPort.myDevice.level; + int a; - if (toPort.myDevice == toPort.myDevice.level.solderingPen) - { - toPort.value = false; - toPort.type = Port.TYPE_UNDEFINED; - toPort.myWire = null; - - if (fromPort.type == Port.TYPE_INPUT) - { - if (t.type == Port.TYPE_INPUT) - { - Remove(); - return; - } - if (t.type == Port.TYPE_OUTPUT) - { - toPort=t; - t.myWire = this; - inPort = fromPort; - outPort = toPort; - return; - } - if (t.type == Port.TYPE_UNDEFINED) - { - toPort=t; - t.myWire = this; - inPort = fromPort; - outPort = toPort; - t.type = Port.TYPE_OUTPUT; - return; - } - } - if (fromPort.type == Port.TYPE_OUTPUT) - { - if (t.type == Port.TYPE_INPUT) - { - toPort=t; - t.myWire = this; - outPort = fromPort; - inPort = toPort; - return; - } - if (t.type == Port.TYPE_OUTPUT) - { - Remove(); - return; - } - if (t.type == Port.TYPE_UNDEFINED) - { - toPort=t; - t.myWire = this; - outPort = fromPort; - inPort = toPort; - t.type = Port.TYPE_INPUT; - return; - } - } - if (fromPort.type == Port.TYPE_UNDEFINED) - { - if (t.type == Port.TYPE_INPUT) - { - toPort=t; - t.myWire = this; - outPort = fromPort; - inPort = toPort; - fromPort.type = Port.TYPE_OUTPUT; - return; - } - if (t.type == Port.TYPE_OUTPUT) - { - toPort=t; - t.myWire = this; - inPort = fromPort; - outPort = toPort; - fromPort.type = Port.TYPE_INPUT; - return; - } - if (t.type == Port.TYPE_UNDEFINED) - { - toPort=t; - t.myWire = this; - return; - } - } - } - else - { - fromPort.value = false; - fromPort.type = Port.TYPE_UNDEFINED; - fromPort.myWire = null; - - if (toPort.type == Port.TYPE_INPUT) - { - if (t.type == Port.TYPE_INPUT) - { - Remove(); - return; - } - if (t.type == Port.TYPE_OUTPUT) - { - fromPort=t; - t.myWire = this; - inPort = toPort; - outPort = fromPort; - return; - } - if (t.type == Port.TYPE_UNDEFINED) - { - fromPort=t; - t.myWire = this; - inPort = toPort; - outPort = fromPort; - t.type = Port.TYPE_OUTPUT; - return; - } - } - if (toPort.type == Port.TYPE_OUTPUT) - { - if (t.type == Port.TYPE_INPUT) - { - fromPort=t; - t.myWire = this; - outPort = toPort; - inPort = fromPort; - return; - } - if (t.type == Port.TYPE_OUTPUT) - { - Remove(); - return; - } - if (t.type == Port.TYPE_UNDEFINED) - { - fromPort=t; - t.myWire = this; - outPort = toPort; - inPort = fromPort; - t.type = Port.TYPE_INPUT; - return; - } - } - if (toPort.type == Port.TYPE_UNDEFINED) - { - if (t.type == Port.TYPE_INPUT) - { - fromPort=t; - t.myWire = this; - outPort = toPort; - inPort = fromPort; - toPort.type = Port.TYPE_OUTPUT; - return; - } - if (t.type == Port.TYPE_OUTPUT) - { - fromPort=t; - t.myWire = this; - inPort = toPort; - outPort = fromPort; - toPort.type = Port.TYPE_INPUT; - return; - } - if (t.type == Port.TYPE_UNDEFINED) - { - fromPort=t; - t.myWire = this; - return; - } - } - } + s.writeInt(level.items.indexOf(fromPort.myDevice)); // Index of fromport device + a = 0; + while (((Device) fromPort.myDevice).ports[a] != fromPort) { + a++; + } + s.writeInt(a); // Index of fromport (as device.ports[?] - } + s.writeInt(level.items.indexOf(toPort.myDevice)); // Index of toPort device + a = 0; + while (((Device) toPort.myDevice).ports[a] != toPort) { + a++; + } + s.writeInt(a); // Index of toPort (as device.ports[?] -public void Remove() - { - Room room = fromPort.myDevice.room; - - room.level.PlaySound(room, Level.DETATCHSOUND); - - fromPort.myWire = null; - toPort.myWire = null; - fromPort = null; - toPort = null; - inPort = null; - outPort = null; - room.wires.removeElement(this); - - } + s.writeInt(level.items.indexOf(inPort.myDevice)); // Index of inPort device + a = 0; + while (((Device) inPort.myDevice).ports[a] != inPort) { + a++; + } + s.writeInt(a); // Index of inPort (as device.ports[?] -public void Draw(Graphics g) - { - g.setColor(Color.white); - value = false; - if (fromPort.type == Port.TYPE_OUTPUT && fromPort.value) - { - g.setColor(new Color(255,128,0)); - value = true; - } - if (toPort.type == Port.TYPE_OUTPUT && toPort.value) - { - g.setColor(new Color(255,128,0)); - value = true; - } - - Dimension d1, d2; - int x1, y1, x2, y2; - d1 = fromPort.myDevice.GetXY(); - d2 = toPort.myDevice.GetXY(); - x1 = d1.width + fromPort.x; - y1 = d1.height + fromPort.y; - x2 = d2.width + toPort.x; - y2 = d2.height + toPort.y; - switch((((Device)fromPort.myDevice).rotation + fromPort.rotation)%4) - { - case 0: // Up - x1 += 1; - y1 += 1; - break; - case 1: // Right - x1 -= 2; - y1 += 1; - break; - case 2: // Down - x1 -= 2; - y1 -= 2; - break; - case 3: // Left - x1 += 1; - y1 -= 2; - break; - } - switch((((Device)toPort.myDevice).rotation + toPort.rotation)%4) - { - case 0: // Up - x2 += 1; - y2 += 1; - break; - case 1: // Right - x2 -= 2; - y2 += 1; - break; - case 2: // Down - x2 -= 2; - y2 -= 2; - break; - case 3: // Left - x2 += 1; - y2 -= 2; - break; - } - - g.fillRect(Math.min(x1,x2),y1,Math.abs(x1-x2),2); - g.fillRect(x2,Math.min(y1,y2),2,Math.abs(y1-y2)); - g.fillRect(x1,y1,2,2); - g.fillRect(x2,y2,2,2); - g.fillRect(x2,y1,2,2); - - } + s.writeInt(level.items.indexOf(outPort.myDevice)); // Index of outPort device + a = 0; + while (((Device) outPort.myDevice).ports[a] != outPort) { + a++; + } + s.writeInt(a); // Index of outPort (as device.ports[?] + } -public Port otherPort(Port p) - { - if (fromPort == p) return toPort; - if (toPort == p) return fromPort; - return null; - } + void readRef(ObjectInputStream s, Level level) throws IOException { + Device tempDevice; + tempDevice = (Device) level.FindItem(s.readInt()); + fromPort = tempDevice.ports[s.readInt()]; + tempDevice = (Device) level.FindItem(s.readInt()); + toPort = tempDevice.ports[s.readInt()]; + tempDevice = (Device) level.FindItem(s.readInt()); + inPort = tempDevice.ports[s.readInt()]; + tempDevice = (Device) level.FindItem(s.readInt()); + outPort = tempDevice.ports[s.readInt()]; + } + + public void ConnectTo(Port t) { + fromPort.myDevice.level.PlaySound(fromPort.myDevice.room, Level.DETATCHSOUND); + + if (toPort.myDevice == toPort.myDevice.level.solderingPen) { + toPort.value = false; + toPort.type = Port.TYPE_UNDEFINED; + toPort.myWire = null; + + if (fromPort.type == Port.TYPE_INPUT) { + if (t.type == Port.TYPE_INPUT) { + Remove(); + return; + } + if (t.type == Port.TYPE_OUTPUT) { + toPort = t; + t.myWire = this; + inPort = fromPort; + outPort = toPort; + return; + } + if (t.type == Port.TYPE_UNDEFINED) { + toPort = t; + t.myWire = this; + inPort = fromPort; + outPort = toPort; + t.type = Port.TYPE_OUTPUT; + return; + } + } + if (fromPort.type == Port.TYPE_OUTPUT) { + if (t.type == Port.TYPE_INPUT) { + toPort = t; + t.myWire = this; + outPort = fromPort; + inPort = toPort; + return; + } + if (t.type == Port.TYPE_OUTPUT) { + Remove(); + return; + } + if (t.type == Port.TYPE_UNDEFINED) { + toPort = t; + t.myWire = this; + outPort = fromPort; + inPort = toPort; + t.type = Port.TYPE_INPUT; + return; + } + } + if (fromPort.type == Port.TYPE_UNDEFINED) { + if (t.type == Port.TYPE_INPUT) { + toPort = t; + t.myWire = this; + outPort = fromPort; + inPort = toPort; + fromPort.type = Port.TYPE_OUTPUT; + return; + } + if (t.type == Port.TYPE_OUTPUT) { + toPort = t; + t.myWire = this; + inPort = fromPort; + outPort = toPort; + fromPort.type = Port.TYPE_INPUT; + return; + } + if (t.type == Port.TYPE_UNDEFINED) { + toPort = t; + t.myWire = this; + } + } + } + else { + fromPort.value = false; + fromPort.type = Port.TYPE_UNDEFINED; + fromPort.myWire = null; + + if (toPort.type == Port.TYPE_INPUT) { + if (t.type == Port.TYPE_INPUT) { + Remove(); + return; + } + if (t.type == Port.TYPE_OUTPUT) { + fromPort = t; + t.myWire = this; + inPort = toPort; + outPort = fromPort; + return; + } + if (t.type == Port.TYPE_UNDEFINED) { + fromPort = t; + t.myWire = this; + inPort = toPort; + outPort = fromPort; + t.type = Port.TYPE_OUTPUT; + return; + } + } + if (toPort.type == Port.TYPE_OUTPUT) { + if (t.type == Port.TYPE_INPUT) { + fromPort = t; + t.myWire = this; + outPort = toPort; + inPort = fromPort; + return; + } + if (t.type == Port.TYPE_OUTPUT) { + Remove(); + return; + } + if (t.type == Port.TYPE_UNDEFINED) { + fromPort = t; + t.myWire = this; + outPort = toPort; + inPort = fromPort; + t.type = Port.TYPE_INPUT; + return; + } + } + if (toPort.type == Port.TYPE_UNDEFINED) { + if (t.type == Port.TYPE_INPUT) { + fromPort = t; + t.myWire = this; + outPort = toPort; + inPort = fromPort; + toPort.type = Port.TYPE_OUTPUT; + return; + } + if (t.type == Port.TYPE_OUTPUT) { + fromPort = t; + t.myWire = this; + inPort = toPort; + outPort = fromPort; + toPort.type = Port.TYPE_INPUT; + return; + } + if (t.type == Port.TYPE_UNDEFINED) { + fromPort = t; + t.myWire = this; + } + } + } + + } + + public void Remove() { + Room room = fromPort.myDevice.room; + + room.level.PlaySound(room, Level.DETATCHSOUND); + + fromPort.myWire = null; + toPort.myWire = null; + fromPort = null; + toPort = null; + inPort = null; + outPort = null; + room.wires.removeElement(this); + + } + + public void Draw(Graphics g) { + g.setColor(Color.white); + value = false; + if (fromPort.type == Port.TYPE_OUTPUT && fromPort.value) { + g.setColor(new Color(255, 128, 0)); + value = true; + } + if (toPort.type == Port.TYPE_OUTPUT && toPort.value) { + g.setColor(new Color(255, 128, 0)); + value = true; + } + + Dimension d1, d2; + int x1, y1, x2, y2; + d1 = fromPort.myDevice.GetXY(); + d2 = toPort.myDevice.GetXY(); + x1 = d1.width + fromPort.x; + y1 = d1.height + fromPort.y; + x2 = d2.width + toPort.x; + y2 = d2.height + toPort.y; + switch ((((Device) fromPort.myDevice).rotation + fromPort.rotation) % 4) { + case 0: // Up + x1 += 1; + y1 += 1; + break; + case 1: // Right + x1 -= 2; + y1 += 1; + break; + case 2: // Down + x1 -= 2; + y1 -= 2; + break; + case 3: // Left + x1 += 1; + y1 -= 2; + break; + } + switch ((((Device) toPort.myDevice).rotation + toPort.rotation) % 4) { + case 0: // Up + x2 += 1; + y2 += 1; + break; + case 1: // Right + x2 -= 2; + y2 += 1; + break; + case 2: // Down + x2 -= 2; + y2 -= 2; + break; + case 3: // Left + x2 += 1; + y2 -= 2; + break; + } + + g.fillRect(Math.min(x1, x2), y1, Math.abs(x1 - x2), 2); + g.fillRect(x2, Math.min(y1, y2), 2, Math.abs(y1 - y2)); + g.fillRect(x1, y1, 2, 2); + g.fillRect(x2, y2, 2, 2); + g.fillRect(x2, y1, 2, 2); + + } + + public Port otherPort(Port p) { + if (fromPort == p) { + return toPort; + } + if (toPort == p) { + return fromPort; + } + return null; + } } \ No newline at end of file diff --git a/src/com/droidquest/avatars/GameCursor.java b/src/com/droidquest/avatars/GameCursor.java index 8f3661c..d2e5225 100644 --- a/src/com/droidquest/avatars/GameCursor.java +++ b/src/com/droidquest/avatars/GameCursor.java @@ -1,15 +1,5 @@ package com.droidquest.avatars; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FileDialog; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.event.KeyEvent; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.devices.Device; @@ -18,756 +8,751 @@ import com.droidquest.devices.SmallChip; import com.droidquest.items.GenericRobot; import com.droidquest.items.Item; import com.droidquest.items.ToolBox; +import com.droidquest.items.Train; -public class GameCursor extends Item -{ - private int walk = 0; // 0 or 1, used in animation - public boolean outline; // Draw outline around GameCursor? +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.image.BufferedImage; - public GameCursor(){} +public class GameCursor extends Item { + private int walk = 0; // 0 or 1, used in animation + private boolean outline; // Draw outline around GameCursor? - public GameCursor(int X, int Y, Room r) - { - x=X; y=Y; - outline=false; - room=r; - width=28; height=32; - GenerateIcons(); - } + public GameCursor() { + } - public void GenerateIcons() - { - // Executed once during initialization - icons = new ImageIcon[8]; - icons[0]= new ImageIcon(new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR)); - icons[2]= new ImageIcon(new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR)); - icons[3]= new ImageIcon(new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR)); - icons[4]= new ImageIcon(new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR)); - icons[5]= new ImageIcon(new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR)); - icons[6]= new ImageIcon(new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR)); - icons[7]= new ImageIcon(new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - Graphics2D g2; - Color transparent = new Color(0,0,0,0); + public GameCursor(int X, int Y, Room r) { + x = X; + y = Y; + outline = false; + room = r; + width = 28; + height = 32; + GenerateIcons(); + } - // 0 = up, left leg up - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to GameCursor Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,28,32); - g.setColor(Color.white); - g.fillRect(8,0,12,8); - g.fillRect(4,2,20,4); - g.fillRect(12,8,4,2); - g.fillRect(4,10,20,2); - g.fillRect(8,10,12,14); - g.fillRect(0,12,4,8); - g.fillRect(24,12,4,6); - g.fillRect(4,22,8,8); - g.fillRect(16,20,8,12); - g.setColor(Color.black); - g.fillRect(8,18,12,2); - g.fillRect(4,26,8,2); - g.fillRect(16,28,8,2); + public void GenerateIcons() { + // Executed once during initialization + icons = new ImageIcon[8]; + icons[0] = new ImageIcon(new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR)); + icons[2] = new ImageIcon(new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR)); + icons[3] = new ImageIcon(new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR)); + icons[4] = new ImageIcon(new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR)); + icons[5] = new ImageIcon(new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR)); + icons[6] = new ImageIcon(new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR)); + icons[7] = new ImageIcon(new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + Graphics2D g2; + Color transparent = new Color(0, 0, 0, 0); - // 1 = up, right leg up - try - { - g = icons[1].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to GameCursor Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,28,32); - g.setColor(Color.white); - g.fillRect(8,0,12,8); - g.fillRect(4,2,20,4); - g.fillRect(12,8,4,2); - g.fillRect(4,10,20,2); - g.fillRect(8,10,12,14); - g.fillRect(0,12,4,6); - g.fillRect(24,12,4,8); - g.fillRect(4,20,8,12); - g.fillRect(16,22,8,8); - g.setColor(Color.black); - g.fillRect(8,18,12,2); - g.fillRect(4,28,8,2); - g.fillRect(16,26,8,2); + // 0 = up, left leg up + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to GameCursor Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, 28, 32); + g.setColor(Color.white); + g.fillRect(8, 0, 12, 8); + g.fillRect(4, 2, 20, 4); + g.fillRect(12, 8, 4, 2); + g.fillRect(4, 10, 20, 2); + g.fillRect(8, 10, 12, 14); + g.fillRect(0, 12, 4, 8); + g.fillRect(24, 12, 4, 6); + g.fillRect(4, 22, 8, 8); + g.fillRect(16, 20, 8, 12); + g.setColor(Color.black); + g.fillRect(8, 18, 12, 2); + g.fillRect(4, 26, 8, 2); + g.fillRect(16, 28, 8, 2); - // 2 = down, left(side) leg up - try - { - g = icons[2].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to GameCursor Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,28,32); - g.setColor(Color.white); - g.fillRect(8,0,12,8); - g.fillRect(4,2,20,4); - g.fillRect(12,8,4,2); - g.fillRect(4,10,20,2); - g.fillRect(8,10,12,14); - g.fillRect(0,12,4,8); - g.fillRect(24,12,4,6); - g.fillRect(4,22,8,8); - g.fillRect(16,20,8,12); - g.setColor(Color.black); - g.fillRect(8,2,4,2); - g.fillRect(16,2,4,2); - g.fillRect(12,4,4,2); - g.fillRect(8,18,12,2); - g.fillRect(4,26,8,2); - g.fillRect(16,28,8,2); + // 1 = up, right leg up + try { + g = icons[1].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to GameCursor Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, 28, 32); + g.setColor(Color.white); + g.fillRect(8, 0, 12, 8); + g.fillRect(4, 2, 20, 4); + g.fillRect(12, 8, 4, 2); + g.fillRect(4, 10, 20, 2); + g.fillRect(8, 10, 12, 14); + g.fillRect(0, 12, 4, 6); + g.fillRect(24, 12, 4, 8); + g.fillRect(4, 20, 8, 12); + g.fillRect(16, 22, 8, 8); + g.setColor(Color.black); + g.fillRect(8, 18, 12, 2); + g.fillRect(4, 28, 8, 2); + g.fillRect(16, 26, 8, 2); - // 3 = down, right(side) leg up - try - { - g = icons[3].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to GameCursor Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,28,32); - g.setColor(Color.white); - g.fillRect(8,0,12,8); - g.fillRect(4,2,20,4); - g.fillRect(12,8,4,2); - g.fillRect(4,10,20,2); - g.fillRect(8,10,12,14); - g.fillRect(0,12,4,6); - g.fillRect(24,12,4,8); - g.fillRect(4,20,8,12); - g.fillRect(16,22,8,8); - g.setColor(Color.black); - g.fillRect(8,2,4,2); - g.fillRect(16,2,4,2); - g.fillRect(12,4,4,2); - g.fillRect(8,18,12,2); - g.fillRect(4,28,8,2); - g.fillRect(16,26,8,2); + // 2 = down, left(side) leg up + try { + g = icons[2].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to GameCursor Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, 28, 32); + g.setColor(Color.white); + g.fillRect(8, 0, 12, 8); + g.fillRect(4, 2, 20, 4); + g.fillRect(12, 8, 4, 2); + g.fillRect(4, 10, 20, 2); + g.fillRect(8, 10, 12, 14); + g.fillRect(0, 12, 4, 8); + g.fillRect(24, 12, 4, 6); + g.fillRect(4, 22, 8, 8); + g.fillRect(16, 20, 8, 12); + g.setColor(Color.black); + g.fillRect(8, 2, 4, 2); + g.fillRect(16, 2, 4, 2); + g.fillRect(12, 4, 4, 2); + g.fillRect(8, 18, 12, 2); + g.fillRect(4, 26, 8, 2); + g.fillRect(16, 28, 8, 2); - // 4 = left, Stand - try - { - g = icons[4].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to GameCursor Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,28,32); - g.setColor(Color.white); - g.fillRect(8,0,12,8); - g.fillRect(20,2,4,4); - g.fillRect(4,4,4,2); - g.fillRect(12,8,4,2); - g.fillRect(12,10,8,18); - g.fillRect(8,12,4,12); - g.fillRect(8,30,12,2); - g.setColor(Color.black); - g.fillRect(12,2,4,2); - g.fillRect(8,18,12,2); - g.fillRect(12,28,8,2); + // 3 = down, right(side) leg up + try { + g = icons[3].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to GameCursor Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, 28, 32); + g.setColor(Color.white); + g.fillRect(8, 0, 12, 8); + g.fillRect(4, 2, 20, 4); + g.fillRect(12, 8, 4, 2); + g.fillRect(4, 10, 20, 2); + g.fillRect(8, 10, 12, 14); + g.fillRect(0, 12, 4, 6); + g.fillRect(24, 12, 4, 8); + g.fillRect(4, 20, 8, 12); + g.fillRect(16, 22, 8, 8); + g.setColor(Color.black); + g.fillRect(8, 2, 4, 2); + g.fillRect(16, 2, 4, 2); + g.fillRect(12, 4, 4, 2); + g.fillRect(8, 18, 12, 2); + g.fillRect(4, 28, 8, 2); + g.fillRect(16, 26, 8, 2); - // 5 = left, walk - try - { - g = icons[5].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to GameCursor Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,28,32); - g.setColor(Color.white); - g.fillRect(8,0,12,8); - g.fillRect(20,2,4,4); - g.fillRect(4,4,4,2); - g.fillRect(12,8,4,2); - g.fillRect(8,10,12,14); - g.fillRect(4,12,20,4); - g.fillRect(0,14,4,4); - g.fillRect(24,14,4,6); - g.fillRect(4,24,8,8); - g.fillRect(16,22,8,10); - g.fillRect(0,30,4,2); - g.setColor(Color.black); - g.fillRect(12,2,4,2); - g.fillRect(16,14,4,2); - g.fillRect(8,18,12,2); - g.fillRect(4,28,8,2); - g.fillRect(16,28,8,2); + // 4 = left, Stand + try { + g = icons[4].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to GameCursor Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, 28, 32); + g.setColor(Color.white); + g.fillRect(8, 0, 12, 8); + g.fillRect(20, 2, 4, 4); + g.fillRect(4, 4, 4, 2); + g.fillRect(12, 8, 4, 2); + g.fillRect(12, 10, 8, 18); + g.fillRect(8, 12, 4, 12); + g.fillRect(8, 30, 12, 2); + g.setColor(Color.black); + g.fillRect(12, 2, 4, 2); + g.fillRect(8, 18, 12, 2); + g.fillRect(12, 28, 8, 2); - // 6 = right, Stand - try - { - g = icons[6].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to GameCursor Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,28,32); - g.setColor(Color.white); - g.fillRect(8,0,12,8); - g.fillRect(4,2,4,4); - g.fillRect(20,4,4,2); - g.fillRect(12,8,4,2); - g.fillRect(8,10,8,18); - g.fillRect(16,12,4,12); - g.fillRect(8,30,12,2); - g.setColor(Color.black); - g.fillRect(12,2,4,2); - g.fillRect(8,18,12,2); - g.fillRect(8,28,8,2); + // 5 = left, walk + try { + g = icons[5].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to GameCursor Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, 28, 32); + g.setColor(Color.white); + g.fillRect(8, 0, 12, 8); + g.fillRect(20, 2, 4, 4); + g.fillRect(4, 4, 4, 2); + g.fillRect(12, 8, 4, 2); + g.fillRect(8, 10, 12, 14); + g.fillRect(4, 12, 20, 4); + g.fillRect(0, 14, 4, 4); + g.fillRect(24, 14, 4, 6); + g.fillRect(4, 24, 8, 8); + g.fillRect(16, 22, 8, 10); + g.fillRect(0, 30, 4, 2); + g.setColor(Color.black); + g.fillRect(12, 2, 4, 2); + g.fillRect(16, 14, 4, 2); + g.fillRect(8, 18, 12, 2); + g.fillRect(4, 28, 8, 2); + g.fillRect(16, 28, 8, 2); - // 7 = right, walk - try - { - g = icons[7].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to GameCursor Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,28,32); - g.setColor(Color.white); - g.fillRect(8,0,12,8); - g.fillRect(4,2,4,4); - g.fillRect(20,4,4,2); - g.fillRect(12,8,4,2); - g.fillRect(8,10,12,14); - g.fillRect(4,12,20,4); - g.fillRect(0,14,4,6); - g.fillRect(24,14,4,4); - g.fillRect(4,22,8,10); - g.fillRect(16,24,8,8); - g.fillRect(24,30,4,2); - g.setColor(Color.black); - g.fillRect(12,2,4,2); - g.fillRect(8,14,4,2); - g.fillRect(8,18,12,2); - g.fillRect(4,28,8,2); - g.fillRect(16,28,8,2); - currentIcon = icons[6].getImage(); + // 6 = right, Stand + try { + g = icons[6].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to GameCursor Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, 28, 32); + g.setColor(Color.white); + g.fillRect(8, 0, 12, 8); + g.fillRect(4, 2, 4, 4); + g.fillRect(20, 4, 4, 2); + g.fillRect(12, 8, 4, 2); + g.fillRect(8, 10, 8, 18); + g.fillRect(16, 12, 4, 12); + g.fillRect(8, 30, 12, 2); + g.setColor(Color.black); + g.fillRect(12, 2, 4, 2); + g.fillRect(8, 18, 12, 2); + g.fillRect(8, 28, 8, 2); - } + // 7 = right, walk + try { + g = icons[7].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to GameCursor Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, 28, 32); + g.setColor(Color.white); + g.fillRect(8, 0, 12, 8); + g.fillRect(4, 2, 4, 4); + g.fillRect(20, 4, 4, 2); + g.fillRect(12, 8, 4, 2); + g.fillRect(8, 10, 12, 14); + g.fillRect(4, 12, 20, 4); + g.fillRect(0, 14, 4, 6); + g.fillRect(24, 14, 4, 4); + g.fillRect(4, 22, 8, 10); + g.fillRect(16, 24, 8, 8); + g.fillRect(24, 30, 4, 2); + g.setColor(Color.black); + g.fillRect(12, 2, 4, 2); + g.fillRect(8, 14, 4, 2); + g.fillRect(8, 18, 12, 2); + g.fillRect(4, 28, 8, 2); + g.fillRect(16, 28, 8, 2); + currentIcon = icons[6].getImage(); - public void MoveUp(boolean nudge) - { - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - if (item.UpEnterOverlap(this)) - { - int newX = 280; // 10 * 28 - int newY = 320; // 10 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - super.MoveUp( nudge); - walk = 1-walk; - currentIcon = icons[0+walk].getImage(); - } + } - public void MoveDown(boolean nudge) - { - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - if (item.DownEnterOverlap(this)) - { - int newX = 280; // 10 * 28 - int newY = 0; // 0 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - super.MoveDown( nudge); - walk = 1-walk; - currentIcon = icons[2+walk].getImage(); - } + public void MoveUp(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.UpEnterOverlap(this)) { + int newX = 280; // 10 * 28 + int newY = 320; // 10 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveUp(nudge); + walk = 1 - walk; + currentIcon = icons[0 + walk].getImage(); + } - public void MoveLeft(boolean nudge) - { - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - if (item.LeftEnterOverlap(this)) - { - int newX = 532; // 19 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - super.MoveLeft( nudge); - walk = 1-walk; - currentIcon = icons[4+walk].getImage(); - } + public void MoveDown(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.DownEnterOverlap(this)) { + int newX = 280; // 10 * 28 + int newY = 0; // 0 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveDown(nudge); + walk = 1 - walk; + currentIcon = icons[2 + walk].getImage(); + } - public void MoveRight(boolean nudge) - { - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - { - if (item.RightEnterOverlap(this)) - { - int newX = 0; // 0 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - } - super.MoveRight( nudge); - walk = 1-walk; - currentIcon = icons[6+walk].getImage(); - } + public void MoveLeft(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.LeftEnterOverlap(this)) { + int newX = 532; // 19 * 28 + int newY = 176; // 5.5 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveLeft(nudge); + walk = 1 - walk; + currentIcon = icons[4 + walk].getImage(); + } - public void Draw(Graphics g, RoomDisplay rd) - { - g.drawImage(currentIcon, x, y, rd); - if (outline) - { - g.setColor(Color.white); - g.drawRect(x,y,28,32); - } - } + public void MoveRight(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.RightEnterOverlap(this)) { + int newX = 0; // 0 * 28 + int newY = 176; // 5.5 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveRight(nudge); + walk = 1 - walk; + currentIcon = icons[6 + walk].getImage(); + } - public boolean CanBePickedUp(Item i) - { - if (i.getClass().toString().endsWith("Robot")) - return false; - return true; - } + public void Draw(Graphics g, RoomDisplay rd) { + g.drawImage(currentIcon, x, y, rd); + if (outline) { + g.setColor(Color.white); + g.drawRect(x, y, 28, 32); + } + } - public boolean KeyUp(KeyEvent e) - { - if (e.getKeyCode() == e.VK_L) - { - if (carrying != null) - if (carrying.getClass().toString().endsWith("SmallChip")) - { - FileDialog fd = new FileDialog(level.roomdisplay.dq,"Load Chip", FileDialog.LOAD); - fd.setDirectory("chips"); - fd.show(); - System.out.println("Dialog returned with " - + fd.getDirectory() - + fd.getFile()); - if (fd.getFile() != null) - { - ((SmallChip)carrying).Empty(); - ((SmallChip)carrying).LoadChip(fd.getDirectory()+fd.getFile()); - } - } - } - if (e.getKeyCode() == e.VK_S) - { - if (level.solderingPen == null) return false; - if (carrying != null) - Drops(); - level.solderingPen.x = x; - level.solderingPen.y = y; - level.solderingPen.room = room; - room = null; - if (level.currentViewer == level.player) - level.currentViewer=level.solderingPen; - level.player = level.solderingPen; - if (level.remote != null) - if (level.remote.carriedBy != null) - { - level.remote.carriedBy = level.player; - } - } - if (e.getKeyCode() == e.VK_R) - { - if (level.remote == null) return false; - if (level.remote.carriedBy == null) - { // Summon Remote - level.remote.x = 28; - level.remote.y = -20; - level.remote.carriedBy = level.player; - level.remote.room = level.player.room; - level.electricity = true; - } - else - { // Hide Remote - level.remote.carriedBy = null; - level.remote.room = null; - level.electricity = false; - } - // if (carrying != null) - // Drops(); - // level.remote.x = x; - // level.remote.y = y; - // level.remote.room = room; - // room = null; - // if (level.currentViewer == level.player) - // level.currentViewer=level.remote; - // level.player = level.remote; - } - if (e.getKeyCode() == e.VK_T) - { - if (level.toolbox == null) - { - if (carrying != null) - Drops(); - level.toolbox = new ToolBox(x,y+8,room); - level.items.addElement(level.toolbox); - ((ToolBox)level.toolbox).Toggle(); - PicksUp(level.toolbox); - } - if (level.toolbox.room != room) - { - // Summon Toolbox - if (carrying != null) return false; - if (((ToolBox)level.toolbox).open) ((ToolBox)level.toolbox).Toggle(); - level.toolbox.room = room; - level.toolbox.x = x+28; - level.toolbox.y = y+6; - PicksUp(level.toolbox); - } - else - ((ToolBox)level.toolbox).Toggle(); - } - if (e.getKeyCode() == e.VK_SLASH) - { - if (carrying != null) - if (carrying.getClass().toString().endsWith("Chip")) - { - ((GenericChip)carrying).ShowText(true); - return false; - } - if (level.helpCam == null) return false; - level.player = level.helpCam; - level.currentViewer = level.helpCam; - } - if (e.getKeyCode() == e.VK_RIGHT) - { - if (level.cheatmode) - if (e.isShiftDown()) - SetRoom(room.rightRoom); - if (carriedBy==null) - MoveRight(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_LEFT) - { - if (level.cheatmode) - if (e.isShiftDown()) - SetRoom(room.leftRoom); - if (carriedBy==null) - MoveLeft(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_UP) - { - if (level.cheatmode) - if (e.isShiftDown()) - SetRoom(room.upRoom); - if (carriedBy==null) - MoveUp(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_DOWN) - { - if (level.cheatmode) - if (e.isShiftDown()) - SetRoom(room.downRoom); - if (carriedBy==null) - MoveDown(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_SPACE) - { - { - Item item = level.FindNearestItem(level.gameCursor); - if (item!=null) - if (item.getClass().toString().endsWith("Train")) - { - item.CanBePickedUp(this); - return false; - } - } + public boolean CanBePickedUp(Item i) { + return !i.getClass().toString().endsWith("Robot"); + } - if (carrying != null) - Drops(); - else - { - Item item = level.FindNearestItem(level.gameCursor); - if (item != null) - if (item.CanBePickedUp(level.gameCursor)) - PicksUp(item); - } - outline = false; - return false; - } - if (e.getKeyCode() == e.VK_CLOSE_BRACKET) - { - if (carrying !=null) - if (carrying.isDevice()) - ((Device) carrying).rotate(1); - return false; - } - if (e.getKeyCode() == e.VK_OPEN_BRACKET) - { - if (carrying !=null) - if (carrying.isDevice()) - ((Device) carrying).rotate(-1); - return false; - } - if (e.getKeyCode() == e.VK_E) - { - boolean found=false; - Item item = level.FindNearestItem(this); - if (item!=null) - if (item.InternalRoom!=null) - if (Overlaps(item)) - // if (x>=item.x && y>=item.y - // && x+width <= item.x + item.width - // && y+height <= item.y + item.height) - if (!item.OverWall()) - { - int newX = 280; // 10 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - found=true; - } - } - if (e.getKeyCode() == e.VK_X) - { - if (room.portalItem!=null) - { - Dimension d = room.portalItem.GetXY(); - int newX = d.width - + room.portalItem.getWidth()/2 - - width/2; - int newY = d.height - + room.portalItem.getHeight()/4*2 - - height/2; - x = newX; - y = newY; - SetRoom(room.portalItem.room); - level.currentViewer = level.player; - } - } - if (e.getKeyCode() == e.VK_F) - { - if (carrying != null) - if (carrying instanceof Device) - ((Device)carrying).flip(); - } - if (e.getKeyCode() == e.VK_M) - { - Runtime runtime = Runtime.getRuntime(); - long freemem = runtime.freeMemory(); - long totalmem = runtime.totalMemory(); - System.out.println("Total Memory = "+ totalmem - + ", (" + totalmem/1024 + "K), (" - + totalmem/1024/1024 + "M)"); - System.out.println("Free Memory = "+ freemem - + ", (" + freemem/1024 + "K), (" - + freemem/1024/1024 + "M)"); - } + public boolean KeyUp(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_L) { + if (carrying != null) { + if (carrying instanceof SmallChip) { + FileDialog fd = new FileDialog(level.roomdisplay.dq, "Load Chip", FileDialog.LOAD); + fd.setDirectory("chips"); + fd.show(); + System.out.println("Dialog returned with " + + fd.getDirectory() + + fd.getFile()); + if (fd.getFile() != null) { + ((SmallChip) carrying).Empty(); + ((SmallChip) carrying).LoadChip(fd.getDirectory() + fd.getFile()); + } + } + } + } + if (e.getKeyCode() == KeyEvent.VK_S) { + if (level.solderingPen == null) { + return false; + } + if (carrying != null) { + Drops(); + } + level.solderingPen.x = x; + level.solderingPen.y = y; + level.solderingPen.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.solderingPen; + } + level.player = level.solderingPen; + if (level.remote != null) { + if (level.remote.carriedBy != null) { + level.remote.carriedBy = level.player; + } + } + } + if (e.getKeyCode() == KeyEvent.VK_R) { + if (level.remote == null) { + return false; + } + if (level.remote.carriedBy == null) { // Summon Remote + level.remote.x = 28; + level.remote.y = -20; + level.remote.carriedBy = level.player; + level.remote.room = level.player.room; + level.electricity = true; + } + else { // Hide Remote + level.remote.carriedBy = null; + level.remote.room = null; + level.electricity = false; + } + // if (carrying != null) + // Drops(); + // level.remote.x = x; + // level.remote.y = y; + // level.remote.room = room; + // room = null; + // if (level.currentViewer == level.player) + // level.currentViewer=level.remote; + // level.player = level.remote; + } + if (e.getKeyCode() == KeyEvent.VK_T) { + if (level.toolbox == null) { + if (carrying != null) { + Drops(); + } + level.toolbox = new ToolBox(x, y + 8, room); + level.items.addElement(level.toolbox); + ((ToolBox) level.toolbox).Toggle(); + PicksUp(level.toolbox); + } + if (level.toolbox.room != room) { + // Summon Toolbox + if (carrying != null) { + return false; + } + if (((ToolBox) level.toolbox).open) { + ((ToolBox) level.toolbox).Toggle(); + } + level.toolbox.room = room; + level.toolbox.x = x + 28; + level.toolbox.y = y + 6; + PicksUp(level.toolbox); + } + else { + ((ToolBox) level.toolbox).Toggle(); + } + } + if (e.getKeyCode() == KeyEvent.VK_SLASH) { + if (carrying != null) { + if (carrying instanceof GenericChip) { + ((GenericChip) carrying).ShowText(true); + return false; + } + } + if (level.helpCam == null) { + return false; + } + level.player = level.helpCam; + level.currentViewer = level.helpCam; + } + if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + if (level.cheatmode) { + if (e.isShiftDown() && room != null) { + SetRoom(room.rightRoom); + } + } + if (carriedBy == null) { + MoveRight(e.isControlDown()); + } + repeating = 0; + return true; + } + if (e.getKeyCode() == KeyEvent.VK_LEFT) { + if (level.cheatmode) { + if (e.isShiftDown() && room != null) { + SetRoom(room.leftRoom); + } + } + if (carriedBy == null) { + MoveLeft(e.isControlDown()); + } + repeating = 0; + return true; + } + if (e.getKeyCode() == KeyEvent.VK_UP) { + if (level.cheatmode) { + if (e.isShiftDown() && room != null) { + SetRoom(room.upRoom); + } + } + if (carriedBy == null) { + MoveUp(e.isControlDown()); + } + repeating = 0; + return true; + } + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + if (level.cheatmode) { + if (e.isShiftDown() && room != null) { + SetRoom(room.downRoom); + } + } + if (carriedBy == null) { + MoveDown(e.isControlDown()); + } + repeating = 0; + return true; + } + if (e.getKeyCode() == KeyEvent.VK_SPACE) { + { + Item item = level.FindNearestItem(level.gameCursor); + if (item != null) { + if (item instanceof Train) { + item.CanBePickedUp(this); + return false; + } + } + } - return false; - } + if (carrying != null) { + Drops(); + } + else { + Item item = level.FindNearestItem(level.gameCursor); + if (item != null) { + if (item.CanBePickedUp(level.gameCursor)) { + PicksUp(item); + } + } + } + outline = false; + return false; + } + if (e.getKeyCode() == KeyEvent.VK_CLOSE_BRACKET) { + if (carrying != null) { + if (carrying.isDevice()) { + ((Device) carrying).rotate(1); + } + } + return false; + } + if (e.getKeyCode() == KeyEvent.VK_OPEN_BRACKET) { + if (carrying != null) { + if (carrying.isDevice()) { + ((Device) carrying).rotate(-1); + } + } + return false; + } + if (e.getKeyCode() == KeyEvent.VK_E) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (Overlaps(item)) + // if (x>=item.x && y>=item.y + // && x+width <= item.x + item.width + // && y+height <= item.y + item.height) + { + if (!item.OverWall()) { + int newX = 280; // 10 * 28 + int newY = 176; // 5.5 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + } + } + if (e.getKeyCode() == KeyEvent.VK_X) { + if (room != null && room.portalItem != null) { + Dimension d = room.portalItem.GetXY(); + int newX = d.width + + room.portalItem.getWidth() / 2 + - width / 2; + int newY = d.height + + room.portalItem.getHeight() / 4 * 2 + - height / 2; + x = newX; + y = newY; + SetRoom(room.portalItem.room); + level.currentViewer = level.player; + } + } + if (e.getKeyCode() == KeyEvent.VK_F) { + if (carrying != null) { + if (carrying instanceof Device) { + ((Device) carrying).flip(); + } + } + } + if (e.getKeyCode() == KeyEvent.VK_M) { + Runtime runtime = Runtime.getRuntime(); + long freemem = runtime.freeMemory(); + long totalmem = runtime.totalMemory(); + System.out.println("Total Memory = " + totalmem + + ", (" + totalmem / 1024 + "K), (" + + totalmem / 1024 / 1024 + "M)"); + System.out.println("Free Memory = " + freemem + + ", (" + freemem / 1024 + "K), (" + + freemem / 1024 / 1024 + "M)"); + } - public boolean KeyDown(KeyEvent e) - { - if (e.getKeyCode() == e.VK_RIGHT) - { - repeating++; - if (repeating>5) - { - if (carriedBy==null) - MoveRight(e.isControlDown()); - return true; - } - return false; - } - if (e.getKeyCode() == e.VK_LEFT) - { - repeating++; - if (repeating>5) - { - if (carriedBy==null) - MoveLeft(e.isControlDown()); - return true; - } - return false; - } - if (e.getKeyCode() == e.VK_UP) - { - repeating++; - if (repeating>5) - { - if (carriedBy==null) - MoveUp(e.isControlDown()); - return true; - } - return false; - } - if (e.getKeyCode() == e.VK_DOWN) - { - repeating++; - if (repeating>5) - { - if (carriedBy==null) - MoveDown(e.isControlDown()); - return true; - } - return false; - } - if (e.getKeyCode() == e.VK_SPACE) - { - if (level.player == level.gameCursor) - outline = true; - } - return false; - } + return false; + } - public void Animate() - { - if (automove==1 && room == null) - automove=0; - if (automove==1) - { - int dx = autoX - x; - int dy = autoY - y; - if (dx==0 && dy==0) - { - automove=0; - return; - } - if (dx<-28) dx =-28; - if (dx>28) dx=28; - if (dy<-32) dy=-32; - if (dy>32) dy=32; - walk = 1-walk; - if (dx==0) - { - if (dy<0) - currentIcon = icons[0+walk].getImage(); - else - currentIcon = icons[2+walk].getImage(); - } - else - { - if (dx<0) - currentIcon = icons[4+walk].getImage(); - else - currentIcon = icons[6+walk].getImage(); - } - if (dx>0) MoveRight(dx); - if (dx<0) MoveLeft(-dx); - if (dy>0) MoveDown(dy); - if (dy<0) MoveUp(-dy); - } - if (automove==2) - { - walk = 1-walk; - if (autoX>0) - { - currentIcon = icons[6+walk].getImage(); - MoveRight(autoX); - } + public boolean KeyDown(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + repeating++; + if (repeating > 5) { + if (carriedBy == null) { + MoveRight(e.isControlDown()); + } + return true; + } + return false; + } + if (e.getKeyCode() == KeyEvent.VK_LEFT) { + repeating++; + if (repeating > 5) { + if (carriedBy == null) { + MoveLeft(e.isControlDown()); + } + return true; + } + return false; + } + if (e.getKeyCode() == KeyEvent.VK_UP) { + repeating++; + if (repeating > 5) { + if (carriedBy == null) { + MoveUp(e.isControlDown()); + } + return true; + } + return false; + } + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + repeating++; + if (repeating > 5) { + if (carriedBy == null) { + MoveDown(e.isControlDown()); + } + return true; + } + return false; + } + if (e.getKeyCode() == KeyEvent.VK_SPACE) { + if (level.player == level.gameCursor) { + outline = true; + } + } + return false; + } - if (autoX<0) - { - currentIcon = icons[4+walk].getImage(); - MoveLeft(-autoX); - } + public void Animate() { + if (automove == 1 && room == null) { + automove = 0; + } + if (automove == 1) { + int dx = autoX - x; + int dy = autoY - y; + if (dx == 0 && dy == 0) { + automove = 0; + return; + } + if (dx < -28) { + dx = -28; + } + if (dx > 28) { + dx = 28; + } + if (dy < -32) { + dy = -32; + } + if (dy > 32) { + dy = 32; + } + walk = 1 - walk; + if (dx == 0) { + if (dy < 0) { + currentIcon = icons[0 + walk].getImage(); + } + else { + currentIcon = icons[2 + walk].getImage(); + } + } + else { + if (dx < 0) { + currentIcon = icons[4 + walk].getImage(); + } + else { + currentIcon = icons[6 + walk].getImage(); + } + } + if (dx > 0) { + MoveRight(dx); + } + if (dx < 0) { + MoveLeft(-dx); + } + if (dy > 0) { + MoveDown(dy); + } + if (dy < 0) { + MoveUp(-dy); + } + } + if (automove == 2) { + walk = 1 - walk; + if (autoX > 0) { + currentIcon = icons[6 + walk].getImage(); + MoveRight(autoX); + } - if (autoY>0) - { - currentIcon = icons[2+walk].getImage(); - MoveDown(autoY); - } + if (autoX < 0) { + currentIcon = icons[4 + walk].getImage(); + MoveLeft(-autoX); + } - if (autoY<0) - { - currentIcon = icons[0+walk].getImage(); - MoveUp(-autoY); - } - } - } + if (autoY > 0) { + currentIcon = icons[2 + walk].getImage(); + MoveDown(autoY); + } - public GenericRobot PlayerInRobot(GenericRobot robot) - { - if (robot==null) - { - if (level.player.room.portalItem!=null) - { - if (level.player.room.portalItem.getClass().toString().endsWith("Robot")) - return (PlayerInRobot ((GenericRobot) level.player.room.portalItem)); - else return (null); - } - else - return (null); - } - else - if (robot.room.portalItem != null) - { - if (robot.room.portalItem.getClass().toString().endsWith("Robot")) - return (PlayerInRobot ((GenericRobot) robot.room.portalItem)); - else - return null; - } - else - return robot; - } + if (autoY < 0) { + currentIcon = icons[0 + walk].getImage(); + MoveUp(-autoY); + } + } + } + + public GenericRobot PlayerInRobot(GenericRobot robot) { + if (robot == null) { + if (level.player.room.portalItem != null) { + if (level.player.room.portalItem instanceof GenericRobot) { + return (PlayerInRobot((GenericRobot) level.player.room.portalItem)); + } + else { + return (null); + } + } + else { + return (null); + } + } + else if (robot.room.portalItem != null) { + if (robot.room.portalItem instanceof GenericRobot) { + return (PlayerInRobot((GenericRobot) robot.room.portalItem)); + } + else { + return null; + } + } + else { + return robot; + } + } } diff --git a/src/com/droidquest/avatars/HelpCam.java b/src/com/droidquest/avatars/HelpCam.java index 39534fa..e6ee4fe 100644 --- a/src/com/droidquest/avatars/HelpCam.java +++ b/src/com/droidquest/avatars/HelpCam.java @@ -1,45 +1,41 @@ package com.droidquest.avatars; -import java.awt.Graphics; -import java.awt.event.KeyEvent; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; -import javax.swing.JPanel; - import com.droidquest.Room; import com.droidquest.items.Item; -public class HelpCam extends Item -{ -public HelpCam(Room r) - { - charge=0; - x=28; y=32; width=0; height=0; room =r; - GenerateIcons(); - currentIcon = icons[0].getImage(); - } +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.image.BufferedImage; -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0] = new ImageIcon(new BufferedImage(8,8,BufferedImage.TYPE_4BYTE_ABGR)); - } +public class HelpCam extends Item { + public HelpCam(Room r) { + charge = 0; + x = 28; + y = 32; + width = 0; + height = 0; + room = r; + GenerateIcons(); + currentIcon = icons[0].getImage(); + } -public boolean KeyUp(KeyEvent e) - { - if (e.getKeyCode() == e.VK_ENTER) - { - level.player = level.gameCursor; - level.currentViewer = level.gameCursor; - } - return false; - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(8, 8, BufferedImage.TYPE_4BYTE_ABGR)); + } -public void Draw(Graphics g, JPanel jp) - { - // Draws nothing - } + public boolean KeyUp(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + level.player = level.gameCursor; + level.currentViewer = level.gameCursor; + } + return false; + } + + public void Draw(Graphics g, JPanel jp) { + // Draws nothing + } } diff --git a/src/com/droidquest/avatars/LabCursor.java b/src/com/droidquest/avatars/LabCursor.java index 3aee374..aa167e1 100644 --- a/src/com/droidquest/avatars/LabCursor.java +++ b/src/com/droidquest/avatars/LabCursor.java @@ -1,157 +1,146 @@ package com.droidquest.avatars; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FileDialog; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.event.KeyEvent; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.devices.Device; import com.droidquest.devices.GenericChip; import com.droidquest.devices.SmallChip; +import com.droidquest.items.GenericRobot; import com.droidquest.items.Item; import com.droidquest.items.ToolBox; -public class LabCursor extends Item -{ -public boolean hot; +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.image.BufferedImage; -public LabCursor(){} +public class LabCursor extends Item { + public boolean hot; -public LabCursor(int X, int Y, Room r) - { - x=X; y=Y; - hot=false; - room=r; - width=28; height=32; - GenerateIcons(); - } -public void GenerateIcons() - { - icons = new ImageIcon[2]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to LabCursor Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - g.setColor(Color.white); - g.fillRect(0,0,width,height); - try - { - g = icons[1].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to LabCursor Image"); - return; - } - g2 = (Graphics2D) g; - g.setColor(new Color(255,128,0)); - g.fillRect(0,0,width,height); - if (hot) - currentIcon = icons[1].getImage(); - else - currentIcon = icons[0].getImage(); - } -public boolean CanBePickedUp(Item i) - { - if (i.getClass().toString().endsWith("Robot")) - return false; - return true; - } + public LabCursor(int X, int Y, Room r) { + x = X; + y = Y; + hot = false; + room = r; + width = 28; + height = 32; + GenerateIcons(); + } -public boolean KeyUp(KeyEvent e) - { - if (e.getKeyCode() == e.VK_L) - { - if (carrying != null) - if (carrying.getClass().toString().endsWith("SmallChip")) - { - FileDialog fd = new FileDialog(level.roomdisplay.dq,"Load Chip", FileDialog.LOAD); - fd.setDirectory("chips"); - fd.show(); - System.out.println("Dialog returned with " - + fd.getDirectory() - + fd.getFile()); - if (fd.getFile() != null) - { - ((SmallChip)carrying).Empty(); - ((SmallChip)carrying).LoadChip(fd.getDirectory()+fd.getFile()); - } - } - } - if (e.getKeyCode() == e.VK_H) - { - hot = !hot; - if (hot) - currentIcon = icons[1].getImage(); - else - currentIcon = icons[0].getImage(); - return false; - } - if (e.getKeyCode() == e.VK_S) - { - if (level.solderingPen == null) return false; - if (carrying != null) - if (carrying.getClass().toString().endsWith("SmallChip")) - { - FileDialog fd = new FileDialog(level.roomdisplay.dq,"Save Chip", FileDialog.SAVE); - fd.setDirectory("chips"); - fd.show(); - System.out.println("Dialog returned with " - + fd.getDirectory() - + fd.getFile()); - if (fd.getFile() != null) - ((SmallChip)carrying).SaveChip(fd.getDirectory()+fd.getFile()); - return false; - } - if (carrying != null) - Drops(); - level.solderingPen.x = x; - level.solderingPen.y = y; - level.solderingPen.room = room; - room = null; - if (level.currentViewer == level.player) - level.currentViewer=level.solderingPen; - level.player = level.solderingPen; - if (level.remote != null) - if (level.remote.carriedBy != null) - { - level.remote.carriedBy = level.player; - } - } - if (e.getKeyCode() == e.VK_R) - { - if (level.remote == null) return false; - if (level.remote.carriedBy == null) - { // Summon Remote - level.remote.x = 28; - level.remote.y = -20; - level.remote.carriedBy = level.player; - level.remote.room = level.player.room; - level.electricity = true; - } - else - { // Hide Remote - level.remote.carriedBy = null; - level.remote.room = null; - level.electricity = false; - } + public void GenerateIcons() { + icons = new ImageIcon[2]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to LabCursor Image"); + return; + } + g.setColor(Color.white); + g.fillRect(0, 0, width, height); + try { + g = icons[1].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to LabCursor Image"); + return; + } + g.setColor(new Color(255, 128, 0)); + g.fillRect(0, 0, width, height); + if (hot) { + currentIcon = icons[1].getImage(); + } + else { + currentIcon = icons[0].getImage(); + } + } + + public boolean CanBePickedUp(Item i) { + return !(i instanceof GenericRobot); + } + + public boolean KeyUp(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_L) { + if (carrying != null) { + if (carrying instanceof SmallChip) { + FileDialog fd = new FileDialog(level.roomdisplay.dq, "Load Chip", FileDialog.LOAD); + fd.setDirectory("chips"); + fd.show(); + System.out.println("Dialog returned with " + + fd.getDirectory() + + fd.getFile()); + if (fd.getFile() != null) { + ((SmallChip) carrying).Empty(); + ((SmallChip) carrying).LoadChip(fd.getDirectory() + fd.getFile()); + } + } + } + } + else if (e.getKeyCode() == KeyEvent.VK_H) { + hot = !hot; + if (hot) { + currentIcon = icons[1].getImage(); + } + else { + currentIcon = icons[0].getImage(); + } + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_S) { + if (level.solderingPen == null) { + return false; + } + if (carrying != null) { + if (carrying instanceof SmallChip) { + FileDialog fd = new FileDialog(level.roomdisplay.dq, "Save Chip", FileDialog.SAVE); + fd.setDirectory("chips"); + fd.show(); + System.out.println("Dialog returned with " + + fd.getDirectory() + + fd.getFile()); + if (fd.getFile() != null) { + ((SmallChip) carrying).SaveChip(fd.getDirectory() + fd.getFile()); + } + return false; + } + } + if (carrying != null) { + Drops(); + } + level.solderingPen.x = x; + level.solderingPen.y = y; + level.solderingPen.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.solderingPen; + } + level.player = level.solderingPen; + if (level.remote != null) { + if (level.remote.carriedBy != null) { + level.remote.carriedBy = level.player; + } + } + } + else if (e.getKeyCode() == KeyEvent.VK_R) { + if (level.remote == null) { + return false; + } + if (level.remote.carriedBy == null) { // Summon Remote + level.remote.x = 28; + level.remote.y = -20; + level.remote.carriedBy = level.player; + level.remote.room = level.player.room; + level.electricity = true; + } + else { // Hide Remote + level.remote.carriedBy = null; + level.remote.room = null; + level.electricity = false; + } // if (carrying != null) // Drops(); // level.remote.x = x; @@ -161,280 +150,272 @@ public boolean KeyUp(KeyEvent e) // if (level.currentViewer == level.player) // level.currentViewer=level.remote; // level.player = level.remote; - } - if (e.getKeyCode() == e.VK_P) - { - if (level.paintbrush == null) return false; - if (carrying != null) - Drops(); - level.paintbrush.x = (x/28)*28; - level.paintbrush.y = (y/32)*32; - level.paintbrush.room = room; - room = null; - if (level.currentViewer == level.player) - level.currentViewer=level.paintbrush; - level.player = level.paintbrush; - } - if (e.getKeyCode() == e.VK_T) - { - if (level.toolbox == null) return false; - if (level.toolbox.room != room) - { - // Summon Toolbox - if (carrying != null) return false; - if (((ToolBox)level.toolbox).open) ((ToolBox)level.toolbox).Toggle(); - level.toolbox.room = room; - level.toolbox.x = x+28; - level.toolbox.y = y+6; - PicksUp(level.toolbox); - } - else - ((ToolBox)level.toolbox).Toggle(); - } - if (e.getKeyCode() == e.VK_SLASH) - { - if (carrying != null) - if (carrying.getClass().toString().endsWith("Chip")) - { - ((GenericChip)carrying).ShowText(true); - return false; - } - if (level.helpCam == null) return false; - level.player = level.helpCam; - level.currentViewer = level.helpCam; - } - if (e.getKeyCode() == e.VK_RIGHT) - { - if (carriedBy==null) - MoveRight(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_LEFT) - { - if (carriedBy==null) - MoveLeft(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_UP) - { - if (carriedBy==null) - MoveUp(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_DOWN) - { - if (carriedBy==null) - MoveDown(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_SPACE) - { - if (carrying != null) - Drops(); - else - { - Item item = level.FindNearestItem(level.gameCursor); - if (item != null) - if (item.CanBePickedUp(level.gameCursor)) - PicksUp(item); - } - return false; - } - if (e.getKeyCode() == e.VK_CLOSE_BRACKET) - { - if (carrying !=null) - if (carrying.isDevice()) - ((Device) carrying).rotate(1); - return false; - } - if (e.getKeyCode() == e.VK_OPEN_BRACKET) - { - if (carrying !=null) - if (carrying.isDevice()) - ((Device) carrying).rotate(-1); - return false; - } - if (e.getKeyCode() == e.VK_E) - { - boolean found=false; - Item item = level.FindNearestItem(this); - if (item!=null) - if (item.InternalRoom!=null) - if (Overlaps(item)) - if (!item.OverWall()) - { - int newX = 280; // 10 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - found=true; - } - } - if (e.getKeyCode() == e.VK_X) - { - if (room.portalItem!=null) - { - Dimension d = room.portalItem.GetXY(); - int newX = d.width - + room.portalItem.getWidth()/2 - - width/2; - int newY = d.height - + room.portalItem.getHeight()/4*2 - - height/2; - x = newX; - y = newY; - SetRoom(room.portalItem.room); - level.currentViewer = level.player; - } - } - if (e.getKeyCode() == e.VK_F) - { - if (carrying != null) - if (carrying instanceof Device) - ((Device)carrying).flip(); - } - if (e.getKeyCode() == e.VK_M) - { - Runtime runtime = Runtime.getRuntime(); - long freemem = runtime.freeMemory(); - long totalmem = runtime.totalMemory(); - System.out.println("Total Memory = "+ totalmem - + ", (" + totalmem/1024 + "K), (" - + totalmem/1024/1024 + "M)"); - System.out.println("Free Memory = "+ freemem - + ", (" + freemem/1024 + "K), (" - + freemem/1024/1024 + "M)"); - } + } + else if (e.getKeyCode() == KeyEvent.VK_P) { + if (level.paintbrush == null) { + return false; + } + if (carrying != null) { + Drops(); + } + level.paintbrush.x = (x / 28) * 28; + level.paintbrush.y = (y / 32) * 32; + level.paintbrush.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.paintbrush; + } + level.player = level.paintbrush; + } + else if (e.getKeyCode() == KeyEvent.VK_T) { + if (level.toolbox == null) { + return false; + } + if (level.toolbox.room != room) { + // Summon Toolbox + if (carrying != null) { + return false; + } + if (((ToolBox) level.toolbox).open) { + ((ToolBox) level.toolbox).Toggle(); + } + level.toolbox.room = room; + level.toolbox.x = x + 28; + level.toolbox.y = y + 6; + PicksUp(level.toolbox); + } + else { + ((ToolBox) level.toolbox).Toggle(); + } + } + else if (e.getKeyCode() == KeyEvent.VK_SLASH) { + if (carrying != null) { + if (carrying instanceof GenericChip) { + ((GenericChip) carrying).ShowText(true); + return false; + } + } + if (level.helpCam == null) { + return false; + } + level.player = level.helpCam; + level.currentViewer = level.helpCam; + } + else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + if (carriedBy == null) { + MoveRight(e.isControlDown()); + } + repeating = 0; + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + if (carriedBy == null) { + MoveLeft(e.isControlDown()); + } + repeating = 0; + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_UP) { + if (carriedBy == null) { + MoveUp(e.isControlDown()); + } + repeating = 0; + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_DOWN) { + if (carriedBy == null) { + MoveDown(e.isControlDown()); + } + repeating = 0; + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_SPACE) { + if (carrying != null) { + Drops(); + } + else { + Item item = level.FindNearestItem(level.gameCursor); + if (item != null) { + if (item.CanBePickedUp(level.gameCursor)) { + PicksUp(item); + } + } + } + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_CLOSE_BRACKET) { + if (carrying != null) { + if (carrying.isDevice()) { + ((Device) carrying).rotate(1); + } + } + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_OPEN_BRACKET) { + if (carrying != null) { + if (carrying.isDevice()) { + ((Device) carrying).rotate(-1); + } + } + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_E) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (Overlaps(item)) { + if (!item.OverWall()) { + int newX = 280; // 10 * 28 + int newY = 176; // 5.5 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + } + } + else if (e.getKeyCode() == KeyEvent.VK_X) { + if (room != null && room.portalItem != null) { + Dimension d = room.portalItem.GetXY(); + int newX = d.width + + room.portalItem.getWidth() / 2 + - width / 2; + int newY = d.height + + room.portalItem.getHeight() / 4 * 2 + - height / 2; + x = newX; + y = newY; + SetRoom(room.portalItem.room); + level.currentViewer = level.player; + } + } else if (e.getKeyCode() == KeyEvent.VK_F) { + if (carrying != null) { + if (carrying instanceof Device) { + ((Device) carrying).flip(); + } + } + } else if (e.getKeyCode() == KeyEvent.VK_M) { + Runtime runtime = Runtime.getRuntime(); + long freemem = runtime.freeMemory(); + long totalmem = runtime.totalMemory(); + System.out.println("Total Memory = " + totalmem + + ", (" + totalmem / 1024 + "K), (" + + totalmem / 1024 / 1024 + "M)"); + System.out.println("Free Memory = " + freemem + + ", (" + freemem / 1024 + "K), (" + + freemem / 1024 / 1024 + "M)"); + } - return false; - } + return false; + } -public boolean KeyDown(KeyEvent e) - { - if (e.getKeyCode() == e.VK_RIGHT) - { - repeating++; - if (repeating>10) - { - if (carriedBy==null) - MoveRight(e.isControlDown()); - return true; - } - return false; - } - if (e.getKeyCode() == e.VK_LEFT) - { - repeating++; - if (repeating>10) - { - if (carriedBy==null) - MoveLeft(e.isControlDown()); - return true; - } - return false; - } - if (e.getKeyCode() == e.VK_UP) - { - repeating++; - if (repeating>10) - { - if (carriedBy==null) - MoveUp(e.isControlDown()); - return true; - } - return false; - } - if (e.getKeyCode() == e.VK_DOWN) - { - repeating++; - if (repeating>10) - { - if (carriedBy==null) - MoveDown(e.isControlDown()); - return true; - } - return false; - } - return false; - } + public boolean KeyDown(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + repeating++; + if (repeating > 10) { + if (carriedBy == null) { + MoveRight(e.isControlDown()); + } + return true; + } + return false; + } + if (e.getKeyCode() == KeyEvent.VK_LEFT) { + repeating++; + if (repeating > 10) { + if (carriedBy == null) { + MoveLeft(e.isControlDown()); + } + return true; + } + return false; + } + if (e.getKeyCode() == KeyEvent.VK_UP) { + repeating++; + if (repeating > 10) { + if (carriedBy == null) { + MoveUp(e.isControlDown()); + } + return true; + } + return false; + } + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + repeating++; + if (repeating > 10) { + if (carriedBy == null) { + MoveDown(e.isControlDown()); + } + return true; + } + return false; + } + return false; + } -public void MoveUp(boolean nudge) - { - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - if (item.UpEnterOverlap(this)) - { - int newX = 280; // 10 * 28 - int newY = 320; // 10 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - super.MoveUp( nudge); - } + public void MoveUp(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.UpEnterOverlap(this)) { + int newX = 280; // 10 * 28 + int newY = 320; // 10 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveUp(nudge); + } -public void MoveDown(boolean nudge) - { - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - if (item.DownEnterOverlap(this)) - { - int newX = 280; // 10 * 28 - int newY = 0; // 0 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - super.MoveDown( nudge); - } + public void MoveDown(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.DownEnterOverlap(this)) { + int newX = 280; // 10 * 28 + int newY = 0; // 0 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveDown(nudge); + } -public void MoveLeft(boolean nudge) - { - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - if (item.LeftEnterOverlap(this)) - { - int newX = 532; // 19 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - super.MoveLeft( nudge); - } + public void MoveLeft(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.LeftEnterOverlap(this)) { + int newX = 532; // 19 * 28 + int newY = 176; // 5.5 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveLeft(nudge); + } -public void MoveRight(boolean nudge) - { - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - { - if (item.RightEnterOverlap(this)) - { - int newX = 0; // 0 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - } - super.MoveRight( nudge); - } + public void MoveRight(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.RightEnterOverlap(this)) { + int newX = 0; // 0 * 28 + int newY = 176; // 5.5 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveRight(nudge); + } } \ No newline at end of file diff --git a/src/com/droidquest/avatars/PaintBrush.java b/src/com/droidquest/avatars/PaintBrush.java index 6f67fd6..e8c31c8 100644 --- a/src/com/droidquest/avatars/PaintBrush.java +++ b/src/com/droidquest/avatars/PaintBrush.java @@ -1,277 +1,302 @@ package com.droidquest.avatars; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.event.KeyEvent; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - -import com.droidquest.items.GenericRobot; +import com.droidquest.items.BlueRobot; import com.droidquest.items.Item; +import com.droidquest.items.OrangeRobot; +import com.droidquest.items.WhiteRobot; import com.droidquest.materials.Material; import com.droidquest.materials.RobotBlocker; -public class PaintBrush extends Item -{ - // The Paintbrush works just like the original, except it allows - // differnt color paints for differnt materials. Pressing 'P' as the - // Paintbrush switches the Material Settings. - // - // Detectable, blocks all Red - // Undetectable, blocks all Green - // Undetectable, blocks Orange Orange - // Undetectable, blocks White White - // Undetectable, blocks Blue Blue +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.image.BufferedImage; - int emptyIndex=0; - int paintIndex; // Which paintMats[] am I using? - transient Material[] paintMats; - int matIndex; // index of chosen paintMax in level.materials +public class PaintBrush extends Item { + // The Paintbrush works just like the original, except it allows + // differnt color paints for differnt materials. Pressing 'P' as the + // Paintbrush switches the Material Settings. + // + // Detectable, blocks all Red + // Undetectable, blocks all Green + // Undetectable, blocks Orange Orange + // Undetectable, blocks White White + // Undetectable, blocks Blue Blue - public PaintBrush() - { - width=28; height=32; - GenerateIcons(); - } + private int emptyIndex = 0; + private int paintIndex; // Which paintMats[] am I using? + private transient Material[] paintMats; + private int matIndex; // index of chosen paintMax in level.materials - public void GenerateIcons() - { - icons = new ImageIcon[5]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[2]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[3]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[4]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - Graphics2D g2; - Color transparent = new Color(0,0,0,0); - for (int a=0; a<5; a++) - { - try - { - g = icons[a].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to PaintBrush Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - switch(a) - { - case 0: g.setColor(new Color(192,0,0)); - break; - case 1: g.setColor(new Color(0,192,0)); - break; - case 2: g.setColor(new Color(192,96,0)); - break; - case 3: g.setColor(new Color(192,192,192)); - break; - case 4: g.setColor(new Color(0,0,192)); - break; - } + public PaintBrush() { + width = 28; + height = 32; + GenerateIcons(); + } - g2.fillRect(0,0,28,18); - g2.fillRect(4,18,20,2); - g2.fillRect(8,20,12,10); - g2.fillRect(12,30,4,2); - g.setColor(Color.black); - g2.fillRect(0,12,28,2); - g2.fillRect(12,26,4,2); - } - currentIcon=icons[0].getImage(); - - paintMats = new Material[5]; - emptyIndex = 0; - paintMats[0] = Material.FindSimiliar(new Material(Color.red, false, true)); - paintMats[1] = Material.FindSimiliar(new Material(Color.green, false, false)); - Item robot=null; - for (int a=0; a383) - { - if (room.getDownRoom(this) != null) - { // change Rooms - y=y-384; - SetRoom(room.getDownRoom(this)); - } - else // stop at bottom - y=384-32; - } - } + for(Item item : level.items) { + if(item instanceof OrangeRobot) { + robot = item; + } + } + if (robot == null) { + System.out.println("Create paintbrush AFTER creating robots."); + } + paintMats[2] = Material.FindSimiliar(new RobotBlocker(robot, new Color(255, 128, 0))); - public void MoveLeft(boolean nudge) - { - int dist = 28; - if (nudge) dist = 2; - x=x-dist; - if (x<0) - { - if (room.getLeftRoom(this) != null) - { // change Rooms - x=x+560; - SetRoom(room.getLeftRoom(this)); - } - else // stop at left - x=0; - } - } + for (Item item : level.items) { + if(item instanceof WhiteRobot) { + robot = item; + } + } + paintMats[3] = Material.FindSimiliar(new RobotBlocker(robot, Color.white)); - public void MoveRight(boolean nudge) - { - int dist = 28; - if (nudge) dist = 2; - x=x+dist; - if (x>559) - { - if (room.getRightRoom(this) != null) - { // change Rooms - x=x-560; - SetRoom(room.getRightRoom(this)); - } - else // stop at right - x=560-28; - } - } + for(Item item : level.items) { + if(item instanceof BlueRobot) { + robot = item; + } + } - } + paintMats[4] = Material.FindSimiliar(new RobotBlocker(robot, Color.blue)); + + paintIndex = 0; + matIndex = level.materials.indexOf(paintMats[paintIndex]); + + } + + public boolean KeyUp(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_C) { + level.gameCursor.x = x; + level.gameCursor.y = y; + level.gameCursor.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.gameCursor; + } + level.player = level.gameCursor; + } + if (e.getKeyCode() == KeyEvent.VK_S) { + if (level.solderingPen == null) { + return false; + } + level.solderingPen.x = x; + level.solderingPen.y = y; + level.solderingPen.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.solderingPen; + } + level.player = level.solderingPen; + } + if (e.getKeyCode() == KeyEvent.VK_R) { + if (level.remote == null) { + return false; + } + level.remote.x = x; + level.remote.y = y; + level.remote.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.remote; + } + level.player = level.remote; + } + if (e.getKeyCode() == KeyEvent.VK_SLASH) { + if (level.helpCam == null) { + return false; + } + level.player = level.helpCam; + level.currentViewer = level.helpCam; + } + if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + if (e.isShiftDown()) { + SetRoom(room.rightRoom); + } + if (carriedBy == null) { + MoveRight(e.isControlDown()); + } + repeating = 0; + return true; + } + if (e.getKeyCode() == KeyEvent.VK_LEFT) { + if (e.isShiftDown()) { + SetRoom(room.leftRoom); + } + if (carriedBy == null) { + MoveLeft(e.isControlDown()); + } + repeating = 0; + return true; + } + if (e.getKeyCode() == KeyEvent.VK_UP) { + if (e.isShiftDown()) { + SetRoom(room.upRoom); + } + if (carriedBy == null) { + MoveUp(e.isControlDown()); + } + repeating = 0; + return true; + } + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + if (e.isShiftDown()) { + SetRoom(room.downRoom); + } + if (carriedBy == null) { + MoveDown(e.isControlDown()); + } + repeating = 0; + return true; + } + if (e.getKeyCode() == KeyEvent.VK_P) { + paintIndex++; + if (paintIndex == 5) { + paintIndex = 0; + } + matIndex = level.materials.indexOf(paintMats[paintIndex]); + currentIcon = icons[paintIndex].getImage(); + } + if (e.getKeyCode() == KeyEvent.VK_SPACE) { + if (!room.editable) { + return false; + } + int bigX = (x + 14) / 28; + int bigY = (y + 16) / 32; + if (room.RoomArray[bigY][bigX] == emptyIndex) { + room.SetMaterial(bigX, bigY, matIndex); + } + else { + room.SetMaterial(bigX, bigY, emptyIndex); + } + } + return false; + } + + public void MoveUp(boolean nudge) { + int dist = 32; + if (nudge) { + dist = 2; + } + y = y - dist; + if (y < 0) { + if (room.getUpRoom(this) != null) { // change Rooms + y = y + 384; + SetRoom(room.getUpRoom(this)); + } + else // stop at top + { + y = 0; + } + } + } + + public void MoveDown(boolean nudge) { + int dist = 32; + if (nudge) { + dist = 2; + } + y = y + dist; + if (y > 383) { + if (room.getDownRoom(this) != null) { // change Rooms + y = y - 384; + SetRoom(room.getDownRoom(this)); + } + else // stop at bottom + { + y = 384 - 32; + } + } + } + + public void MoveLeft(boolean nudge) { + int dist = 28; + if (nudge) { + dist = 2; + } + x = x - dist; + if (x < 0) { + if (room.getLeftRoom(this) != null) { // change Rooms + x = x + 560; + SetRoom(room.getLeftRoom(this)); + } + else // stop at left + { + x = 0; + } + } + } + + public void MoveRight(boolean nudge) { + int dist = 28; + if (nudge) { + dist = 2; + } + x = x + dist; + if (x > 559) { + if (room.getRightRoom(this) != null) { // change Rooms + x = x - 560; + SetRoom(room.getRightRoom(this)); + } + else // stop at right + { + x = 560 - 28; + } + } + } + +} diff --git a/src/com/droidquest/avatars/Remote.java b/src/com/droidquest/avatars/Remote.java index 17e1ec2..fcbb215 100644 --- a/src/com/droidquest/avatars/Remote.java +++ b/src/com/droidquest/avatars/Remote.java @@ -1,311 +1,233 @@ package com.droidquest.avatars; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.event.KeyEvent; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.items.Item; -public class Remote extends Item -{ -public Remote() - { -// width=28; height=32; - width=4; height=20; - level.electricity = true; - GenerateIcons(); - } +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.image.BufferedImage; -public void GenerateIcons() - { -// icons = new ImageIcon[2]; -// icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); -// icons[1]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); +public class Remote extends Item { + public Remote() { + width = 4; + height = 20; + level.electricity = true; + GenerateIcons(); + } - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - Graphics2D g2; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to Remote Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(new Color(0,0,0,0)); - g2.clearRect(0,0,width,height); - g2.setColor(new Color(255,128,0)); - g2.fillRect(2,0,2,20); - g2.fillRect(0,16,4,4); - currentIcon = icons[0].getImage(); + Graphics g; + Graphics2D g2; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to Remote Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(new Color(0, 0, 0, 0)); + g2.clearRect(0, 0, width, height); + g2.setColor(new Color(255, 128, 0)); + g2.fillRect(2, 0, 2, 20); + g2.fillRect(0, 16, 4, 4); + currentIcon = icons[0].getImage(); + } -// try -// { -// g = icons[0].getImage().getGraphics(); -// } -// catch (NullPointerException e) -// { -// System.out.println("Could not get Graphics pointer to Remote Image[0]"); -// return; -// } -// g2 = (Graphics2D) g; -// g2.setBackground(new Color(0,0,0,0)); -// g2.clearRect(0,0,width,height); -// g2.setColor(Color.white); -// g2.fillRect(20,0,4,12); -// g2.fillRect(0,12,28,20); -// g2.setColor(Color.black); -// g2.fillRect(8,14,12,2); -// g2.fillRect(4,18,20,2); -// g2.fillRect(8,22,12,2); -// g2.fillRect(20,26,4,4); - -// try -// { -// g = icons[1].getImage().getGraphics(); -// } -// catch (NullPointerException e) -// { -// System.out.println("Could not get Graphics pointer to Remote Image[1]"); -// return; -// } -// g2 = (Graphics2D) g; -// g2.setBackground(new Color(0,0,0,0)); -// g2.clearRect(0,0,width,height); -// g2.setColor(new Color(255,128,0)); -// g2.fillRect(20,0,4,12); -// g2.fillRect(0,12,28,20); -// g2.setColor(Color.black); -// g2.fillRect(8,14,12,2); -// g2.fillRect(4,18,20,2); -// g2.fillRect(8,22,12,2); -// g2.fillRect(20,26,4,4); + public void Animate() { + if (carriedBy != null) { + if (carriedBy.room != room) { + room = carriedBy.room; + } + } + super.Animate(); + } - } + public boolean CanBePickedUp(Item i) { + return false; + } -public void Animate() - { - if (carriedBy != null) - if (carriedBy.room != room) - room = carriedBy.room; - super.Animate(); -// if (level.electricity) -// currentIcon = icons[1].getImage(); -// else -// currentIcon = icons[0].getImage(); - } + public boolean KeyUp(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_S) { + if (level.solderingPen == null) { + return false; + } + level.solderingPen.x = x; + level.solderingPen.y = y; + level.solderingPen.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.solderingPen; + } + level.player = level.solderingPen; + } + else if (e.getKeyCode() == KeyEvent.VK_C) { + level.gameCursor.x = x; + level.gameCursor.y = y; + level.gameCursor.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.gameCursor; + } + level.player = level.gameCursor; + } + else if (e.getKeyCode() == KeyEvent.VK_P) { + if (level.paintbrush == null) { + return false; + } + level.paintbrush.x = x; + level.paintbrush.y = y; + level.paintbrush.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.paintbrush; + } + level.player = level.paintbrush; + } + else if (e.getKeyCode() == KeyEvent.VK_SLASH) { + if (level.helpCam == null) { + return false; + } + if (level.player != level.helpCam) { + level.player = level.helpCam; + level.currentViewer = level.helpCam; + } + } + else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + if (carriedBy == null) { + MoveRight(e.isControlDown()); + } + repeating = 0; + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + if (carriedBy == null) { + MoveLeft(e.isControlDown()); + } + repeating = 0; + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_UP) { + if (carriedBy == null) { + MoveUp(e.isControlDown()); + } + repeating = 0; + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_DOWN) { + if (carriedBy == null) { + MoveDown(e.isControlDown()); + } + repeating = 0; + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_SPACE) { + level.electricity = !level.electricity; + } + return false; + } -public boolean CanBePickedUp(Item i) - { -// if (i.getClass().toString().endsWith("Robot")) - return false; -// return true; - } + public boolean KeyDown(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + repeating++; + if (repeating > 10) { + MoveRight(e.isControlDown()); + return true; + } + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + repeating++; + if (repeating > 10) { + MoveLeft(e.isControlDown()); + return true; + } + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_UP) { + repeating++; + if (repeating > 10) { + MoveUp(e.isControlDown()); + return true; + } + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_DOWN) { + repeating++; + if (repeating > 10) { + MoveDown(e.isControlDown()); + return true; + } + return false; + } + return false; + } -public boolean KeyUp(KeyEvent e) - { - if (e.getKeyCode() == e.VK_S) - { - if (level.solderingPen == null) return false; - level.solderingPen.x = x; - level.solderingPen.y = y; - level.solderingPen.room = room; - room = null; - if (level.currentViewer == level.player) - level.currentViewer=level.solderingPen; - level.player = level.solderingPen; - } - if (e.getKeyCode() == e.VK_C) - { - level.gameCursor.x = x; - level.gameCursor.y = y; - level.gameCursor.room = room; - room = null; - if (level.currentViewer == level.player) - level.currentViewer=level.gameCursor; - level.player = level.gameCursor; - } - if (e.getKeyCode() == e.VK_P) - { - if (level.paintbrush == null) return false; - level.paintbrush.x = x; - level.paintbrush.y = y; - level.paintbrush.room = room; - room = null; - if (level.currentViewer == level.player) - level.currentViewer=level.paintbrush; - level.player = level.paintbrush; - } - if (e.getKeyCode() == e.VK_SLASH) - { - if (level.helpCam == null) return false; - if (level.player != level.helpCam) - { - level.player = level.helpCam; - level.currentViewer = level.helpCam; - } - } - if (e.getKeyCode() == e.VK_RIGHT) - { - if (carriedBy==null) - MoveRight(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_LEFT) - { - if (carriedBy==null) - MoveLeft(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_UP) - { - if (carriedBy==null) - MoveUp(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_DOWN) - { - if (carriedBy==null) - MoveDown(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_SPACE) - { - level.electricity = ! level.electricity; - } - return false; - } + public void MoveUp(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.UpEnterOverlap(this)) { + int newX = 280; // 10 * 28 + int newY = 320; // 10 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveUp(nudge); + } -public boolean KeyDown(KeyEvent e) - { - if (e.getKeyCode() == e.VK_RIGHT) - { - repeating++; - if (repeating>10) - { - MoveRight(e.isControlDown()); - return true; - } - return false; - } - if (e.getKeyCode() == e.VK_LEFT) - { - repeating++; - if (repeating>10) - { - MoveLeft(e.isControlDown()); - return true; - } - return false; - } - if (e.getKeyCode() == e.VK_UP) - { - repeating++; - if (repeating>10) - { - MoveUp(e.isControlDown()); - return true; - } - return false; - } - if (e.getKeyCode() == e.VK_DOWN) - { - repeating++; - if (repeating>10) - { - MoveDown(e.isControlDown()); - return true; - } - return false; - } - return false; - } + public void MoveDown(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.DownEnterOverlap(this)) { + int newX = 280; // 10 * 28 + int newY = 0; // 0 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveDown(nudge); + } -public void MoveUp(boolean nudge) - { - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - if (item.UpEnterOverlap(this)) - { - int newX = 280; // 10 * 28 - int newY = 320; // 10 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - super.MoveUp( nudge); - } + public void MoveLeft(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.LeftEnterOverlap(this)) { + int newX = 532; // 19 * 28 + int newY = 176; // 5.5 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveLeft(nudge); + } -public void MoveDown(boolean nudge) - { - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - if (item.DownEnterOverlap(this)) - { - int newX = 280; // 10 * 28 - int newY = 0; // 0 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - super.MoveDown( nudge); - } - -public void MoveLeft(boolean nudge) - { - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - if (item.LeftEnterOverlap(this)) - { - int newX = 532; // 19 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - super.MoveLeft( nudge); - } - -public void MoveRight(boolean nudge) - { - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - { - if (item.RightEnterOverlap(this)) - { - int newX = 0; // 0 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - } - super.MoveRight( nudge); - } + public void MoveRight(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.RightEnterOverlap(this)) { + int newX = 0; // 0 * 28 + int newY = 176; // 5.5 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveRight(nudge); + } } diff --git a/src/com/droidquest/avatars/SolderingPen.java b/src/com/droidquest/avatars/SolderingPen.java index 5b38a12..c5e43ec 100644 --- a/src/com/droidquest/avatars/SolderingPen.java +++ b/src/com/droidquest/avatars/SolderingPen.java @@ -1,543 +1,503 @@ package com.droidquest.avatars; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.Wire; import com.droidquest.chipstuff.Port; import com.droidquest.devices.Device; import com.droidquest.items.Item; -public class SolderingPen extends Device -{ -boolean hot; -Port currentPort=null; // Port that Soldering pen is currently over +import javax.swing.*; +import java.awt.*; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.image.BufferedImage; -public SolderingPen() - { - width=22; height=26; - GenerateIcons(); - currentIcon = icons[0].getImage(); - ports = new Port[1]; - ports[0] = new Port(2,20,Port.TYPE_UNDEFINED,0,Port.ROT_DOWN, this); - - } +public class SolderingPen extends Device { + private boolean hot; + private Port currentPort = null; // Port that Soldering pen is currently over -public void GenerateIcons() - { - // Executed once during initialization - icons = new ImageIcon[3]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[2]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - Graphics2D g2; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to SolderingPen Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(new Color(0,0,0,0)); - g2.clearRect(0,0,width,height); - g2.setColor(Color.blue); - g2.fillRect(18,0,6,4); - g2.fillRect(10,2,2,4); - g2.fillRect(10,4,10,2); - g2.fillRect(16,6,10,4); - g2.fillRect(10,10,6,4); - g2.fillRect(6,14,6,4); - g2.fillRect(0,18,12,8); - - try - { - g = icons[1].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to SolderingPen Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(new Color(0,0,0,0)); - g2.clearRect(0,0,width,height); - g2.setColor(Color.blue); - g2.fillRect(18,0,6,4); - g2.fillRect(10,2,2,4); - g2.fillRect(10,4,10,2); - g2.fillRect(16,6,10,4); - g2.fillRect(10,10,6,4); - g2.fillRect(6,14,6,4); - g2.setColor(new Color(255,128,0)); - g2.fillRect(0,18,12,8); - - try - { - g = icons[2].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to SolderingPen Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(new Color(0,0,0,0)); - g2.clearRect(0,0,width,height); - g2.setColor(Color.blue); - g2.fillRect(18,0,6,4); - g2.fillRect(10,2,2,4); - g2.fillRect(10,4,10,2); - g2.fillRect(16,6,10,4); - g2.fillRect(10,10,6,4); - g2.fillRect(6,14,6,4); - g2.setColor(Color.green); - g2.fillRect(0,18,12,8); - - currentIcon = icons[0].getImage(); - } + public SolderingPen() { + width = 22; + height = 26; + GenerateIcons(); + currentIcon = icons[0].getImage(); + ports = new Port[1]; + ports[0] = new Port(2, 20, Port.TYPE_UNDEFINED, 0, Port.ROT_DOWN, this); -public void CheckPort() - { - hot=false; - currentPort=null; -// Item item = level.FindNearestItem(this); - for (int a=0; a x+9) hot = false; - if (device.ports[b].y + device.y < y+18) hot = false; - if (device.ports[b].y + device.y > y+25) hot = false; - if (hot) - { - currentPort = device.ports[b]; - if (device.ports[b].myWire == null) - currentIcon = icons[1].getImage(); - else - currentIcon = icons[2].getImage(); - b = device.ports.length; - a = level.items.size(); - } - else - currentIcon = icons[0].getImage(); - } - } - } - if (hot==false) - currentIcon = icons[0].getImage(); - } + } -public void MoveUp(boolean nudge) - { - Room tempRoom = room; - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - if (item.UpEnterOverlap(this)) - { - int newX = 280; // 10 * 28 - int newY = 320; // 10 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - super.MoveUp( nudge); - if (tempRoom != room && ports[0].myWire != null) - ports[0].myWire.Remove(); + public void GenerateIcons() { + // Executed once during initialization + icons = new ImageIcon[3]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[2] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + Graphics2D g2; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to SolderingPen Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(new Color(0, 0, 0, 0)); + g2.clearRect(0, 0, width, height); + g2.setColor(Color.blue); + g2.fillRect(18, 0, 6, 4); + g2.fillRect(10, 2, 2, 4); + g2.fillRect(10, 4, 10, 2); + g2.fillRect(16, 6, 10, 4); + g2.fillRect(10, 10, 6, 4); + g2.fillRect(6, 14, 6, 4); + g2.fillRect(0, 18, 12, 8); + + try { + g = icons[1].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to SolderingPen Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(new Color(0, 0, 0, 0)); + g2.clearRect(0, 0, width, height); + g2.setColor(Color.blue); + g2.fillRect(18, 0, 6, 4); + g2.fillRect(10, 2, 2, 4); + g2.fillRect(10, 4, 10, 2); + g2.fillRect(16, 6, 10, 4); + g2.fillRect(10, 10, 6, 4); + g2.fillRect(6, 14, 6, 4); + g2.setColor(new Color(255, 128, 0)); + g2.fillRect(0, 18, 12, 8); + + try { + g = icons[2].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to SolderingPen Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(new Color(0, 0, 0, 0)); + g2.clearRect(0, 0, width, height); + g2.setColor(Color.blue); + g2.fillRect(18, 0, 6, 4); + g2.fillRect(10, 2, 2, 4); + g2.fillRect(10, 4, 10, 2); + g2.fillRect(16, 6, 10, 4); + g2.fillRect(10, 10, 6, 4); + g2.fillRect(6, 14, 6, 4); + g2.setColor(Color.green); + g2.fillRect(0, 18, 12, 8); + + currentIcon = icons[0].getImage(); + } + + void CheckPort() { + hot = false; + currentPort = null; + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (!item.isDevice() || !Overlaps(item) || item == this) { + item = null; + } + if (item != null) { + Device device = (Device) item; + for (int b = 0; b < device.ports.length; b++) { + hot = device.ports[b].x + device.x >= x; + if (device.ports[b].x + device.x > x + 9) { + hot = false; + } + if (device.ports[b].y + device.y < y + 18) { + hot = false; + } + if (device.ports[b].y + device.y > y + 25) { + hot = false; + } + if (hot) { + currentPort = device.ports[b]; + if (device.ports[b].myWire == null) { + currentIcon = icons[1].getImage(); + } + else { + currentIcon = icons[2].getImage(); + } + b = device.ports.length; + a = level.items.size(); + } + else { + currentIcon = icons[0].getImage(); + } + } + } + } + if (!hot) { + currentIcon = icons[0].getImage(); + } + } + + public void MoveUp(boolean nudge) { + Room tempRoom = room; + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.UpEnterOverlap(this)) { + int newX = 280; // 10 * 28 + int newY = 320; // 10 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveUp(nudge); + if (tempRoom != room && ports[0].myWire != null) { + ports[0].myWire.Remove(); + } // wiredPort=null; - CheckPort(); - } + CheckPort(); + } -public void MoveDown(boolean nudge) - { - Room tempRoom = room; - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - if (item.DownEnterOverlap(this)) - { - int newX = 280; // 10 * 28 - int newY = 0; // 0 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - super.MoveDown( nudge); - if (tempRoom != room && ports[0].myWire != null) - ports[0].myWire.Remove(); -// wiredPort=null; - CheckPort(); - } + public void MoveDown(boolean nudge) { + Room tempRoom = room; + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.DownEnterOverlap(this)) { + int newX = 280; // 10 * 28 + int newY = 0; // 0 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveDown(nudge); + if (tempRoom != room && ports[0].myWire != null) { + ports[0].myWire.Remove(); + } + CheckPort(); + } -public void MoveLeft(boolean nudge) - { - Room tempRoom = room; - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - if (item.LeftEnterOverlap(this)) - { - int newX = 532; // 19 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - super.MoveLeft( nudge); - if (tempRoom != room && ports[0].myWire != null) - ports[0].myWire.Remove(); -// wiredPort=null; - CheckPort(); - } + public void MoveLeft(boolean nudge) { + Room tempRoom = room; + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.LeftEnterOverlap(this)) { + int newX = 532; // 19 * 28 + int newY = 176; // 5.5 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveLeft(nudge); + if (tempRoom != room && ports[0].myWire != null) { + ports[0].myWire.Remove(); + } + CheckPort(); + } -public void MoveRight(boolean nudge) - { - Room tempRoom = room; - Item item = level.FindNearestItem(this); - if (item != null) - { - if (item.InternalRoom != null) - { - if (item.RightEnterOverlap(this)) - { - int newX = 0; // 0 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - } - super.MoveRight( nudge); - if (tempRoom != room && ports[0].myWire != null) - ports[0].myWire.Remove(); -// wiredPort=null; - CheckPort(); - } + public void MoveRight(boolean nudge) { + Room tempRoom = room; + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.RightEnterOverlap(this)) { + int newX = 0; // 0 * 28 + int newY = 176; // 5.5 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.MoveRight(nudge); + if (tempRoom != room && ports[0].myWire != null) { + ports[0].myWire.Remove(); + } + CheckPort(); + } -public void Animate() - { - Room tempRoom = room; - super.Animate(); - if (tempRoom != room && ports[0].myWire != null) - ports[0].myWire.Remove(); - CheckPort(); - } + public void Animate() { + Room tempRoom = room; + super.Animate(); + if (tempRoom != room && ports[0].myWire != null) { + ports[0].myWire.Remove(); + } + CheckPort(); + } -public void Decorate() - {return;} + public void Decorate() { + } -public void WirePort() - { - if (hot) - { - if (ports[0].myWire == null) // If SP is not wired - { - if (currentPort.myWire != null) // If currentPort is wired - { - // Remove Wire from currentPort - currentPort.myWire.Remove(); - ports[0].value = false; - ports[0].type = Port.TYPE_UNDEFINED; - } - else // If currentPort not wired - { - // Create Wire from CurrentPort to Soldering Pen - Wire tempWire = new Wire(currentPort, ports[0]); - } - } - else // if SP is wired - { - if (currentPort.myWire != null) // If currentPort is wired - { - // Remove wire at currentPort - currentPort.myWire.Remove(); - // Remove wire attached to Pen - if (ports[0].myWire != null) - ports[0].myWire.Remove(); - ports[0].value = false; - ports[0].type = Port.TYPE_UNDEFINED; - } - else // If currentPort not wired - { - // Attach Wire to currentPort - ports[0].myWire.ConnectTo(currentPort); - } - } - } - else if (ports[0].myWire != null) // If not hot and SP wired - { - // Remove Wire to Pen - ports[0].myWire.Remove(); - ports[0].value = false; - ports[0].type = Port.TYPE_UNDEFINED; - } - } + void WirePort() { + if (hot) { + if (ports[0].myWire == null) // If SP is not wired + { + if (currentPort.myWire != null) // If currentPort is wired + { + // Remove Wire from currentPort + currentPort.myWire.Remove(); + ports[0].value = false; + ports[0].type = Port.TYPE_UNDEFINED; + } + else // If currentPort not wired + { + // Create Wire from CurrentPort to Soldering Pen + Wire tempWire = new Wire(currentPort, ports[0]); + } + } + else // if SP is wired + { + if (currentPort.myWire != null) // If currentPort is wired + { + // Remove wire at currentPort + currentPort.myWire.Remove(); + // Remove wire attached to Pen + if (ports[0].myWire != null) { + ports[0].myWire.Remove(); + } + ports[0].value = false; + ports[0].type = Port.TYPE_UNDEFINED; + } + else // If currentPort not wired + { + // Attach Wire to currentPort + ports[0].myWire.ConnectTo(currentPort); + } + } + } + else if (ports[0].myWire != null) // If not hot and SP wired + { + // Remove Wire to Pen + ports[0].myWire.Remove(); + ports[0].value = false; + ports[0].type = Port.TYPE_UNDEFINED; + } + } -public boolean Function () - { - if (ports[0].myWire == null) - { - ports[0].value = false; - ports[0].type = Port.TYPE_UNDEFINED; - } - return false; - } + public boolean Function() { + if (ports[0].myWire == null) { + ports[0].value = false; + ports[0].type = Port.TYPE_UNDEFINED; + } + return false; + } -public boolean CanBePickedUp(Item i) - { - if (i.getClass().toString().endsWith("Robot")) - return false; - return true; - } + public boolean CanBePickedUp(Item i) { + return !i.getClass().toString().endsWith("Robot"); + } -public boolean KeyUp(KeyEvent e) - { - if (e.getKeyCode() == e.VK_C) - { - if (ports[0].myWire != null) - ports[0].myWire.Remove(); - level.gameCursor.x = x; - level.gameCursor.y = y; - level.gameCursor.room = room; - room = null; - if (level.currentViewer == level.player) - level.currentViewer=level.gameCursor; - level.player = level.gameCursor; - if (level.remote != null) - if (level.remote.carriedBy != null) - { - level.remote.carriedBy = level.player; - } - } - if (e.getKeyCode() == e.VK_R) - { - if (level.remote == null) return false; - if (level.remote.carriedBy == null) - { // Summon Remote - level.remote.x = 28; - level.remote.y = -20; - level.remote.carriedBy = level.player; - level.remote.room = level.player.room; - level.electricity = true; - } - else - { // Hide Remote - level.remote.carriedBy = null; - level.remote.room = null; - level.electricity = false; - } -// if (ports[0].myWire != null) -// ports[0].myWire.Remove(); -// level.remote.x = x; -// level.remote.y = y; -// level.remote.room = room; -// room = null; -// if (level.currentViewer == level.player) -// level.currentViewer=level.remote; -// level.player = level.remote; - } - if (e.getKeyCode() == e.VK_P) - { - if (level.paintbrush == null) return false; - if (ports[0].myWire != null) - ports[0].myWire.Remove(); - level.paintbrush.x = x; - level.paintbrush.y = y; - level.paintbrush.room = room; - room = null; - if (level.currentViewer == level.player) - level.currentViewer=level.paintbrush; - level.player = level.paintbrush; - } - if (e.getKeyCode() == e.VK_SLASH) - { - if (level.helpCam == null) return false; - level.player = level.helpCam; - level.currentViewer = level.helpCam; - } - if (e.getKeyCode() == e.VK_RIGHT) - { - if (carriedBy==null) - MoveRight(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_LEFT) - { - if (carriedBy==null) - MoveLeft(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_UP) - { - if (carriedBy==null) - MoveUp(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_DOWN) - { - if (carriedBy==null) - MoveDown(e.isControlDown()); - repeating=0; - return true; - } - if (e.getKeyCode() == e.VK_SPACE) - { - WirePort(); - } - if (e.getKeyCode() == e.VK_F) - { - if (hot) - { - if (ports[0].myWire != null) // If SP is wired - { - // Flip wire attached to SP - Port tempPort = ports[0].myWire.fromPort; - ports[0].myWire.fromPort = ports[0].myWire.toPort; - ports[0].myWire.toPort = tempPort; - } - else if (ports[0].myWire == null) // If SP is not wired - { - // Flip wire attached to CurrentPort - if (currentPort.myWire != null) - { - Port tempPort = currentPort.myWire.fromPort; - currentPort.myWire.fromPort = currentPort.myWire.toPort; - currentPort.myWire.toPort = tempPort; - } - } - } - else - { - if (ports[0].myWire != null) // If SP is wired - { - // Flip wire attached to SP - Port tempPort = ports[0].myWire.fromPort; - ports[0].myWire.fromPort = ports[0].myWire.toPort; - ports[0].myWire.toPort = tempPort; - } - } - } - return false; - } + public boolean KeyUp(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_C) { + if (ports[0].myWire != null) { + ports[0].myWire.Remove(); + } + level.gameCursor.x = x; + level.gameCursor.y = y; + level.gameCursor.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.gameCursor; + } + level.player = level.gameCursor; + if (level.remote != null) { + if (level.remote.carriedBy != null) { + level.remote.carriedBy = level.player; + } + } + } + else if (e.getKeyCode() == KeyEvent.VK_R) { + if (level.remote == null) { + return false; + } + if (level.remote.carriedBy == null) { // Summon Remote + level.remote.x = 28; + level.remote.y = -20; + level.remote.carriedBy = level.player; + level.remote.room = level.player.room; + level.electricity = true; + } + else { // Hide Remote + level.remote.carriedBy = null; + level.remote.room = null; + level.electricity = false; + } -public boolean KeyDown(KeyEvent e) - { - if (e.getKeyCode() == e.VK_RIGHT) - { - repeating++; - if (repeating>10) - { - MoveRight(e.isControlDown()); - return true; - } - return false; - } - if (e.getKeyCode() == e.VK_LEFT) - { - repeating++; - if (repeating>10) - { - MoveLeft(e.isControlDown()); - return true; - } - return false; - } - if (e.getKeyCode() == e.VK_UP) - { - repeating++; - if (repeating>10) - { - MoveUp(e.isControlDown()); - return true; - } - return false; - } - if (e.getKeyCode() == e.VK_DOWN) - { - repeating++; - if (repeating>10) - { - MoveDown(e.isControlDown()); - return true; - } - return false; - } - return false; - } + } + else if (e.getKeyCode() == KeyEvent.VK_P) { + if (level.paintbrush == null) { + return false; + } + if (ports[0].myWire != null) { + ports[0].myWire.Remove(); + } + level.paintbrush.x = x; + level.paintbrush.y = y; + level.paintbrush.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.paintbrush; + } + level.player = level.paintbrush; + } + else if (e.getKeyCode() == KeyEvent.VK_SLASH) { + if (level.helpCam == null) { + return false; + } + level.player = level.helpCam; + level.currentViewer = level.helpCam; + } + else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + if (carriedBy == null) { + MoveRight(e.isControlDown()); + } + repeating = 0; + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + if (carriedBy == null) { + MoveLeft(e.isControlDown()); + } + repeating = 0; + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_UP) { + if (carriedBy == null) { + MoveUp(e.isControlDown()); + } + repeating = 0; + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_DOWN) { + if (carriedBy == null) { + MoveDown(e.isControlDown()); + } + repeating = 0; + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_SPACE) { + WirePort(); + } + else if (e.getKeyCode() == KeyEvent.VK_F) { + if (hot) { + if (ports[0].myWire != null) // If SP is wired + { + // Flip wire attached to SP + Port tempPort = ports[0].myWire.fromPort; + ports[0].myWire.fromPort = ports[0].myWire.toPort; + ports[0].myWire.toPort = tempPort; + } + else if (ports[0].myWire == null) // If SP is not wired + { + // Flip wire attached to CurrentPort + if (currentPort.myWire != null) { + Port tempPort = currentPort.myWire.fromPort; + currentPort.myWire.fromPort = currentPort.myWire.toPort; + currentPort.myWire.toPort = tempPort; + } + } + } + else { + if (ports[0].myWire != null) // If SP is wired + { + // Flip wire attached to SP + Port tempPort = ports[0].myWire.fromPort; + ports[0].myWire.fromPort = ports[0].myWire.toPort; + ports[0].myWire.toPort = tempPort; + } + } + } + return false; + } -public void MouseClick(MouseEvent e) - { - int button=0; - if ((e.getModifiers() & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) - button = 1; - if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) - button = 3; - - if (button==1) - { - if (e.getClickCount()==1) - { - autoX = e.getX() - 2; - autoY = e.getY() - 20; - automove = 1; - } - else if (e.getClickCount()==2) - { - int dx = e.getX() - 2 - x; - int dy = e.getY() - 20 - y; - if (Math.abs(dx) > Math.abs(dy)) - { - autoY=0; autoX=28; - if (dx<0) autoX=-28; - automove=2; - } - else - { - autoX=0; autoY=32; - if (dy<0) autoY=-32; - automove=2; - } - } - } - - if (button==3) - { - KeyEvent k = new KeyEvent(e.getComponent(), e.getID(), - e.getWhen(), 0, - KeyEvent.VK_SPACE, ' '); - KeyUp(k); - } - - } + public boolean KeyDown(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + repeating++; + if (repeating > 10) { + MoveRight(e.isControlDown()); + return true; + } + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + repeating++; + if (repeating > 10) { + MoveLeft(e.isControlDown()); + return true; + } + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_UP) { + repeating++; + if (repeating > 10) { + MoveUp(e.isControlDown()); + return true; + } + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_DOWN) { + repeating++; + if (repeating > 10) { + MoveDown(e.isControlDown()); + return true; + } + return false; + } + return false; + } + + public void MouseClick(MouseEvent e) { + int button = 0; + if ((e.getModifiers() & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) { + button = 1; + } + if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { + button = 3; + } + + if (button == 1) { + if (e.getClickCount() == 1) { + autoX = e.getX() - 2; + autoY = e.getY() - 20; + automove = 1; + } + else if (e.getClickCount() == 2) { + int dx = e.getX() - 2 - x; + int dy = e.getY() - 20 - y; + if (Math.abs(dx) > Math.abs(dy)) { + autoY = 0; + autoX = 28; + if (dx < 0) { + autoX = -28; + } + automove = 2; + } + else { + autoX = 0; + autoY = 32; + if (dy < 0) { + autoY = -32; + } + automove = 2; + } + } + } + + if (button == 3) { + KeyEvent k = new KeyEvent(e.getComponent(), e.getID(), + e.getWhen(), 0, + KeyEvent.VK_SPACE, ' '); + KeyUp(k); + } + + } } diff --git a/src/com/droidquest/chipstuff/ChipCompiler.java b/src/com/droidquest/chipstuff/ChipCompiler.java index fa059e4..8249080 100644 --- a/src/com/droidquest/chipstuff/ChipCompiler.java +++ b/src/com/droidquest/chipstuff/ChipCompiler.java @@ -7,201 +7,184 @@ import com.droidquest.devices.PrototypeChip; import com.droidquest.devices.SmallChip; import com.droidquest.items.Item; -public class ChipCompiler extends Thread -{ -public static int chipSpeed=1; +public class ChipCompiler extends Thread { + public static int chipSpeed = 1; -public ChipCompiler(PrototypeChip pc, SmallChip sc) - { - pc.grabbable = false; - sc.grabbable = false; - int a; - - sc.Empty(); - - for (a=0; a=0) - { - Signal sig = (Signal) sc.signals.elementAt(index); - sc.portSignals[a].internalSignal= sig; - } - sc.ports[a].type = pc.ports[a].type; - sc.portSignals[a].type = pc.ports[a].type; - } + public ChipCompiler(PrototypeChip pc, SmallChip sc) { + pc.grabbable = false; + sc.grabbable = false; + int a; - for (a=0; a= 0) { + sc.portSignals[a].internalSignal = sc.signals.elementAt(index); + } + sc.ports[a].type = pc.ports[a].type; + sc.portSignals[a].type = pc.ports[a].type; + } + + for (a = 0; a < pc.level.items.size(); a++) { + Item item = pc.level.items.elementAt(a); + if (item.room == pc.InternalRoom) { + if (item.isDevice()) { + Device device = (Device) item; + Gate gate = null; + + if (device instanceof com.droidquest.devices.ANDGate) { + gate = new Gate("AND"); + } + if (device instanceof com.droidquest.devices.ORGate) { + gate = new Gate("OR"); + } + if (device instanceof com.droidquest.devices.NOTGate) { + gate = new Gate("NOT"); + } + if (device instanceof com.droidquest.devices.XORGate) { + gate = new Gate("XOR"); + } + if (device instanceof com.droidquest.devices.FlipFlop) { + gate = new Gate("FF"); + gate.state = ((FlipFlop) device).state; + } + if (device instanceof com.droidquest.devices.Node) { + gate = new Gate("NODE"); + } + if (device instanceof com.droidquest.devices.SmallChip) { + gate = new Gate((SmallChip) device); + } + if (gate != null) { + sc.gates.addElement(gate); + for (int p = 0; p < device.ports.length; p++) { + if (device.ports[p].myWire != null) { + int index = pc.InternalRoom.wires.indexOf(device.ports[p].myWire); + gate.portSignals[p].externalSignal = sc.signals.elementAt(index); + } + else { + gate.portSignals[p].externalSignal = dummy; + } + } + } + } + } + } + + // Remove Node Gates, and transfer Signals + for (a = 0; a < sc.gates.size(); a++) //For every Gate in the chip + { + Gate gate1 = sc.gates.elementAt(a); + if (gate1.type.equals("NODE")) { + for (int ap = 1; ap < 4; ap++) // For every output Signal in the Node + { + Signal s1 = gate1.portSignals[ap].externalSignal; + if (s1 != null && s1 != dummy) { + for (int b = 0; b < sc.gates.size(); b++) // For every other Gate in the Chip + { + Gate gate2 = sc.gates.elementAt(b); + if (gate1 != gate2) { + for (int bp = 0; bp < 8; bp++) // For every Signal connection in that other gate + { + Signal s2 = gate2.portSignals[bp].externalSignal; + if (s1 == s2) // If Signal is an output Node signal + { + gate2.portSignals[bp].externalSignal + = gate1.portSignals[0].externalSignal; + } + } + } + } + for (int ps = 0; ps < 8; ps++) { + if (sc.portSignals[ps].internalSignal == s1) { + sc.portSignals[ps].internalSignal + = gate1.portSignals[0].externalSignal; + } + } + } + } + sc.gates.removeElement(gate1); + a--; + } + } + + // Remove unused Signals + for (a = 0; a < sc.signals.size(); a++) { + boolean used = false; + Signal sig1 = sc.signals.elementAt(a); + for (int g = 0; g < sc.gates.size(); g++) { + Gate gate = sc.gates.elementAt(g); + for (int s = 0; s < 8; s++) { + Signal sig2 = gate.portSignals[s].externalSignal; + if (sig2 != null) + { + if (sig1 == sig2) { + used = true; + } + } + } + } + for (int ps = 0; ps < 8; ps++) { + if (sc.portSignals[ps].internalSignal == sig1) { + used = true; + } + } + if (!used) { + sc.signals.removeElement(sig1); + a--; + } + } + + // Set Signal types + for (a = 0; a < 8; a++) { + if (sc.portSignals[a] != null) { + sc.portSignals[a].type = sc.ports[a].type; + } + } + + // Debug report + System.out.println(sc.signals.size() + " Signals"); + System.out.println(sc.gates.size() + " Gates"); + for (a = 0; a < sc.gates.size(); a++) { + Gate gate1 = sc.gates.elementAt(a); + for (int b = 0; b < 8; b++) { + if (gate1.portSignals[b].externalSignal != null) { + System.out.println(a + ": " + gate1.type + + " gate[" + + b + + "] = Signal " + + sc.signals.indexOf(gate1.portSignals[b].externalSignal)); + } + } + } + for (a = 0; a < 8; a++) { + if (sc.portSignals[a].internalSignal != null) { + System.out.println("PortSignal " + + a + + " = Signal " + + sc.signals.indexOf(sc.portSignals[a].internalSignal)); + } + } + + sc.speed = chipSpeed; + if (pc.label != null) { + sc.label = pc.label; + } + if (pc.description != null) { + sc.description = pc.description; + } + sc.GenerateIcons(); + pc.grabbable = true; + sc.grabbable = true; + } } diff --git a/src/com/droidquest/chipstuff/Gate.java b/src/com/droidquest/chipstuff/Gate.java index c8c22f0..e50a96e 100644 --- a/src/com/droidquest/chipstuff/Gate.java +++ b/src/com/droidquest/chipstuff/Gate.java @@ -1,310 +1,267 @@ package com.droidquest.chipstuff; +import com.droidquest.devices.SmallChip; + import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.Vector; -import com.droidquest.devices.SmallChip; +public class Gate implements Serializable { + public transient PortSignal[] portSignals = new PortSignal[8]; + public boolean state; + public String type; + public int speed; -public class Gate implements Serializable -{ -public transient PortSignal[] portSignals = new PortSignal[8]; -public boolean state; -public String type; -public int speed; + public Vector mySignals = new Vector(); + public Vector myGates = new Vector(); -public Vector mySignals = new Vector(); -public Vector myGates = new Vector(); - -public Gate(String t) - { - // Called whenever a non-chip gate is created. - type = t; - speed = 1; - for (int a=0; a<8; a++) - portSignals[a] = new PortSignal(); + public Gate(String t) { + // Called whenever a non-chip gate is created. + type = t; + speed = 1; + for (int a = 0; a < 8; a++) { + portSignals[a] = new PortSignal(); + } } -public Gate(SmallChip sc) - { - // Called by ChipCompiler to put a nested chip into a gate - speed = sc.speed; - type = "Chip"; - Signal dummySignal; - portSignals = new PortSignal[8]; - for (int a=0; a<8; a++) - portSignals[a] = new PortSignal(); - for (int a=0; a=0) - portSignals[a].internalSignal = (Signal) mySignals.elementAt(portIndex); - } - for (int a=0; a=0) - gate.portSignals[b].externalSignal = (Signal) mySignals.elementAt(sigIndex); - gate.portSignals[b].type = s.readInt(); - } - gate.readRef(s); - } - } + for (int a = 0; a < 8; a++) { + if (sc.portSignals[a].internalSignal != null) { + int sigIndex = sc.signals.indexOf(sc.portSignals[a].internalSignal); + portSignals[a].internalSignal = mySignals.elementAt(sigIndex); + portSignals[a].type = sc.portSignals[a].type; + } + } -public void Function() - { - if (type.equalsIgnoreCase("AND")) - portSignals[2].externalSignal.Set(portSignals[0].externalSignal.Get() - & portSignals[1].externalSignal.Get()); - if (type.equalsIgnoreCase("OR")) - portSignals[2].externalSignal.Set(portSignals[0].externalSignal.Get() - | portSignals[1].externalSignal.Get()); - if (type.equalsIgnoreCase("NOT")) - portSignals[1].externalSignal.Set(!portSignals[0].externalSignal.Get()); - if (type.equalsIgnoreCase("XOR")) - portSignals[2].externalSignal.Set(portSignals[0].externalSignal.Get() - ^ portSignals[1].externalSignal.Get()); - if (type.equalsIgnoreCase("FF")) - { - if (portSignals[0].externalSignal.Get() ^ portSignals[1].externalSignal.Get()) - state = portSignals[0].externalSignal.Get(); - portSignals[2].externalSignal.Set(state); - portSignals[3].externalSignal.Set(!state); - } - if (type.equalsIgnoreCase("NODE")) - { - portSignals[1].externalSignal.Set(portSignals[0].externalSignal.Get()); - portSignals[2].externalSignal.Set(portSignals[0].externalSignal.Get()); - if (portSignals[3].externalSignal!=null) - portSignals[3].externalSignal.Set(portSignals[0].externalSignal.Get()); - } - if (type.equalsIgnoreCase("Chip")) - { - - for (int s=0; s=0) - portSignals[a].internalSignal = (Signal) mySignals.elementAt(sigIndex); - portSignals[a].type = s.readInt(); - } - - int numGates = s.readInt(); - for (int a=0; a=0) - newGate.portSignals[b].externalSignal = (Signal) mySignals.elementAt(sigIndex); - } - if (newGate.type.equalsIgnoreCase("Chip")) - newGate.LoadSubGate(s); - } - speed = s.readInt(); - } + public void writeRef(ObjectOutputStream s) throws IOException { + for (int a = 0; a < 8; a++) { + s.writeInt(mySignals.indexOf(portSignals[a].internalSignal)); + } + for (int a = 0; a < myGates.size(); a++) { + Gate gate = myGates.elementAt(a); + for (int b = 0; b < 8; b++) { + s.writeInt(mySignals.indexOf(gate.portSignals[b].externalSignal)); + s.writeInt(gate.portSignals[b].type); + } + gate.writeRef(s); + } + } -public void DebugReport(int indent) - { -// String ind = ""; -// for (int a=0; a= 0) { + portSignals[a].internalSignal = mySignals.elementAt(portIndex); + } + } + for (int a = 0; a < myGates.size(); a++) { + Gate gate = myGates.elementAt(a); + gate.portSignals = new PortSignal[8]; + for (int b = 0; b < 8; b++) { + gate.portSignals[b] = new PortSignal(); + int sigIndex = s.readInt(); + if (sigIndex >= 0) { + gate.portSignals[b].externalSignal = mySignals.elementAt(sigIndex); + } + gate.portSignals[b].type = s.readInt(); + } + gate.readRef(s); + } + } + public void Function() { + if (type.equalsIgnoreCase("AND")) { + portSignals[2].externalSignal.Set(portSignals[0].externalSignal.Get() + & portSignals[1].externalSignal.Get()); + } + else if (type.equalsIgnoreCase("OR")) { + portSignals[2].externalSignal.Set(portSignals[0].externalSignal.Get() + | portSignals[1].externalSignal.Get()); + } + else if (type.equalsIgnoreCase("NOT")) { + portSignals[1].externalSignal.Set(!portSignals[0].externalSignal.Get()); + } + else if (type.equalsIgnoreCase("XOR")) { + portSignals[2].externalSignal.Set(portSignals[0].externalSignal.Get() + ^ portSignals[1].externalSignal.Get()); + } + else if (type.equalsIgnoreCase("FF")) { + if (portSignals[0].externalSignal.Get() ^ portSignals[1].externalSignal.Get()) { + state = portSignals[0].externalSignal.Get(); + } + portSignals[2].externalSignal.Set(state); + portSignals[3].externalSignal.Set(!state); + } + else if (type.equalsIgnoreCase("NODE")) { + portSignals[1].externalSignal.Set(portSignals[0].externalSignal.Get()); + portSignals[2].externalSignal.Set(portSignals[0].externalSignal.Get()); + if (portSignals[3].externalSignal != null) { + portSignals[3].externalSignal.Set(portSignals[0].externalSignal.Get()); + } + } + else if (type.equalsIgnoreCase("Chip")) { + for (int s = 0; s < speed; s++) { + for (int a = 0; a < mySignals.size(); a++) { + mySignals.elementAt(a).Flip(); + } + + for (int a = 0; a < 8; a++) { + if (portSignals[a].externalSignal != null + && portSignals[a].internalSignal != null) { + if (portSignals[a].type == Port.TYPE_INPUT) { + portSignals[a].internalSignal.Set(portSignals[a].externalSignal.Get()); + } + } + } + + for (int a = 0; a < myGates.size(); a++) { + myGates.elementAt(a).Function(); + } + + for (int a = 0; a < 8; a++) { + if (portSignals[a].externalSignal != null + && portSignals[a].internalSignal != null) { + if (portSignals[a].type == Port.TYPE_OUTPUT) { + portSignals[a].externalSignal.Set(portSignals[a].internalSignal.Get()); + } + } + } + } + } + } + + public void SaveSubGate(ObjectOutputStream s) throws IOException { + s.writeInt(mySignals.size()); + for (int a = 0; a < mySignals.size(); a++) { + Signal sig = mySignals.elementAt(a); + s.writeBoolean(sig.Get()); + s.writeBoolean(sig.working); + } + + for (int a = 0; a < 8; a++) { + s.writeInt(mySignals.indexOf(portSignals[a].internalSignal)); + s.writeInt(portSignals[a].type); + } + + s.writeInt(myGates.size()); + for (int a = 0; a < myGates.size(); a++) { + Gate gate = myGates.elementAt(a); + s.writeObject(gate.type); + s.writeBoolean(gate.state); + for (int b = 0; b < 8; b++) { + s.writeInt(mySignals.indexOf(gate.portSignals[b].externalSignal)); + } + if (gate.type.equalsIgnoreCase("Chip")) { + gate.SaveSubGate(s); + } + } + s.writeInt(speed); + } + + public void LoadSubGate(ObjectInputStream s) throws IOException, ClassNotFoundException { + int numSignals = s.readInt(); + mySignals = new Vector(); + for (int a = 0; a < numSignals; a++) { + Signal newSignal = new Signal(); + newSignal.Set(s.readBoolean()); + newSignal.working = s.readBoolean(); + mySignals.addElement(newSignal); + } + + for (int a = 0; a < 8; a++) { + int sigIndex = s.readInt(); + if (sigIndex >= 0) { + portSignals[a].internalSignal = mySignals.elementAt(sigIndex); + } + portSignals[a].type = s.readInt(); + } + + int numGates = s.readInt(); + for (int a = 0; a < numGates; a++) { + Gate newGate = new Gate((String) s.readObject()); + newGate.state = s.readBoolean(); + myGates.addElement(newGate); + for (int b = 0; b < 8; b++) { + int sigIndex = s.readInt(); + if (sigIndex >= 0) { + newGate.portSignals[b].externalSignal = mySignals.elementAt(sigIndex); + } + } + if (newGate.type.equalsIgnoreCase("Chip")) { + newGate.LoadSubGate(s); + } + } + speed = s.readInt(); + } } diff --git a/src/com/droidquest/chipstuff/Port.java b/src/com/droidquest/chipstuff/Port.java index 5d8cd8e..64c46e3 100644 --- a/src/com/droidquest/chipstuff/Port.java +++ b/src/com/droidquest/chipstuff/Port.java @@ -12,183 +12,180 @@ import com.droidquest.devices.Device; import com.droidquest.items.Item; import com.droidquest.levels.Level; -public class Port implements Serializable -{ - // Input or Output of a Device +public class Port implements Serializable { + // Input or Output of a Device - public int type; // 0=Input, 1=Output, 2=Undefined - public static final int TYPE_INPUT = 0; - public static final int TYPE_OUTPUT = 1; - public static final int TYPE_UNDEFINED = 2; - private int size; // Short or Long port 0=Short, 1=Long - boolean standard; // Shows Graphics? - public int rotation; //0=Up, 1=Left, 2=Down, 3=Right; - public static final int ROT_UP = 0; - public static final int ROT_RIGHT = 1; - public static final int ROT_DOWN = 2; - public static final int ROT_LEFT = 3; + public int type; // 0=Input, 1=Output, 2=Undefined + public static final int TYPE_INPUT = 0; + public static final int TYPE_OUTPUT = 1; + public static final int TYPE_UNDEFINED = 2; + private int size; // Short or Long port 0=Short, 1=Long + private boolean standard; // Shows Graphics? + public int rotation; //0=Up, 1=Left, 2=Down, 3=Right; + public static final int ROT_UP = 0; + public static final int ROT_RIGHT = 1; + public static final int ROT_DOWN = 2; + public static final int ROT_LEFT = 3; - public boolean value; // True or False, what else? - public int x,y; - public int width, height; // width & height - public int wireX, wireY; - public transient Item myDevice; - public transient Wire myWire; - public boolean locked; // False = Reverts to Undefined with no connections + public boolean value; // True or False, what else? + public int x, y; + public int width, height; // width & height + private int wireX; + private int wireY; + public transient Item myDevice; + public transient Wire myWire; + private boolean locked; // False = Reverts to Undefined with no connections - public Port() {} + public Port() { + } - public Port(int X, int Y, int Type, int Size, int rot, Device d) - { - // There are realy only two types of Ports: Standard and Chip. A - // Standard Port is what appears on all Gates, Robot Devices, and - // the Prototype Chip. 20 images are defined for these conditions: - // (Input/Output/Undefined) * (U/D/L/R) * (On/Off). Undefined is - // always Off. If the type is not Standard, it's a chip port, and - // uses no graphics. - - x=X; y=Y; - type = Type; - size = Size; - rotation = rot; - standard = (size>0); - myDevice = d; - - if (standard) - { - width = 12; height=size; - wireX = x + 6; wireY = y + height - 6; - } - else - { - width = 2; height = 2; - wireX = x; wireY = y; - } - - if (type==TYPE_UNDEFINED) - locked=false; - else - locked=true; - - } + public Port(int X, int Y, int Type, int Size, int rot, Device d) { + // There are realy only two types of Ports: Standard and Chip. A + // Standard Port is what appears on all Gates, Robot Devices, and + // the Prototype Chip. 20 images are defined for these conditions: + // (Input/Output/Undefined) * (U/D/L/R) * (On/Off). Undefined is + // always Off. If the type is not Standard, it's a chip port, and + // uses no graphics. - public void writeRef(ObjectOutputStream s) throws IOException - { - Level level = myDevice.level; - s.writeInt(level.items.indexOf(myDevice)); - if (myDevice.room != null) - s.writeInt(myDevice.room.wires.indexOf(myWire)); - } + x = X; + y = Y; + type = Type; + size = Size; + rotation = rot; + standard = (size > 0); + myDevice = d; - public void readRef(ObjectInputStream s, Level level) throws IOException - { - myDevice = (Item) level.FindItem(s.readInt()); - if (myDevice != null) - if (myDevice.room != null) - myWire = myDevice.room.FindWire(s.readInt()); - } + if (standard) { + width = 12; + height = size; + wireX = x + 6; + wireY = y + height - 6; + } + else { + width = 2; + height = 2; + wireX = x; + wireY = y; + } - public void Draw(Graphics g, int rot) - { - if (value) - g.setColor(new Color(255,128,0)); - else - g.setColor(Color.white); - int relRot = (rotation + rot)%4; - if (standard) - { - switch (type) - { - case TYPE_INPUT: - switch(relRot) - { - case 0: // Up - g.fillRect(x+0,y+4,4,size); - g.fillRect(x-4,y+0,4,4); - g.fillRect(x+4,y+0,4,4); - g.fillRect(x+0,y-2,4,2); - break; - case 1: // Right - g.fillRect(x-size-3,y+0,size,4); - g.fillRect(x-3,y-4,4,4); - g.fillRect(x-3,y+4,4,4); - g.fillRect(x+1,y+0,2,4); - break; - case 2: // Down - g.fillRect(x-3,y-size-3,4,size); - g.fillRect(x-7,y-3,4,4); - g.fillRect(x+1,y-3,4,4); - g.fillRect(x-3,y+1,4,2); - break; - case 3: // Left - g.fillRect(x+4,y-3,size,4); - g.fillRect(x+0,y-7,4,4); - g.fillRect(x+0,y+1,4,4); - g.fillRect(x-2,y-3,2,4); - break; - } - break; - case TYPE_OUTPUT: - switch(relRot) - { - case 0: // Up - g.fillRect(x+0,y+0,4,size); - g.fillRect(x-4,y+2,12,2); - g.fillRect(x-8,y+4,4,2); - g.fillRect(x+8,y+4,4,2); - break; - case 1: // Right - g.fillRect(x-size+1,y+0,size,4); - g.fillRect(x-3,y-4,2,12); - g.fillRect(x-5,y-8,2,4); - g.fillRect(x-5,y+8,2,4); - break; - case 2: // Down - g.fillRect(x-3,y-size,4,size); - g.fillRect(x-7,y-3,12,2); - g.fillRect(x-11,y-5,4,2); - g.fillRect(x+5,y-5,4,2); - break; - case 3: // Left - g.fillRect(x,y-3,size,4); - g.fillRect(x+2,y-7,2,12); - g.fillRect(x+4,y+5,2,4); - g.fillRect(x+4,y-11,2,4); - break; - } - break; - case TYPE_UNDEFINED: - switch(relRot) - { - case 0: // Up - g.fillRect(x-2,y-4,8,12); - g.fillRect(x,y+8,4,size); - g.setColor(Color.black); - g.fillRect(x,y,4,4); - break; - case 1: // Right - g.fillRect(x-7,y-2,12,8); - g.fillRect(x-7-size,y,size,4); - g.setColor(Color.black); - g.fillRect(x-3,y,4,4); - break; - case 2: // Down - g.fillRect(x-5,y-7,8,12); - g.fillRect(x-3,y-7-size,4,size); - g.setColor(Color.black); - g.fillRect(x-3,y-3,4,4); - break; - case 3: // Left - g.fillRect(x-4,y-5,12,8); - g.fillRect(x+8,y-3,size,4); - g.setColor(Color.black); - g.fillRect(x,y-3,4,4); - break; - } - break; - } - } - } + locked = type != TYPE_UNDEFINED; + + } + + public void writeRef(ObjectOutputStream s) throws IOException { + Level level = myDevice.level; + s.writeInt(level.items.indexOf(myDevice)); + if (myDevice.room != null) { + s.writeInt(myDevice.room.wires.indexOf(myWire)); + } + } + + public void readRef(ObjectInputStream s, Level level) throws IOException { + myDevice = level.FindItem(s.readInt()); + if (myDevice != null) { + if (myDevice.room != null) { + myWire = myDevice.room.FindWire(s.readInt()); + } + } + } + + public void Draw(Graphics g, int rot) { + if (value) { + g.setColor(new Color(255, 128, 0)); + } + else { + g.setColor(Color.white); + } + int relRot = (rotation + rot) % 4; + if (standard) { + switch (type) { + case TYPE_INPUT: + switch (relRot) { + case 0: // Up + g.fillRect(x + 0, y + 4, 4, size); + g.fillRect(x - 4, y + 0, 4, 4); + g.fillRect(x + 4, y + 0, 4, 4); + g.fillRect(x + 0, y - 2, 4, 2); + break; + case 1: // Right + g.fillRect(x - size - 3, y + 0, size, 4); + g.fillRect(x - 3, y - 4, 4, 4); + g.fillRect(x - 3, y + 4, 4, 4); + g.fillRect(x + 1, y + 0, 2, 4); + break; + case 2: // Down + g.fillRect(x - 3, y - size - 3, 4, size); + g.fillRect(x - 7, y - 3, 4, 4); + g.fillRect(x + 1, y - 3, 4, 4); + g.fillRect(x - 3, y + 1, 4, 2); + break; + case 3: // Left + g.fillRect(x + 4, y - 3, size, 4); + g.fillRect(x + 0, y - 7, 4, 4); + g.fillRect(x + 0, y + 1, 4, 4); + g.fillRect(x - 2, y - 3, 2, 4); + break; + } + break; + case TYPE_OUTPUT: + switch (relRot) { + case 0: // Up + g.fillRect(x + 0, y + 0, 4, size); + g.fillRect(x - 4, y + 2, 12, 2); + g.fillRect(x - 8, y + 4, 4, 2); + g.fillRect(x + 8, y + 4, 4, 2); + break; + case 1: // Right + g.fillRect(x - size + 1, y + 0, size, 4); + g.fillRect(x - 3, y - 4, 2, 12); + g.fillRect(x - 5, y - 8, 2, 4); + g.fillRect(x - 5, y + 8, 2, 4); + break; + case 2: // Down + g.fillRect(x - 3, y - size, 4, size); + g.fillRect(x - 7, y - 3, 12, 2); + g.fillRect(x - 11, y - 5, 4, 2); + g.fillRect(x + 5, y - 5, 4, 2); + break; + case 3: // Left + g.fillRect(x, y - 3, size, 4); + g.fillRect(x + 2, y - 7, 2, 12); + g.fillRect(x + 4, y + 5, 2, 4); + g.fillRect(x + 4, y - 11, 2, 4); + break; + } + break; + case TYPE_UNDEFINED: + switch (relRot) { + case 0: // Up + g.fillRect(x - 2, y - 4, 8, 12); + g.fillRect(x, y + 8, 4, size); + g.setColor(Color.black); + g.fillRect(x, y, 4, 4); + break; + case 1: // Right + g.fillRect(x - 7, y - 2, 12, 8); + g.fillRect(x - 7 - size, y, size, 4); + g.setColor(Color.black); + g.fillRect(x - 3, y, 4, 4); + break; + case 2: // Down + g.fillRect(x - 5, y - 7, 8, 12); + g.fillRect(x - 3, y - 7 - size, 4, size); + g.setColor(Color.black); + g.fillRect(x - 3, y - 3, 4, 4); + break; + case 3: // Left + g.fillRect(x - 4, y - 5, 12, 8); + g.fillRect(x + 8, y - 3, size, 4); + g.setColor(Color.black); + g.fillRect(x, y - 3, 4, 4); + break; + } + break; + } + } + } - } +} diff --git a/src/com/droidquest/chipstuff/PortSignal.java b/src/com/droidquest/chipstuff/PortSignal.java index 012c0ba..96e6ce1 100644 --- a/src/com/droidquest/chipstuff/PortSignal.java +++ b/src/com/droidquest/chipstuff/PortSignal.java @@ -1,12 +1,12 @@ package com.droidquest.chipstuff; -public class PortSignal -{ -public Signal externalSignal; -public Signal internalSignal; -public int type; +public class PortSignal { + public Signal externalSignal; + public Signal internalSignal; + public int type; -public PortSignal() {} + public PortSignal() { + } } diff --git a/src/com/droidquest/chipstuff/Signal.java b/src/com/droidquest/chipstuff/Signal.java index 591fe9f..20e912c 100644 --- a/src/com/droidquest/chipstuff/Signal.java +++ b/src/com/droidquest/chipstuff/Signal.java @@ -2,26 +2,25 @@ package com.droidquest.chipstuff; import java.io.Serializable; -public class Signal implements Serializable -{ -transient private int index; -private boolean[] value = new boolean[2]; -public boolean working; -public Signal() - { - index=0; - working=true; - } -public void Flip() - { - index = 1-index; - } -public boolean Get() - { - return value[index] && working; - } -public void Set(boolean v) - { - value[1-index] = v && working; - } +public class Signal implements Serializable { + transient private int index; + private boolean[] value = new boolean[2]; + public boolean working; + + public Signal() { + index = 0; + working = true; + } + + public void Flip() { + index = 1 - index; + } + + public boolean Get() { + return value[index] && working; + } + + public void Set(boolean v) { + value[1 - index] = v && working; + } } diff --git a/src/com/droidquest/decorations/Arrow.java b/src/com/droidquest/decorations/Arrow.java index bfa797b..ace2ec9 100644 --- a/src/com/droidquest/decorations/Arrow.java +++ b/src/com/droidquest/decorations/Arrow.java @@ -4,54 +4,52 @@ import java.awt.Color; import java.awt.Graphics; import java.io.Serializable; -public class Arrow implements Serializable -{ -public static int DIR_UP = 0; -public static int DIR_RIGHT = 1; -public static int DIR_DOWN = 2; -public static int DIR_LEFT = 3; -public int direction; -public int length; -public int x; -public int y; -public Color color; +public class Arrow implements Serializable { + public static int DIR_UP = 0; + public static int DIR_RIGHT = 1; + public static int DIR_DOWN = 2; + public static int DIR_LEFT = 3; + public int direction; + private int length; + private int x; + public int y; + private Color color; -public Arrow() {} + public Arrow() { + } -public Arrow(int X, int Y, int dir, int len, Color c) - { - x=X; y=Y; - direction = dir; - length = len; - color = c; - } + public Arrow(int X, int Y, int dir, int len, Color c) { + x = X; + y = Y; + direction = dir; + length = len; + color = c; + } -public void Draw(Graphics g) - { - g.setColor(color); - switch(direction) - { - case 0: - g.drawLine(x,y,x-8,y+8); - g.drawLine(x,y,x+8,y+8); - g.drawLine(x,y,x,y+length); - break; - case 1: - g.drawLine(x,y,x-8,y-8); - g.drawLine(x,y,x-8,y+8); - g.drawLine(x,y,x-length,y); - break; - case 2: - g.drawLine(x,y,x-8,y-8); - g.drawLine(x,y,x+8,y-8); - g.drawLine(x,y,x,y-length); - break; - case 3: - g.drawLine(x,y,x+8,y-8); - g.drawLine(x,y,x+8,y+8); - g.drawLine(x,y,x+length,y); - break; - } - } + public void Draw(Graphics g) { + g.setColor(color); + switch (direction) { + case 0: + g.drawLine(x, y, x - 8, y + 8); + g.drawLine(x, y, x + 8, y + 8); + g.drawLine(x, y, x, y + length); + break; + case 1: + g.drawLine(x, y, x - 8, y - 8); + g.drawLine(x, y, x - 8, y + 8); + g.drawLine(x, y, x - length, y); + break; + case 2: + g.drawLine(x, y, x - 8, y - 8); + g.drawLine(x, y, x + 8, y - 8); + g.drawLine(x, y, x, y - length); + break; + case 3: + g.drawLine(x, y, x + 8, y - 8); + g.drawLine(x, y, x + 8, y + 8); + g.drawLine(x, y, x + length, y); + break; + } + } } diff --git a/src/com/droidquest/decorations/Graphix.java b/src/com/droidquest/decorations/Graphix.java index f12d686..9213925 100644 --- a/src/com/droidquest/decorations/Graphix.java +++ b/src/com/droidquest/decorations/Graphix.java @@ -7,126 +7,128 @@ import javax.swing.ImageIcon; import com.droidquest.RoomDisplay; -public class Graphix implements Serializable -{ -public String[] filenames; -transient protected ImageIcon[] icons; // Array of images for this item -transient ImageIcon icon; -int animationState; -public int x; // Current position -int y; -int behavior; // Overall behavior (SIT, CYCLE, BOUNCE) -int current=1; // Current behavior; 1=move forward, -1=move backward -int dx, dy; // Direction of "forward" -public int count; -int length; // Number of times the Graphix moves forward -public static int SIT=0; -public static int CYCLE=1; -public static int BOUNCE=2; +public class Graphix implements Serializable { + public String[] filenames; + private transient ImageIcon[] icons; // Array of images for this item + private transient ImageIcon icon; + private int animationState; + public int x; // Current position + private int y; + private int behavior; // Overall behavior (SIT, CYCLE, BOUNCE) + private int current = 1; // Current behavior; 1=move forward, -1=move backward + private int dx; + private int dy; // Direction of "forward" + public int count; + private int length; // Number of times the Graphix moves forward + private static int SIT = 0; + public static int CYCLE = 1; + public static int BOUNCE = 2; -public Graphix() {} + public Graphix() { + } -public Graphix(int X, int Y) - { - x=X; y=Y; - GenerateIcons(); - } + public Graphix(int X, int Y) { + x = X; + y = Y; + GenerateIcons(); + } -public Graphix(String file, int X, int Y) - { - filenames = new String[1]; - filenames[0] = new String(file); - behavior = SIT; - x=X; y=Y; - GenerateIcons(); - } + public Graphix(String file, int X, int Y) { + filenames = new String[1]; + filenames[0] = file; + behavior = SIT; + x = X; + y = Y; + GenerateIcons(); + } -public Graphix(String[] files, int X, int Y) - { - x=X; y=Y; - filenames = files; - behavior = SIT; - GenerateIcons(); - } + public Graphix(String[] files, int X, int Y) { + x = X; + y = Y; + filenames = files; + behavior = SIT; + GenerateIcons(); + } -public Graphix(String file, int X, int Y, int b, int DX, int DY, int L) - { - filenames = new String[1]; - filenames[0] = new String(file); - x=X; y=Y; - behavior = b; - dx=DX; dy=DY; - length = L; - GenerateIcons(); - } + public Graphix(String file, int X, int Y, int b, int DX, int DY, int L) { + filenames = new String[1]; + filenames[0] = file; + x = X; + y = Y; + behavior = b; + dx = DX; + dy = DY; + length = L; + GenerateIcons(); + } -public Graphix(String[] files, int X, int Y, int b, int DX, int DY, int L) - { - filenames = files; - x=X; y=Y; - behavior = b; - dx=DX; dy=DY; - length = L; - GenerateIcons(); - } + public Graphix(String[] files, int X, int Y, int b, int DX, int DY, int L) { + filenames = files; + x = X; + y = Y; + behavior = b; + dx = DX; + dy = DY; + length = L; + GenerateIcons(); + } -public void GenerateIcons() - { - int numfiles = filenames.length; - icons = new ImageIcon[numfiles]; - for (int a=0; a< numfiles; a++) - icons[a] = new ImageIcon("images/"+ filenames[a]); - icon = icons[0]; - } + public void GenerateIcons() { + int numfiles = filenames.length; + icons = new ImageIcon[numfiles]; + for (int a = 0; a < numfiles; a++) { + icons[a] = new ImageIcon("images/" + filenames[a]); + } + icon = icons[0]; + } -public void Draw(Graphics g, RoomDisplay rd) - { - if (icon != null) - g.drawImage(icon.getImage(), x, y, rd); - } + public void Draw(Graphics g, RoomDisplay rd) { + if (icon != null) { + g.drawImage(icon.getImage(), x, y, rd); + } + } -public void Animate() - { - int numfiles = filenames.length; - animationState++; - if (animationState==numfiles) - animationState=0; - icon = icons[animationState]; - if (behavior==CYCLE) - { - if (count==length) - { - x-=dx*length; - y-=dy*length; - count=0; - } - else - { - x+=dx; y+=dy; - count++; - } - } - if (behavior==BOUNCE) - if (current==1) - { - if (count==length) - current=-1; - else - { - x+=dx; y+=dy; - count++; - } - } - else - { - if (count==0) - current=1; - else - { - x-=dx; y-=dy; - count--; - } - } - } + public void Animate() { + int numfiles = filenames.length; + animationState++; + if (animationState == numfiles) { + animationState = 0; + } + icon = icons[animationState]; + if (behavior == CYCLE) { + if (count == length) { + x -= dx * length; + y -= dy * length; + count = 0; + } + else { + x += dx; + y += dy; + count++; + } + } + if (behavior == BOUNCE) { + if (current == 1) { + if (count == length) { + current = -1; + } + else { + x += dx; + y += dy; + count++; + } + } + else { + if (count == 0) { + current = 1; + } + else { + x -= dx; + y -= dy; + count--; + } + } + } + } } \ No newline at end of file diff --git a/src/com/droidquest/decorations/Spark.java b/src/com/droidquest/decorations/Spark.java index b3a99c6..4c8abd9 100644 --- a/src/com/droidquest/decorations/Spark.java +++ b/src/com/droidquest/decorations/Spark.java @@ -6,39 +6,43 @@ import java.io.Serializable; import com.droidquest.Room; -public class Spark implements Serializable -{ - public int x,y; - public int dx,dy; - public int age; - public Room room; +public class Spark implements Serializable { + public int x, y; + private int dx; + private int dy; + public int age; + public Room room; - public Spark() {} - public Spark(int X, int Y, int Dx, int Dy, Room r) - { - x=X; y=Y; - dx = Dx; dy= Dy; - room = r; - age=0; - } + public Spark(int X, int Y, int Dx, int Dy, Room r) { + x = X; + y = Y; + dx = Dx; + dy = Dy; + room = r; + age = 0; + } - public void Age() - { - x += dx; y+= dy; - if (x<0 || x>560 || y<0 || y>384) room=null; - age++; - } + public void Age() { + x += dx; + y += dy; + if (x < 0 || x > 560 || y < 0 || y > 384) { + room = null; + } + age++; + } - public void Draw(Graphics g) - { - if (age<2) - g.setColor(Color.white); - else if (age>=2 && age<4) - g.setColor(Color.yellow); - else - g.setColor(Color.red); - g.fillRect(x,y,2,2); - } + public void Draw(Graphics g) { + if (age < 2) { + g.setColor(Color.white); + } + else if (age >= 2 && age < 4) { + g.setColor(Color.yellow); + } + else { + g.setColor(Color.red); + } + g.fillRect(x, y, 2, 2); + } } diff --git a/src/com/droidquest/decorations/TextBox.java b/src/com/droidquest/decorations/TextBox.java index 19befb7..3c43e0c 100644 --- a/src/com/droidquest/decorations/TextBox.java +++ b/src/com/droidquest/decorations/TextBox.java @@ -2,26 +2,27 @@ package com.droidquest.decorations; import java.io.Serializable; -public class TextBox implements Serializable -{ -public String textString; -public int x; // Position -public int y; -public int width; // Size +public class TextBox implements Serializable { + public String textString; + public int x; // Position + public int y; + public int width; // Size -public TextBox() {} + public TextBox() { + } -public TextBox(String t, int X, int Y, int W) - { - textString = t; - x=X; y=Y; width=W; - } + public TextBox(String t, int X, int Y, int W) { + textString = t; + x = X; + y = Y; + width = W; + } -public TextBox(String t, int X, int Y) - { - textString = t; - x=X; y=Y; - width=500; - } + public TextBox(String t, int X, int Y) { + textString = t; + x = X; + y = Y; + width = 500; + } } \ No newline at end of file diff --git a/src/com/droidquest/devices/ANDGate.java b/src/com/droidquest/devices/ANDGate.java index 8018174..52421bb 100644 --- a/src/com/droidquest/devices/ANDGate.java +++ b/src/com/droidquest/devices/ANDGate.java @@ -1,181 +1,185 @@ package com.droidquest.devices; import java.awt.Color; -import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; import javax.swing.ImageIcon; import com.droidquest.Room; import com.droidquest.Wire; import com.droidquest.chipstuff.Port; -import com.droidquest.items.ToolBox; -public class ANDGate extends Device -{ -transient ImageIcon images[]; +public class ANDGate extends Device { + private transient ImageIcon[] images; -public ANDGate(int X, int Y, Room r) - { - x=X; y=Y; room =r; - width=28; height=50; - GenerateIcons(); - currentIcon = icons[rotation%2].getImage(); - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to ANDGate Image"); - return; - } - - } + public ANDGate(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 50; + GenerateIcons(); + currentIcon = icons[rotation % 2].getImage(); + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to ANDGate Image"); + } -public void Decorate() - { - super.Decorate(); - if (ports[0].value && ports[1].value) - g.drawImage(images[4+rotation].getImage(), 0, 0, level); - else - g.drawImage(images[rotation].getImage(), 0, 0, level); - } + } -public void GenerateIcons() - { - super.GenerateIcons(); - if (ports==null) - { - ports = new Port[3]; - ports[0] = new Port(7,47,Port.TYPE_INPUT,12,Port.ROT_DOWN,this); - ports[1] = new Port(23,43,Port.TYPE_INPUT,8,Port.ROT_DOWN,this); - ports[2] = new Port(12,2,Port.TYPE_OUTPUT,16,Port.ROT_UP,this); - if (rotation > 0) - { - int rot = rotation; - if (rotation%2==1) - { - int temp = width; - width = height; - height = temp; - } - rotation = 0; - for (int r=0; r 0) { + int rot = rotation; + if (rotation % 2 == 1) { + int temp = width; + width = height; + height = temp; + } + rotation = 0; + for (int r = 0; r < rot; r++) { + rotate(1); + } + } + } + goesInToolbox = true; + images = new ImageIcon[8]; + int w; + int h; + if (rotation % 2 == 0) { + w = width; + h = height; + } + else { + w = height; + h = width; + } + for (int v = 0; v < 2; v++) { + for (int r = 0; r < 4; r++) { + int a = r + v * 4; + if (r % 2 == 0) { + images[a] = new ImageIcon(new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR)); + } + else { + images[a] = new ImageIcon(new BufferedImage(h, w, BufferedImage.TYPE_4BYTE_ABGR)); + } + try { + g = images[a].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to Device Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); -public void flip() - { - Wire wire1 = ports[0].myWire; - Wire wire2 = ports[1].myWire; - if (wire1 != null) - { - if (wire1.fromPort == ports[0]) wire1.fromPort = ports[1]; - if (wire1.toPort == ports[0]) wire1.toPort = ports[1]; - if (wire1.inPort == ports[0]) wire1.inPort = ports[1]; - } - if (wire2 != null) - { - if (wire2.fromPort == ports[1]) wire2.fromPort = ports[0]; - if (wire2.toPort == ports[1]) wire2.toPort = ports[0]; - if (wire2.inPort == ports[1]) wire2.inPort = ports[0]; - } - ports[0].myWire = wire2; - ports[1].myWire = wire1; - } + if (v == 0) { + g.setColor(Color.white); + } + else { + g.setColor(new Color(255, 128, 0)); + } + switch (r) { + case 0: // Up + g.fillRect(8, 16, 12, 2); + g.fillRect(8, 16, 4, 4); + g.fillRect(16, 16, 4, 4); + g.fillRect(4, 18, 4, 6); + g.fillRect(20, 18, 4, 6); + g.fillRect(0, 22, 4, 12); + g.fillRect(24, 22, 4, 12); + g.fillRect(0, 32, 24, 2); + break; + case 1: // Right + g.fillRect(16, 0, 2, 28); + g.fillRect(16, 0, 12, 4); + g.fillRect(16, 24, 12, 4); + g.fillRect(26, 4, 6, 4); + g.fillRect(26, 20, 6, 4); + g.fillRect(30, 8, 4, 4); + g.fillRect(30, 16, 4, 4); + g.fillRect(32, 12, 2, 4); + break; + case 2: // Down + g.fillRect(0, 16, 28, 2); + g.fillRect(0, 16, 4, 12); + g.fillRect(24, 16, 4, 12); + g.fillRect(4, 26, 4, 6); + g.fillRect(20, 26, 4, 6); + g.fillRect(8, 30, 4, 4); + g.fillRect(16, 30, 4, 4); + g.fillRect(12, 32, 4, 2); + break; + case 3: // Left + g.fillRect(32, 0, 2, 28); + g.fillRect(22, 0, 12, 4); + g.fillRect(22, 24, 12, 4); + g.fillRect(18, 4, 6, 4); + g.fillRect(18, 20, 6, 4); + g.fillRect(16, 8, 4, 4); + g.fillRect(16, 16, 4, 4); + g.fillRect(16, 12, 2, 4); + break; + } + } + } + currentIcon = icons[rotation % 2].getImage(); + } + + public boolean Function() { + ports[2].value = ports[0].value & ports[1].value; + return false; + } + + public void flip() { + Wire wire1 = ports[0].myWire; + Wire wire2 = ports[1].myWire; + if (wire1 != null) { + if (wire1.fromPort == ports[0]) { + wire1.fromPort = ports[1]; + } + if (wire1.toPort == ports[0]) { + wire1.toPort = ports[1]; + } + if (wire1.inPort == ports[0]) { + wire1.inPort = ports[1]; + } + } + if (wire2 != null) { + if (wire2.fromPort == ports[1]) { + wire2.fromPort = ports[0]; + } + if (wire2.toPort == ports[1]) { + wire2.toPort = ports[0]; + } + if (wire2.inPort == ports[1]) { + wire2.inPort = ports[0]; + } + } + ports[0].myWire = wire2; + ports[1].myWire = wire1; + } } - + diff --git a/src/com/droidquest/devices/Antenna.java b/src/com/droidquest/devices/Antenna.java index 7897fdc..8440162 100644 --- a/src/com/droidquest/devices/Antenna.java +++ b/src/com/droidquest/devices/Antenna.java @@ -1,193 +1,182 @@ package com.droidquest.devices; -import java.awt.Color; -import java.awt.Dimension; +import com.droidquest.Room; +import com.droidquest.chipstuff.Port; +import com.droidquest.decorations.Spark; +import com.droidquest.items.GenericRobot; +import com.droidquest.levels.Level; + +import javax.swing.*; +import java.awt.*; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import javax.swing.ImageIcon; +public class Antenna extends Device { + public static int radio = 0; // One frequency that all Antennas use (robots) + private static int radio2 = 0; // Second frequency transmitted outside of robots. + private boolean oldRadio = false; // Was this radio transmitting last phase? + private Color color; + private transient GenericRobot robot; -import com.droidquest.items.GenericRobot; -import com.droidquest.Room; -import com.droidquest.chipstuff.Port; -import com.droidquest.decorations.Spark; -import com.droidquest.items.Item; + public Antenna(int X, int Y, Room r, Color col) { + x = X; + y = Y; + color = col; + width = 44; + height = 52; + room = r; + if (room.portalItem != null) { + if (room.portalItem.getClass().toString().endsWith("Robot")) { + robot = (GenericRobot) room.portalItem; + } + } + grabbable = false; + GenerateIcons(); + currentIcon = icons[0].getImage(); + } -public class Antenna extends Device -{ -public static int radio = 0; // One frequency that all Antennas use (robots) -public static int radio2 = 0; // Second frequency transmitted outside of robots. -private boolean oldRadio = false; // Was this radio transmitting last phase? -Color color; -transient GenericRobot robot; + public void writeRef(ObjectOutputStream s) throws IOException { + super.writeRef(s); + s.writeInt(level.items.indexOf(robot)); // Index of fromport device + } -public Antenna(int X, int Y, Room r, Color col) - { - x=X; y=Y; color= col; - width=44; height=52; - room = r; - if (room.portalItem!=null) - if (room.portalItem.getClass().toString().endsWith("Robot")) - robot = (GenericRobot) room.portalItem; - grabbable = false; - GenerateIcons(); - currentIcon = icons[0].getImage(); - } + public void readRef(ObjectInputStream s) throws IOException { + super.readRef(s); + robot = (GenericRobot) level.FindItem(s.readInt()); + } -public void writeRef(ObjectOutputStream s) throws IOException - { - super.writeRef(s); - s.writeInt(level.items.indexOf(robot)); // Index of fromport device - } + public void GenerateIcons() { + robot = (GenericRobot) room.portalItem; + radio = 0; + radio2 = 0; + if (ports == null) { + ports = new Port[2]; + ports[0] = new Port(39, 45, Port.TYPE_INPUT, 18, Port.ROT_DOWN, this); + ports[1] = new Port(11, 50, Port.TYPE_OUTPUT, 26, Port.ROT_DOWN, this); + } + else { + for (Port port : ports) { + port.myDevice = this; + } + } -public void readRef(ObjectInputStream s) throws IOException - { - super.readRef(s); - robot = (GenericRobot) level.FindItem(s.readInt()); - } + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + currentIcon = icons[0].getImage(); + } -public void GenerateIcons() - { - robot = (GenericRobot) room.portalItem; - radio=0; - radio2=0; - if (ports==null) - { - ports = new Port[2]; - ports[0] = new Port(39,45,Port.TYPE_INPUT,18,Port.ROT_DOWN,this); - ports[1] = new Port(11,50,Port.TYPE_OUTPUT,26,Port.ROT_DOWN,this); - } - else - for (int a=0; a 0) { + g.setColor(new Color(255, 128, 0)); + } + else { + g.setColor(color); + } + g.fillRect(18, 0, 14, 6); + g.fillRect(22, 6, 6, 16); + g.fillRect(8, 22, 32, 2); + if (ports[0].value && level.electricity) { + level.PlaySound(room, Level.BEEPSOUND); + } + } + } -public void Decorate() - { - super.Decorate(); - try - { - g = currentIcon.getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - if (robot!=null) - { - g.setColor(color); - g.fillRect(18,0,14,6); - g.fillRect(22,6,6,16); - g.fillRect(8,22,32,2); - } - else - { - if (radio2>0) - g.setColor(new Color(255,128,0)); - else - g.setColor(color); - g.fillRect(18,0,14,6); - g.fillRect(22,6,6,16); - g.fillRect(8,22,32,2); - if (ports[0].value && level.electricity) - level.PlaySound(room, level.BEEPSOUND); - } - } + public boolean Function() { + if (robot != null) { + if (radio < 0) { + radio = 0; + } -public boolean Function() - { - if (robot!=null) - { - if (radio<0) - radio=0; - - if (radio>0) - { - robot.antenna = true; - ports[1].value = true; - } - else - { - robot.antenna = false; - ports[1].value = false; - } - if (oldRadio != ports[0].value) - { - if (ports[0].value == true) - { - robot.broadcasting = true; - radio++; - } - else - { - robot.broadcasting = false; - radio--; - } - } - oldRadio = ports[0].value; - } - else - { - if (radio2<0) - radio2=0; - - if (radio2>0) - ports[1].value = true; - else - ports[1].value = false; - if (oldRadio != ports[0].value) - { - if (ports[0].value == true) - radio2++; - else - radio2--; - } - oldRadio = ports[0].value; - } - return false; - } + if (radio > 0) { + robot.antenna = true; + ports[1].value = true; + } + else { + robot.antenna = false; + ports[1].value = false; + } + if (oldRadio != ports[0].value) { + if (ports[0].value) { + robot.broadcasting = true; + radio++; + } + else { + robot.broadcasting = false; + radio--; + } + } + oldRadio = ports[0].value; + } + else { + if (radio2 < 0) { + radio2 = 0; + } -public void SetRoom(Room r) - { - if (oldRadio) - { - if (robot!=null) - radio--; - else - radio2--; - } - super.SetRoom(r); - robot=null; - if (room.portalItem!=null) - if (room.portalItem.getClass().toString().endsWith("Robot")) - robot = (GenericRobot) room.portalItem; - } + ports[1].value = radio2 > 0; + if (oldRadio != ports[0].value) { + if (ports[0].value) { + radio2++; + } + else { + radio2--; + } + } + oldRadio = ports[0].value; + } + return false; + } -public void Erase() - { - super.Erase(); - robot = null; - } + public void SetRoom(Room r) { + if (oldRadio) { + if (robot != null) { + radio--; + } + else { + radio2--; + } + } + super.SetRoom(r); + robot = null; + if (room.portalItem != null) { + if (room.portalItem.getClass().toString().endsWith("Robot")) { + robot = (GenericRobot) room.portalItem; + } + } + } + + public void Erase() { + super.Erase(); + robot = null; + } } \ No newline at end of file diff --git a/src/com/droidquest/devices/Bumper.java b/src/com/droidquest/devices/Bumper.java index a6c2611..4c332a8 100644 --- a/src/com/droidquest/devices/Bumper.java +++ b/src/com/droidquest/devices/Bumper.java @@ -1,241 +1,241 @@ package com.droidquest.devices; -import java.awt.Color; -import java.awt.Dimension; +import com.droidquest.Room; +import com.droidquest.chipstuff.Port; +import com.droidquest.items.GenericRobot; + +import javax.swing.*; +import java.awt.*; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import javax.swing.ImageIcon; +public class Bumper extends Device { + private int rotation; + private Color color; + private transient GenericRobot robot; -import com.droidquest.items.GenericRobot; -import com.droidquest.Room; -import com.droidquest.chipstuff.Port; + public Bumper(int X, int Y, Room r, int direction, Color col) { + x = X; + y = Y; + room = r; + if (room.portalItem != null) { + if (room.portalItem.getClass().toString().endsWith("Robot")) { + robot = (GenericRobot) room.portalItem; + } + } + rotation = direction; + color = col; + grabbable = false; + GenerateIcons(); + } -public class Bumper extends Device -{ -int rotation; -Color color; -transient GenericRobot robot; + public void writeRef(ObjectOutputStream s) throws IOException { + super.writeRef(s); + s.writeInt(level.items.indexOf(robot)); + } -public Bumper(int X, int Y , Room r, int direction, Color col) - { - x=X; y=Y; - room = r; - if (room.portalItem!=null) - if (room.portalItem.getClass().toString().endsWith("Robot")) - robot = (GenericRobot) room.portalItem; - rotation = direction; - color = col; - grabbable = false; - GenerateIcons(); - } + public void readRef(ObjectInputStream s) throws IOException { + super.readRef(s); + robot = (GenericRobot) level.FindItem(s.readInt()); + } -public void writeRef(ObjectOutputStream s) throws IOException - { - super.writeRef(s); - s.writeInt(level.items.indexOf(robot)); - } + public void GenerateIcons() { + robot = (GenericRobot) room.portalItem; + if (ports == null) { + ports = new Port[1]; + switch (rotation) { + case Port.ROT_UP: + width = 30; + height = 42; + ports[0] = new Port(16, 39, Port.TYPE_OUTPUT, 26, Port.ROT_DOWN, this); + break; -public void readRef(ObjectInputStream s) throws IOException - { - super.readRef(s); - robot = (GenericRobot) level.FindItem(s.readInt()); - } + case Port.ROT_RIGHT: + width = 54; + height = 24; + ports[0] = new Port(0, 13, Port.TYPE_OUTPUT, 42, Port.ROT_LEFT, this); + break; -public void GenerateIcons() - { - robot = (GenericRobot) room.portalItem; - if (ports==null) - { - ports = new Port[1]; - switch(rotation) - { - case Port.ROT_UP: - width=30; height=42; - ports[0] = new Port(16,39,Port.TYPE_OUTPUT,26,Port.ROT_DOWN,this); - break; - - case Port.ROT_RIGHT: - width=54; height=24; - ports[0] = new Port(0,13,Port.TYPE_OUTPUT,42,Port.ROT_LEFT,this); - break; - - case Port.ROT_DOWN: - width=30; height=38; - ports[0] = new Port(13,2,Port.TYPE_OUTPUT,22,Port.ROT_UP,this); - break; - - case Port.ROT_LEFT: - width=54; height=24; - ports[0] = new Port(52,10,Port.TYPE_OUTPUT,40,Port.ROT_RIGHT,this); - break; - } - } - else - for (int a=0; a=0 && a<19 && bigY>=0 && bigY<12) - if (robot.level.materialAt(a,bigY,robot.room).Detectable(robot)) - collide = true; - ports[0].value=collide; - robot.topBumper = collide; - } - break; - case Port.ROT_RIGHT: // Right Bumper - { - int bigX = (X+60)/28; - int bigYt = (Y+5) / 32; - int bigYb = (Y+36) / 32; - boolean collide = false; - for (int a=bigYt; a<=bigYb; a++) -// if (a>=0 && a<12 && bigX>=0 && bigX<20) - if (robot.level.materialAt(bigX,a,robot.room).Detectable(robot)) - collide = true; - ports[0].value=collide; - robot.rightBumper = collide; - } - break; - case Port.ROT_DOWN: // Bottom Bumper - { - int bigXl = (X+14) / 28; - int bigXr = (X+41) / 28; - int bigY = (Y+44)/32; - boolean collide = false; - for (int a=bigXl; a<=bigXr; a++) -// if (a>=0 && a<19 && bigY>=0 && bigY<12) - if (robot.level.materialAt(a,bigY,robot.room).Detectable(robot)) - collide = true; - ports[0].value=collide; - robot.bottomBumper = collide; - } - break; - case Port.ROT_LEFT: // Left Bumper - { - int bigX = (X-3) / 28; - int bigYt = (Y+5) / 32; - int bigYb = (Y+36) / 32; - boolean collide = false; - for (int a=bigYt; a<=bigYb; a++) -// if (a>=0 && a<12 && bigX>=0 && bigX<20) - if (robot.level.materialAt(bigX,a,robot.room).Detectable(robot)) - collide = true; - ports[0].value=collide; - robot.leftBumper = collide; - } - break; - } - - return false; - } + case Port.ROT_LEFT: + width = 54; + height = 24; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + break; + } + currentIcon = icons[0].getImage(); + } -public void Erase() - { - super.Erase(); - robot = null; - } + public void Decorate() { + super.Decorate(); + currentIcon = icons[0].getImage(); + try { + g = currentIcon.getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g.setColor(color); + switch (rotation) { + case Port.ROT_UP: // Thrusts Up, moves Down + g.fillRect(8, 0, 14, 4); + g.fillRect(4, 2, 6, 4); + g.fillRect(20, 2, 6, 4); + g.fillRect(0, 4, 6, 4); + g.fillRect(24, 4, 6, 4); + g.fillRect(12, 6, 6, 10); + break; + + case Port.ROT_RIGHT: // Thrusts Right, moves Left + g.fillRect(44, 6, 10, 12); + g.fillRect(40, 2, 10, 6); + g.fillRect(40, 16, 10, 6); + g.fillRect(36, 0, 10, 4); + g.fillRect(36, 20, 10, 4); + g.fillRect(32, 0, 14, 2); + g.fillRect(32, 22, 14, 2); + break; + + case Port.ROT_DOWN: // Thrusts Down, moves Up + g.fillRect(8, 34, 14, 4); + g.fillRect(4, 32, 6, 4); + g.fillRect(20, 32, 6, 4); + g.fillRect(0, 30, 6, 4); + g.fillRect(24, 30, 6, 4); + g.fillRect(12, 22, 6, 10); + break; + + case Port.ROT_LEFT: // Thrusts Left, moves Right + g.fillRect(0, 6, 10, 12); + g.fillRect(4, 2, 10, 6); + g.fillRect(4, 16, 10, 6); + g.fillRect(8, 0, 10, 4); + g.fillRect(8, 20, 10, 4); + g.fillRect(8, 0, 14, 2); + g.fillRect(8, 22, 14, 2); + g.fillRect(12, 10, 14, 4); + break; + } + } + + public boolean Function() { + // Check the walls on the sides of the GenericRobot and set the + // Port outputs and the bumper variables + + Dimension d = robot.GetXY(); + int X = d.width; + int Y = d.height; + + switch (rotation) { + case Port.ROT_UP: // Top Bumper + { + int bigXl = (X + 14) / 28; + int bigXr = (X + 41) / 28; + int bigY = (Y - 3) / 32; + boolean collide = false; + for (int a = bigXl; a <= bigXr; a++) { + if (robot.level.materialAt(a, bigY, robot.room).Detectable(robot)) { + collide = true; + } + } + ports[0].value = collide; + robot.topBumper = collide; + } + break; + case Port.ROT_RIGHT: // Right Bumper + { + int bigX = (X + 60) / 28; + int bigYt = (Y + 5) / 32; + int bigYb = (Y + 36) / 32; + boolean collide = false; + for (int a = bigYt; a <= bigYb; a++) { + if (robot.level.materialAt(bigX, a, robot.room).Detectable(robot)) { + collide = true; + } + } + ports[0].value = collide; + robot.rightBumper = collide; + } + break; + case Port.ROT_DOWN: // Bottom Bumper + { + int bigXl = (X + 14) / 28; + int bigXr = (X + 41) / 28; + int bigY = (Y + 44) / 32; + boolean collide = false; + for (int a = bigXl; a <= bigXr; a++) { + if (robot.level.materialAt(a, bigY, robot.room).Detectable(robot)) { + collide = true; + } + } + ports[0].value = collide; + robot.bottomBumper = collide; + } + break; + case Port.ROT_LEFT: // Left Bumper + { + int bigX = (X - 3) / 28; + int bigYt = (Y + 5) / 32; + int bigYb = (Y + 36) / 32; + boolean collide = false; + for (int a = bigYt; a <= bigYb; a++) { + if (robot.level.materialAt(bigX, a, robot.room).Detectable(robot)) { + collide = true; + } + } + ports[0].value = collide; + robot.leftBumper = collide; + } + break; + } + + return false; + } + + public void Erase() { + super.Erase(); + robot = null; + } } diff --git a/src/com/droidquest/devices/ChipText.java b/src/com/droidquest/devices/ChipText.java index 957ca6d..4188112 100644 --- a/src/com/droidquest/devices/ChipText.java +++ b/src/com/droidquest/devices/ChipText.java @@ -1,86 +1,72 @@ package com.droidquest.devices; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; +import javax.swing.*; +import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import javax.swing.JTextField; +public class ChipText extends JDialog { + private JTextArea textarea; + private JTextField textfield; + private GenericChip myChip; -public class ChipText extends JDialog -{ -JTextArea textarea; -JTextField textfield; -GenericChip myChip; + public ChipText(GenericChip gc) { + myChip = gc; + setModal(false); + Container contentPane = getContentPane(); + contentPane.setLayout(new BorderLayout()); + contentPane.setSize(new Dimension(250, 300)); -public ChipText(GenericChip gc) - { - myChip=gc; - setModal(false); - Container contentPane = getContentPane(); - contentPane.setLayout(new BorderLayout()); - contentPane.setSize(new Dimension(250,300)); - - textarea = new JTextArea("This is a test."); - textarea.setFont(new Font("Serif", Font.PLAIN, 16)); - textarea.setLineWrap(true); - textarea.setWrapStyleWord(true); - - JScrollPane scrollpane = new JScrollPane(textarea); - scrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - scrollpane.setPreferredSize(new Dimension(250,250)); - - JPanel buttonpanel = new JPanel(); - buttonpanel.setLayout(new FlowLayout()); - - JButton saveButton = new JButton("Save"); - JButton restoreButton = new JButton("Restore"); - - textfield = new JTextField(3); - - buttonpanel.add(saveButton); - buttonpanel.add(restoreButton); - buttonpanel.add(textfield); - - contentPane.add(buttonpanel, BorderLayout.NORTH); - contentPane.add(scrollpane, BorderLayout.CENTER); - pack(); - - saveButton.addMouseListener(new MouseAdapter() { - public void mouseReleased(MouseEvent e) { - myChip.description = textarea.getText(); - myChip.label = textfield.getText(); - myChip.GenerateIcons(); - } - }); - - restoreButton.addMouseListener(new MouseAdapter() { - public void mouseReleased(MouseEvent e) { - textarea.setText(myChip.description); - textfield.setText(myChip.label); - } - }); - - } + textarea = new JTextArea("This is a test."); + textarea.setFont(new Font("Serif", Font.PLAIN, 16)); + textarea.setLineWrap(true); + textarea.setWrapStyleWord(true); -public void setEditable(boolean editable) - { - textarea.setEditable(editable); - } + JScrollPane scrollPane = new JScrollPane(textarea); + scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + scrollPane.setPreferredSize(new Dimension(250, 250)); -public void setText(String text, String label) - { - textarea.setText(text); - textfield.setText(label); - } + JPanel buttonPanel = new JPanel(); + buttonPanel.setLayout(new FlowLayout()); + + JButton saveButton = new JButton("Save"); + JButton restoreButton = new JButton("Restore"); + + textfield = new JTextField(3); + + buttonPanel.add(saveButton); + buttonPanel.add(restoreButton); + buttonPanel.add(textfield); + + contentPane.add(buttonPanel, BorderLayout.NORTH); + contentPane.add(scrollPane, BorderLayout.CENTER); + pack(); + + saveButton.addMouseListener(new MouseAdapter() { + public void mouseReleased(MouseEvent e) { + myChip.description = textarea.getText(); + myChip.label = textfield.getText(); + myChip.GenerateIcons(); + } + }); + + restoreButton.addMouseListener(new MouseAdapter() { + public void mouseReleased(MouseEvent e) { + textarea.setText(myChip.description); + textfield.setText(myChip.label); + } + }); + + } + + public void setEditable(boolean editable) { + textarea.setEditable(editable); + } + + public void setText(String text, String label) { + textarea.setText(text); + textfield.setText(label); + } } \ No newline at end of file diff --git a/src/com/droidquest/devices/ContactSensor.java b/src/com/droidquest/devices/ContactSensor.java index 72c53dd..4d54daf 100644 --- a/src/com/droidquest/devices/ContactSensor.java +++ b/src/com/droidquest/devices/ContactSensor.java @@ -9,159 +9,151 @@ import com.droidquest.Room; import com.droidquest.chipstuff.Port; import com.droidquest.items.Item; -public class ContactSensor extends Device -{ -String targetClass; -Item target; -Dimension d1 = new Dimension(); // Output pointing Right, Left -Dimension d2 = new Dimension(); // Output pointing Up, Down +public class ContactSensor extends Device { + private String targetClass; + private Item target; + private Dimension d1 = new Dimension(); // Output pointing Right, Left + private Dimension d2 = new Dimension(); // Output pointing Up, Down -public ContactSensor(int X, int Y, Room r, Item item) - { - x=X; y=Y; room = r; - target = item; - editable=true; - targetClass = target.getClass().toString().substring(6); // Removes "class " - rotation = 1; // Right - d1.width = 28 + target.getWidth(); - d1.height = Math.max(target.getHeight(),12); - d2.width = Math.max(target.getWidth(),12); - d2.height = 28 + target.getHeight(); - width = d1.width; - height = d1.height; - GenerateIcons(); - } + public ContactSensor(int X, int Y, Room r, Item item) { + x = X; + y = Y; + room = r; + target = item; + editable = true; + targetClass = target.getClass().toString().substring(6); // Removes "class " + rotation = 1; // Right + d1.width = 28 + target.getWidth(); + d1.height = Math.max(target.getHeight(), 12); + d2.width = Math.max(target.getWidth(), 12); + d2.height = 28 + target.getHeight(); + width = d1.width; + height = d1.height; + GenerateIcons(); + } -public void GenerateIcons() - { - if (ports==null) - { - ports = new Port[1]; - ports[0] = new Port(width-2,height/2-2,Port.TYPE_OUTPUT,24,Port.ROT_UP,this); - if (rotation > 0) - { - int rot = rotation; - if (rotation%2==1) - { - int temp = width; - width = height; - height = temp; - } - rotation = 0; - for (int r=0; r 0) { + int rot = rotation; + if (rotation % 2 == 1) { + int temp = width; + width = height; + height = temp; + } + rotation = 0; + for (int r = 0; r < rot; r++) { + rotate(1); + } + } + } + icons = new ImageIcon[2]; + icons[0] = new ImageIcon(new BufferedImage(d2.width, d2.height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(d1.width, d1.height, BufferedImage.TYPE_4BYTE_ABGR)); + target.GenerateIcons(); + currentIcon = icons[rotation % 2].getImage(); + } -public boolean Function() - { - ports[0].value=false; - if (room.portalItem == null) - { - // Contact Sensor is not inside robot. - for (int a=0;a X + width) - { - ports[1].value=true; - a=level.items.size(); - } - if (item.y + item.getHeight() > Y + height) - { - ports[2].value=true; - a=level.items.size(); - } - if (item.x < X) - { - ports[3].value=true; - a=level.items.size(); - } - } - } - } - else - { - // Directional Sensor is inside Robot. - for (int a=0;a X + room.portalItem.getWidth()) - { - ports[1].value=true; - a=level.items.size(); - } - if (item.y + item.getHeight() > Y + room.portalItem.getHeight()) - { - ports[2].value=true; - a=level.items.size(); - } - if (item.x < X) - { - ports[3].value=true; - a=level.items.size(); - } - } - } - } - return false; - } + public void GenerateIcons() { + if (ports == null) { + ports = new Port[4]; + ports[0] = new Port(width / 2 - 4, 0, Port.TYPE_OUTPUT, 24, Port.ROT_UP, this); + ports[1] = new Port(width - 5, height / 2 - 4, Port.TYPE_OUTPUT, 24, Port.ROT_RIGHT, this); + ports[2] = new Port(width / 2 - 1, height - 4, Port.TYPE_OUTPUT, 24, Port.ROT_DOWN, this); + ports[3] = new Port(0, height / 2 - 1, Port.TYPE_OUTPUT, 24, Port.ROT_LEFT, this); + } + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + target.GenerateIcons(); + currentIcon = icons[rotation % 2].getImage(); + } -public void Decorate() - { - super.Decorate(); - g.setColor(Color.white); - g.drawRect(24,24,target.getWidth()+12, target.getHeight()+12); - g.drawRect(25,25,target.getWidth()+10, target.getHeight()+10); - g.drawImage(target.currentIcon, 30, 30, level); - } + public boolean Function() { + ports[0].value = false; + ports[1].value = false; + ports[2].value = false; + ports[3].value = false; + if (room.portalItem == null) { + // Directional Sensor is not inside robot. + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item.room == room && item.carriedBy == null) { + if (target.getClass().isInstance(item)) { + Dimension d = GetXY(); + int X = d.width; + int Y = d.height; + if (item.y < Y) { + ports[0].value = true; + a = level.items.size(); + } + if (item.x + item.getWidth() > X + width) { + ports[1].value = true; + a = level.items.size(); + } + if (item.y + item.getHeight() > Y + height) { + ports[2].value = true; + a = level.items.size(); + } + if (item.x < X) { + ports[3].value = true; + a = level.items.size(); + } + } + } + } + } + else { + // Directional Sensor is inside Robot. + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item.room == room.portalItem.room && item.carriedBy == null) { + if (target.getClass().isInstance(item)) { + Dimension d = room.portalItem.GetXY(); + int X = d.width; + int Y = d.height; + if (item.y < Y) { + ports[0].value = true; + a = level.items.size(); + } + if (item.x + item.getWidth() > X + room.portalItem.getWidth()) { + ports[1].value = true; + a = level.items.size(); + } + if (item.y + item.getHeight() > Y + room.portalItem.getHeight()) { + ports[2].value = true; + a = level.items.size(); + } + if (item.x < X) { + ports[3].value = true; + a = level.items.size(); + } + } + } + } + } + return false; + } -public void rotate(int dir) - { - // Does not Rotate! - } + public void Decorate() { + super.Decorate(); + g.setColor(Color.white); + g.drawRect(24, 24, target.getWidth() + 12, target.getHeight() + 12); + g.drawRect(25, 25, target.getWidth() + 10, target.getHeight() + 10); + g.drawImage(target.currentIcon, 30, 30, level); + } -public void Erase() - { - super.Erase(); - target = null; - } + public void rotate(int dir) { + // Does not Rotate! + } + + public void Erase() { + super.Erase(); + target = null; + } } diff --git a/src/com/droidquest/devices/FlipFlop.java b/src/com/droidquest/devices/FlipFlop.java index 4a0028c..322c14b 100644 --- a/src/com/droidquest/devices/FlipFlop.java +++ b/src/com/droidquest/devices/FlipFlop.java @@ -1,188 +1,201 @@ package com.droidquest.devices; -import com.droidquest.devices.Device; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.Wire; import com.droidquest.chipstuff.Port; -public class FlipFlop extends Device -{ -public boolean state; -public Color c1; -public Color c2; -public transient ImageIcon images[]; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; -public FlipFlop(int X, int Y, Room r) - { - x=X; y=Y; room =r; - width=48; height=32; - GenerateIcons(); - currentIcon = icons[rotation%2].getImage(); - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to ANDGate Image"); - return; - } - - } +public class FlipFlop extends Device { + public boolean state; + private Color c1; + private Color c2; + private transient ImageIcon[] images; -public void Decorate() - { - super.Decorate(); - if (!state) - g.drawImage(images[4+rotation].getImage(), 0, 0, level); - else - g.drawImage(images[rotation].getImage(), 0, 0, level); - } + public FlipFlop(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 48; + height = 32; + GenerateIcons(); + currentIcon = icons[rotation % 2].getImage(); + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to ANDGate Image"); + } -public void GenerateIcons() - { - super.GenerateIcons(); - if (ports==null) - { - ports = new Port[4]; - ports[0] = new Port(11,29,Port.TYPE_INPUT,6,Port.ROT_DOWN,this); - ports[1] = new Port(39,27,Port.TYPE_INPUT,4,Port.ROT_DOWN,this); - ports[2] = new Port(8,2,Port.TYPE_OUTPUT,8,Port.ROT_UP,this); - ports[3] = new Port(36,0,Port.TYPE_OUTPUT,10,Port.ROT_UP ,this); - if (rotation > 0) - { - int rot = rotation; - if (rotation%2==1) - { - int temp = width; - width = height; - height = temp; - } - rotation = 0; - for (int r=0; r 0) { + int rot = rotation; + if (rotation % 2 == 1) { + int temp = width; + width = height; + height = temp; + } + rotation = 0; + for (int r = 0; r < rot; r++) { + rotate(1); + } + } + } + goesInToolbox = true; + images = new ImageIcon[8]; + int w; + int h; + if (rotation % 2 == 0) { + w = width; + h = height; + } + else { + w = height; + h = width; + } + for (int v = 0; v < 2; v++) { + for (int r = 0; r < 4; r++) { + int a = r + v * 4; + if (r % 2 == 0) { + images[a] = new ImageIcon(new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR)); + } + else { + images[a] = new ImageIcon(new BufferedImage(h, w, BufferedImage.TYPE_4BYTE_ABGR)); + } + try { + g = images[a].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to Device Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + + if (v == 0) { + c1 = new Color(255, 128, 0); + c2 = Color.white; + } + else { + c1 = Color.white; + c2 = new Color(255, 128, 0); + } + switch (r) { + case 0: // Up + g.setColor(c1); + g.fillRect(0, 10, 24, 12); + g.setColor(c2); + g.fillRect(24, 10, 24, 12); + break; + case 1: // Right + g.setColor(c1); + g.fillRect(10, 0, 12, 24); + g.setColor(c2); + g.fillRect(10, 24, 12, 24); + break; + case 2: // Down + g.setColor(c2); + g.fillRect(0, 10, 24, 12); + g.setColor(c1); + g.fillRect(24, 10, 24, 12); + break; + case 3: // Left + g.setColor(c2); + g.fillRect(10, 0, 12, 24); + g.setColor(c1); + g.fillRect(10, 24, 12, 24); + break; + } + } + } + currentIcon = icons[rotation % 2].getImage(); + } + + public boolean Function() { + if (ports[0].value ^ ports[1].value) { + state = ports[0].value; + } + ports[2].value = state; + ports[3].value = !state; + return false; + } + + public void flip() { + Wire wire1 = ports[0].myWire; + Wire wire2 = ports[1].myWire; + Wire wire3 = ports[2].myWire; + Wire wire4 = ports[3].myWire; + if (wire1 != null) { + if (wire1.fromPort == ports[0]) { + wire1.fromPort = ports[1]; + } + if (wire1.toPort == ports[0]) { + wire1.toPort = ports[1]; + } + if (wire1.inPort == ports[0]) { + wire1.inPort = ports[1]; + } + } + if (wire2 != null) { + if (wire2.fromPort == ports[1]) { + wire2.fromPort = ports[0]; + } + if (wire2.toPort == ports[1]) { + wire2.toPort = ports[0]; + } + if (wire2.inPort == ports[1]) { + wire2.inPort = ports[0]; + } + } + if (wire3 != null) { + if (wire3.fromPort == ports[2]) { + wire3.fromPort = ports[3]; + } + if (wire3.toPort == ports[2]) { + wire3.toPort = ports[3]; + } + if (wire3.outPort == ports[2]) { + wire3.outPort = ports[3]; + } + } + if (wire4 != null) { + if (wire4.fromPort == ports[3]) { + wire4.fromPort = ports[2]; + } + if (wire4.toPort == ports[3]) { + wire4.toPort = ports[2]; + } + if (wire4.outPort == ports[3]) { + wire4.outPort = ports[2]; + } + } + ports[0].myWire = wire2; + ports[1].myWire = wire1; + ports[2].myWire = wire4; + ports[3].myWire = wire3; + state = !state; + } } diff --git a/src/com/droidquest/devices/GenericChip.java b/src/com/droidquest/devices/GenericChip.java index 4396501..1be69cd 100644 --- a/src/com/droidquest/devices/GenericChip.java +++ b/src/com/droidquest/devices/GenericChip.java @@ -1,30 +1,27 @@ package com.droidquest.devices; -public class GenericChip extends Device -{ -public String label; -public boolean inBurner; -public boolean inTester; -public String description="Chip Pinouts"; -public transient ChipText chiptext; +public class GenericChip extends Device { + public String label; + public boolean inBurner; + public boolean inTester; + public String description = "Chip Pinouts"; + private transient ChipText chiptext; -public GenericChip() {} + GenericChip() { + } -public void rotate(int dir) - { - // Does not Rotate! - } + public void rotate(int dir) { + // Does not Rotate! + } -public void ShowText(boolean editable) - { - if (chiptext==null) - { - chiptext = new ChipText(this); - chiptext.setTitle("Pinout for Chip " + label); - } - chiptext.setText(description,label); - chiptext.setEditable(editable); - chiptext.setVisible(true); - } + public void ShowText(boolean editable) { + if (chiptext == null) { + chiptext = new ChipText(this); + chiptext.setTitle("Pinout for Chip " + label); + } + chiptext.setText(description, label); + chiptext.setEditable(editable); + chiptext.setVisible(true); + } } diff --git a/src/com/droidquest/devices/Grabber.java b/src/com/droidquest/devices/Grabber.java index 5c57b47..196ae41 100644 --- a/src/com/droidquest/devices/Grabber.java +++ b/src/com/droidquest/devices/Grabber.java @@ -1,164 +1,148 @@ package com.droidquest.devices; -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.chipstuff.Port; import com.droidquest.items.GenericRobot; import com.droidquest.items.Item; -public class Grabber extends Device -{ -Color color; -transient GenericRobot robot; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; -public Grabber(int X, int Y, Room r, Color col) - { - x=X; y=Y; color= col; - width=40; height=48; - grabbable = false; - room = r; - if (room.portalItem!=null) - if (room.portalItem.getClass().toString().endsWith("Robot")) - robot = (GenericRobot) room.portalItem; - GenerateIcons(); - currentIcon = icons[0].getImage(); - } +public class Grabber extends Device { + private Color color; + private transient GenericRobot robot; -public void writeRef(ObjectOutputStream s) throws IOException - { - super.writeRef(s); - s.writeInt(level.items.indexOf(robot)); // Index of fromport device - } + public Grabber(int X, int Y, Room r, Color col) { + x = X; + y = Y; + color = col; + width = 40; + height = 48; + grabbable = false; + room = r; + if (room.portalItem != null) { + if (room.portalItem.getClass().toString().endsWith("Robot")) { + robot = (GenericRobot) room.portalItem; + } + } + GenerateIcons(); + currentIcon = icons[0].getImage(); + } -public void readRef(ObjectInputStream s) throws IOException - { - super.readRef(s); - robot = (GenericRobot) level.FindItem(s.readInt()); - } + public void writeRef(ObjectOutputStream s) throws IOException { + super.writeRef(s); + s.writeInt(level.items.indexOf(robot)); // Index of fromport device + } -public void GenerateIcons() - { - robot = (GenericRobot) room.portalItem; - if (ports==null) - { - ports = new Port[2]; - ports[0] = new Port(35,41,Port.TYPE_INPUT,16,Port.ROT_DOWN,this); - ports[1] = new Port(11,47,Port.TYPE_OUTPUT,26,Port.ROT_DOWN,this); - } - else - for (int a=0; a=28+robot.x && CY<21+robot.y) - { - // Move item to robot.x,robot.y - item.x = robot.x+60-item.getWidth()/2; - item.y = robot.y-9-item.getHeight()/2; - robot.grabber = Port.ROT_UP; - robot.PicksUp(item); - } + public void Decorate() { + super.Decorate(); + try { + g = currentIcon.getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g.setColor(color); + g.fillRect(24, 4, 4, 10); + g.fillRect(16, 4, 12, 2); + g.fillRect(16, 8, 12, 2); + g.fillRect(16, 2, 4, 10); + g.fillRect(12, 0, 4, 4); + g.fillRect(12, 10, 4, 4); + g.fillRect(4, 0, 12, 2); + g.fillRect(4, 12, 12, 2); + g.fillRect(4, 0, 4, 4); + g.fillRect(4, 10, 4, 4); + g.fillRect(0, 2, 4, 4); + g.fillRect(0, 8, 4, 4); + } - if (CX>=28+robot.x && CY>=21+robot.y) - { - // Move item to robot.x,robot.y - item.x = robot.x+66-item.getWidth()/2; - item.y = robot.y+41-item.getHeight()/2; - robot.grabber = Port.ROT_RIGHT; - robot.PicksUp(item); - } - - if (CX<28+robot.x && CY>=21+robot.y) - { - // Move item to robot.x,robot.y - item.x = robot.x+5-item.getWidth()/2; - item.y = robot.y+52-item.getHeight()/2; - robot.grabber = Port.ROT_DOWN; - robot.PicksUp(item); - } + public boolean Function() { + ports[1].value = robot.carrying != null; - if (CX<28+robot.x && CY<21+robot.y) - { - // Move item to robot.x,robot.y - item.x = robot.x-5-item.getWidth()/2; - item.y = robot.y+3-item.getHeight()/2; - robot.grabber = Port.ROT_LEFT; - robot.PicksUp(item); - } - - } - } - } - } - - return false; - } + if (!ports[0].value) { // Input Low + if (robot.carrying != null) { + robot.Drops(); + } + } + else { // Input High + if (robot.carrying == null) { + // Try and pick up something + Item item = robot.level.FindNearestItem(robot); + if (item != null) { + if (item.CanBePickedUp(robot) && item.carriedBy == null) { + int CX = item.x + item.getWidth() / 2; + int CY = item.y + item.getHeight() / 2; + if (CX >= 28 + robot.x && CY < 21 + robot.y) { + // Move item to robot.x,robot.y + item.x = robot.x + 60 - item.getWidth() / 2; + item.y = robot.y - 9 - item.getHeight() / 2; + robot.grabber = Port.ROT_UP; + robot.PicksUp(item); + } -public void Erase() - { - super.Erase(); - robot = null; - } + if (CX >= 28 + robot.x && CY >= 21 + robot.y) { + // Move item to robot.x,robot.y + item.x = robot.x + 66 - item.getWidth() / 2; + item.y = robot.y + 41 - item.getHeight() / 2; + robot.grabber = Port.ROT_RIGHT; + robot.PicksUp(item); + } + + if (CX < 28 + robot.x && CY >= 21 + robot.y) { + // Move item to robot.x,robot.y + item.x = robot.x + 5 - item.getWidth() / 2; + item.y = robot.y + 52 - item.getHeight() / 2; + robot.grabber = Port.ROT_DOWN; + robot.PicksUp(item); + } + + if (CX < 28 + robot.x && CY < 21 + robot.y) { + // Move item to robot.x,robot.y + item.x = robot.x - 5 - item.getWidth() / 2; + item.y = robot.y + 3 - item.getHeight() / 2; + robot.grabber = Port.ROT_LEFT; + robot.PicksUp(item); + } + + } + } + } + } + + return false; + } + + public void Erase() { + super.Erase(); + robot = null; + } } diff --git a/src/com/droidquest/devices/NOTGate.java b/src/com/droidquest/devices/NOTGate.java index bb35e6d..9171679 100644 --- a/src/com/droidquest/devices/NOTGate.java +++ b/src/com/droidquest/devices/NOTGate.java @@ -1,158 +1,157 @@ package com.droidquest.devices; -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.chipstuff.Port; -public class NOTGate extends Device -{ -transient ImageIcon images[]; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; -public NOTGate(int X, int Y, Room r) - { - x=X; y=Y; room =r; - width=28; height=50; - GenerateIcons(); - currentIcon = icons[rotation%2].getImage(); - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to ANDGate Image"); - return; - } - - } +public class NOTGate extends Device { + private transient ImageIcon[] images; -public void Decorate() - { - super.Decorate(); - if (!ports[0].value) - g.drawImage(images[4+rotation].getImage(), 0, 0, level); - else - g.drawImage(images[rotation].getImage(), 0, 0, level); - } + public NOTGate(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 50; + GenerateIcons(); + currentIcon = icons[rotation % 2].getImage(); + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to ANDGate Image"); + } + + } + + public void Decorate() { + super.Decorate(); + if (!ports[0].value) { + g.drawImage(images[4 + rotation].getImage(), 0, 0, level); + } + else { + g.drawImage(images[rotation].getImage(), 0, 0, level); + } + } + + public void GenerateIcons() { + super.GenerateIcons(); + if (ports == null) { + ports = new Port[2]; + ports[0] = new Port(15, 47, Port.TYPE_INPUT, 12, Port.ROT_DOWN, this); + ports[1] = new Port(12, 2, Port.TYPE_OUTPUT, 14, Port.ROT_UP, this); + if (rotation > 0) { + int rot = rotation; + if (rotation % 2 == 1) { + int temp = width; + width = height; + height = temp; + } + rotation = 0; + for (int r = 0; r < rot; r++) { + rotate(1); + } + } + } + goesInToolbox = true; + images = new ImageIcon[8]; + int w; + int h; + if (rotation % 2 == 0) { + w = width; + h = height; + } + else { + w = height; + h = width; + } + for (int v = 0; v < 2; v++) { + for (int r = 0; r < 4; r++) { + int a = r + v * 4; + if (r % 2 == 0) { + images[a] = new ImageIcon(new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR)); + } + else { + images[a] = new ImageIcon(new BufferedImage(h, w, BufferedImage.TYPE_4BYTE_ABGR)); + } + try { + g = images[a].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to Device Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + + if (v == 0) { + g.setColor(Color.white); + } + else { + g.setColor(new Color(255, 128, 0)); + } + switch (r) { + case 0: // Up + g.fillRect(8, 16, 4, 4); + g.fillRect(16, 16, 4, 4); + g.fillRect(12, 20, 4, 4); + g.fillRect(8, 22, 4, 4); + g.fillRect(16, 22, 4, 4); + g.fillRect(4, 26, 4, 4); + g.fillRect(20, 26, 4, 4); + g.fillRect(0, 30, 4, 4); + g.fillRect(24, 30, 4, 4); + g.fillRect(0, 32, 32, 2); + break; + case 1: // Right + g.fillRect(30, 8, 4, 4); + g.fillRect(30, 16, 4, 4); + g.fillRect(26, 12, 4, 4); + g.fillRect(24, 8, 4, 4); + g.fillRect(24, 16, 4, 4); + g.fillRect(20, 4, 4, 4); + g.fillRect(20, 20, 4, 4); + g.fillRect(16, 0, 4, 4); + g.fillRect(16, 24, 4, 4); + g.fillRect(16, 0, 2, 32); + break; + case 2: // Down + g.fillRect(8, 30, 4, 4); + g.fillRect(16, 30, 4, 4); + g.fillRect(12, 26, 4, 4); + g.fillRect(8, 24, 4, 4); + g.fillRect(16, 24, 4, 4); + g.fillRect(4, 20, 4, 4); + g.fillRect(20, 20, 4, 4); + g.fillRect(0, 16, 4, 4); + g.fillRect(24, 16, 4, 4); + g.fillRect(0, 16, 32, 2); + break; + case 3: // Left + g.fillRect(16, 8, 4, 4); + g.fillRect(16, 16, 4, 4); + g.fillRect(20, 12, 4, 4); + g.fillRect(22, 8, 4, 4); + g.fillRect(22, 16, 4, 4); + g.fillRect(26, 4, 4, 4); + g.fillRect(26, 20, 4, 4); + g.fillRect(30, 0, 4, 4); + g.fillRect(30, 24, 4, 4); + g.fillRect(32, 0, 2, 32); + break; + } + } + } + currentIcon = icons[rotation % 2].getImage(); + } + + public boolean Function() { + ports[1].value = !ports[0].value; + return false; + } -public void GenerateIcons() - { - super.GenerateIcons(); - if (ports==null) - { - ports = new Port[2]; - ports[0] = new Port(15,47,Port.TYPE_INPUT,12,Port.ROT_DOWN,this); - ports[1] = new Port(12,2,Port.TYPE_OUTPUT,14,Port.ROT_UP,this); - if (rotation > 0) - { - int rot = rotation; - if (rotation%2==1) - { - int temp = width; - width = height; - height = temp; - } - rotation = 0; - for (int r=0; r 0) - { - int rot = rotation; - if (rotation%2==1) - { - int temp = width; - width = height; - height = temp; - } - rotation = 0; - for (int r=0; r 0) { + int rot = rotation; + if (rotation % 2 == 1) { + int temp = width; + width = height; + height = temp; + } + rotation = 0; + for (int r = 0; r < rot; r++) { + rotate(1); + } + } + } + goesInToolbox = true; + images = new ImageIcon[8]; + int w; + int h; + if (rotation % 2 == 0) { + w = width; + h = height; + } + else { + w = height; + h = width; + } + for (int v = 0; v < 2; v++) { + for (int r = 0; r < 4; r++) { + int a = r + v * 4; + if (r % 2 == 0) { + images[a] = new ImageIcon(new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR)); + } + else { + images[a] = new ImageIcon(new BufferedImage(h, w, BufferedImage.TYPE_4BYTE_ABGR)); + } + try { + g = images[a].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to Device Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + + if (v == 0) { + g.setColor(Color.white); + } + else { + g.setColor(new Color(255, 128, 0)); + } + switch (r) { + case 0: // Up + case 2: // Down + g.fillRect(12, 12, 12, 2); + g.fillRect(12, 18, 12, 2); + g.fillRect(12, 12, 4, 8); + g.fillRect(20, 12, 4, 8); + break; + case 1: // Right + case 3: // Left + g.fillRect(12, 12, 8, 4); + g.fillRect(12, 20, 8, 4); + g.fillRect(12, 12, 2, 12); + g.fillRect(18, 12, 2, 12); + break; + } + } + } + currentIcon = icons[rotation % 2].getImage(); + } + + public boolean Function() { + boolean oldValue = ports[1].value; + for (int a = 1; a < ports.length; a++) { + ports[a].value = ports[0].value; + } + return (ports[0].value != oldValue); + } + + public boolean isNode() { + return true; + } } diff --git a/src/com/droidquest/devices/ORGate.java b/src/com/droidquest/devices/ORGate.java index 4f3fdb1..e3ee2ee 100644 --- a/src/com/droidquest/devices/ORGate.java +++ b/src/com/droidquest/devices/ORGate.java @@ -10,180 +10,190 @@ import com.droidquest.Room; import com.droidquest.Wire; import com.droidquest.chipstuff.Port; -public class ORGate extends Device -{ -transient ImageIcon images[]; +public class ORGate extends Device { + private transient ImageIcon[] images; -public ORGate(int X, int Y, Room r) - { - x=X; y=Y; room =r; - width=28; height=50; - GenerateIcons(); - currentIcon = icons[rotation%2].getImage(); - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to ORGate Image"); - return; - } - - } + public ORGate(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 50; + GenerateIcons(); + currentIcon = icons[rotation % 2].getImage(); + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to ORGate Image"); + } -public void Decorate() - { - super.Decorate(); - if (ports[0].value || ports[1].value) - g.drawImage(images[4+rotation].getImage(), 0, 0, level); - else - g.drawImage(images[rotation].getImage(), 0, 0, level); - } + } -public void GenerateIcons() - { - super.GenerateIcons(); - if (ports==null) - { - ports = new Port[3]; - ports[0] = new Port(7,47,Port.TYPE_INPUT,12,Port.ROT_DOWN,this); - ports[1] = new Port(23,43,Port.TYPE_INPUT,8,Port.ROT_DOWN,this); - ports[2] = new Port(12,2,Port.TYPE_OUTPUT,16,Port.ROT_UP,this); - if (rotation > 0) - { - int rot = rotation; - if (rotation%2==1) - { - int temp = width; - width = height; - height = temp; - } - rotation = 0; - for (int r=0; r 0) { + int rot = rotation; + if (rotation % 2 == 1) { + int temp = width; + width = height; + height = temp; + } + rotation = 0; + for (int r = 0; r < rot; r++) { + rotate(1); + } + } + } + goesInToolbox = true; + images = new ImageIcon[8]; + int w; + int h; + if (rotation % 2 == 0) { + w = width; + h = height; + } + else { + w = height; + h = width; + } + for (int v = 0; v < 2; v++) { + for (int r = 0; r < 4; r++) { + int a = r + v * 4; + if (r % 2 == 0) { + images[a] = new ImageIcon(new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR)); + } + else { + images[a] = new ImageIcon(new BufferedImage(h, w, BufferedImage.TYPE_4BYTE_ABGR)); + } + try { + g = images[a].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to Device Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); -public void flip() - { - Wire wire1 = ports[0].myWire; - Wire wire2 = ports[1].myWire; - if (wire1 != null) - { - if (wire1.fromPort == ports[0]) wire1.fromPort = ports[1]; - if (wire1.toPort == ports[0]) wire1.toPort = ports[1]; - if (wire1.inPort == ports[0]) wire1.inPort = ports[1]; - } - if (wire2 != null) - { - if (wire2.fromPort == ports[1]) wire2.fromPort = ports[0]; - if (wire2.toPort == ports[1]) wire2.toPort = ports[0]; - if (wire2.inPort == ports[1]) wire2.inPort = ports[0]; - } - ports[0].myWire = wire2; - ports[1].myWire = wire1; - } + if (v == 0) { + g.setColor(Color.white); + } + else { + g.setColor(new Color(255, 128, 0)); + } + switch (r) { + case 0: // Up + g.fillRect(8, 16, 12, 2); + g.fillRect(8, 16, 4, 4); + g.fillRect(16, 16, 4, 4); + g.fillRect(4, 18, 4, 6); + g.fillRect(20, 18, 4, 6); + g.fillRect(0, 22, 4, 12); + g.fillRect(24, 22, 4, 12); + g.fillRect(0, 32, 8, 2); + g.fillRect(8, 30, 4, 2); + g.fillRect(12, 28, 4, 2); + g.fillRect(16, 30, 4, 2); + g.fillRect(20, 32, 8, 2); + + break; + case 1: // Right + g.fillRect(16, 0, 12, 4); + g.fillRect(16, 24, 12, 4); + g.fillRect(26, 4, 6, 4); + g.fillRect(26, 20, 6, 4); + g.fillRect(30, 8, 4, 4); + g.fillRect(30, 16, 4, 4); + g.fillRect(32, 12, 2, 4); + g.fillRect(16, 0, 2, 8); + g.fillRect(16, 20, 2, 8); + g.fillRect(18, 8, 2, 4); + g.fillRect(20, 12, 2, 4); + g.fillRect(18, 16, 2, 4); + break; + case 2: // Down + g.fillRect(0, 16, 4, 12); + g.fillRect(24, 16, 4, 12); + g.fillRect(4, 26, 4, 6); + g.fillRect(20, 26, 4, 6); + g.fillRect(8, 30, 4, 4); + g.fillRect(16, 30, 4, 4); + g.fillRect(12, 32, 4, 2); + g.fillRect(0, 16, 8, 2); + g.fillRect(20, 16, 8, 2); + g.fillRect(8, 18, 4, 2); + g.fillRect(12, 20, 4, 2); + g.fillRect(16, 18, 4, 2); + break; + case 3: // Left + g.fillRect(22, 0, 12, 4); + g.fillRect(22, 24, 12, 4); + g.fillRect(18, 4, 6, 4); + g.fillRect(18, 20, 6, 4); + g.fillRect(16, 8, 4, 4); + g.fillRect(16, 16, 4, 4); + g.fillRect(16, 12, 2, 4); + g.fillRect(32, 0, 2, 8); + g.fillRect(32, 20, 2, 8); + g.fillRect(30, 8, 2, 4); + g.fillRect(28, 12, 2, 4); + g.fillRect(30, 16, 2, 4); + break; + } + } + } + currentIcon = icons[rotation % 2].getImage(); + } + + public boolean Function() { + ports[2].value = ports[0].value | ports[1].value; + return false; + } + + public void flip() { + Wire wire1 = ports[0].myWire; + Wire wire2 = ports[1].myWire; + if (wire1 != null) { + if (wire1.fromPort == ports[0]) { + wire1.fromPort = ports[1]; + } + if (wire1.toPort == ports[0]) { + wire1.toPort = ports[1]; + } + if (wire1.inPort == ports[0]) { + wire1.inPort = ports[1]; + } + } + if (wire2 != null) { + if (wire2.fromPort == ports[1]) { + wire2.fromPort = ports[0]; + } + if (wire2.toPort == ports[1]) { + wire2.toPort = ports[0]; + } + if (wire2.inPort == ports[1]) { + wire2.inPort = ports[0]; + } + } + ports[0].myWire = wire2; + ports[1].myWire = wire1; + } } diff --git a/src/com/droidquest/devices/PortDevice.java b/src/com/droidquest/devices/PortDevice.java index f945dc8..a5e2c48 100644 --- a/src/com/droidquest/devices/PortDevice.java +++ b/src/com/droidquest/devices/PortDevice.java @@ -3,51 +3,47 @@ package com.droidquest.devices; import com.droidquest.Room; import com.droidquest.chipstuff.Port; -public class PortDevice extends Device -{ - // This is an invisible device which has a port sticking out of it. It's - // used inside the Prototype chip as well as in various spots inside the Tutorials. +public class PortDevice extends Device { + // This is an invisible device which has a port sticking out of it. It's + // used inside the Prototype chip as well as in various spots inside the Tutorials. - int type; - int size; + private int type; + private int size; - public boolean value=false; // Used for constants in Tutorials + public boolean value = false; // Used for constants in Tutorials - public PortDevice(int X, int Y, Room r, int s, int t) - { - x=X; y=Y; room = r; - type=t; size=s; - width = 20; - height = size+20; - grabbable=false; - GenerateIcons(); - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - } + public PortDevice(int X, int Y, Room r, int s, int t) { + x = X; + y = Y; + room = r; + type = t; + size = s; + width = 20; + height = size + 20; + grabbable = false; + GenerateIcons(); + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + } + } - public void GenerateIcons() - { - super.GenerateIcons(); - if (ports==null) - { - ports = new Port[1]; - ports[0] = new Port(8,8,type,size,Port.ROT_UP,this); - } - currentIcon = icons[rotation%2].getImage(); - } + public void GenerateIcons() { + super.GenerateIcons(); + if (ports == null) { + ports = new Port[1]; + ports[0] = new Port(8, 8, type, size, Port.ROT_UP, this); + } + currentIcon = icons[rotation % 2].getImage(); + } - public boolean Function() - { - if (value && ports[0].type == Port.TYPE_OUTPUT) - ports[0].value = true; - return false; - } + public boolean Function() { + if (value && ports[0].type == Port.TYPE_OUTPUT) { + ports[0].value = true; + } + return false; + } - } +} diff --git a/src/com/droidquest/devices/Prototype16Chip.java b/src/com/droidquest/devices/Prototype16Chip.java index 0e2fac1..f9cdf5a 100644 --- a/src/com/droidquest/devices/Prototype16Chip.java +++ b/src/com/droidquest/devices/Prototype16Chip.java @@ -1,276 +1,263 @@ package com.droidquest.devices; -import java.awt.Color; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.chipstuff.Port; import com.droidquest.items.Item; import com.droidquest.materials.ChipTrash; import com.droidquest.materials.Material; -public class Prototype16Chip extends GenericChip -{ -transient PortDevice portdevices[]; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; -public Prototype16Chip(int X, int Y, Room r) - { - x=X; y=Y; room =r; - width=40; height=40; +public class Prototype16Chip extends GenericChip { + private transient PortDevice[] portdevices; - GenerateIcons(); -// try -// { -// g = icons[0].getImage().getGraphics(); -// } -// catch (NullPointerException e) -// { -// System.out.println("Could not get Graphics pointer to PrototypeChip Image"); -// return; -// } - - InternalRoom = new Room(); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - InternalRoom.RoomArray = table; - Material mat1 = new Material(Color.blue, false, true); - level.materials.addElement(mat1); - int mat1Index = level.materials.size()-1; - for (int rY=0; rY<12; rY++) - for (int rX=0; rX<20; rX++) - if (InternalRoom.RoomArray[rY][rX]==1) InternalRoom.RoomArray[rY][rX] = mat1Index; - InternalRoom.GenerateArray(); - InternalRoom.portalItem = this; - level.rooms.addElement(InternalRoom); + public Prototype16Chip(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 40; + height = 40; - portdevices = new PortDevice[16]; - portdevices[0] = new PortDevice(16,2*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[1] = new PortDevice(16,4*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[2] = new PortDevice(16,7*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[3] = new PortDevice(16,9*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[4] = new PortDevice(4*28,320,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[5] = new PortDevice(7*28,320,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[6] = new PortDevice(12*28,320,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[7] = new PortDevice(15*28,320,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[8] = new PortDevice(500,9*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[9] = new PortDevice(500,7*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[10] = new PortDevice(500,4*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[11] = new PortDevice(500,2*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[12] = new PortDevice(15*28,12,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[13] = new PortDevice(12*28,12,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[14] = new PortDevice(7*28,12,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[15] = new PortDevice(4*28,12,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[0].rotate(1); - portdevices[1].rotate(1); - portdevices[2].rotate(1); - portdevices[3].rotate(1); - portdevices[8].rotate(-1); - portdevices[9].rotate(-1); - portdevices[10].rotate(-1); - portdevices[11].rotate(-1); - portdevices[12].rotate(1);portdevices[12].rotate(1); - portdevices[13].rotate(1);portdevices[13].rotate(1); - portdevices[14].rotate(1);portdevices[14].rotate(1); - portdevices[15].rotate(1);portdevices[15].rotate(1); + GenerateIcons(); - for (int a=0; a<16; a++) - level.items.addElement(portdevices[a]); - } + InternalRoom = new Room(); + InternalRoom.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + Material mat1 = new Material(Color.blue, false, true); + level.materials.addElement(mat1); + int mat1Index = level.materials.size() - 1; + for (int rY = 0; rY < 12; rY++) { + for (int rX = 0; rX < 20; rX++) { + if (InternalRoom.RoomArray[rY][rX] == 1) { + InternalRoom.RoomArray[rY][rX] = mat1Index; + } + } + } + InternalRoom.GenerateArray(); + InternalRoom.portalItem = this; + level.rooms.addElement(InternalRoom); -public void GenerateIcons() - { -// super.GenerateIcons(); - if (ports==null) - { - ports = new Port[16]; - ports[0] = new Port( 1, 8,Port.TYPE_UNDEFINED,0,Port.ROT_LEFT,this); - ports[1] = new Port( 1,16,Port.TYPE_UNDEFINED,0,Port.ROT_LEFT,this); - ports[2] = new Port( 1,24,Port.TYPE_UNDEFINED,0,Port.ROT_LEFT,this); - ports[3] = new Port( 1,32,Port.TYPE_UNDEFINED,0,Port.ROT_LEFT,this); - ports[4] = new Port( 8,38,Port.TYPE_UNDEFINED,0,Port.ROT_DOWN,this); - ports[5] = new Port(16,38,Port.TYPE_UNDEFINED,0,Port.ROT_DOWN,this); - ports[6] = new Port(24,38,Port.TYPE_UNDEFINED,0,Port.ROT_DOWN,this); - ports[7] = new Port(32,38,Port.TYPE_UNDEFINED,0,Port.ROT_DOWN,this); - ports[8] = new Port(38,31,Port.TYPE_UNDEFINED,0,Port.ROT_RIGHT,this); - ports[9] = new Port(38,23,Port.TYPE_UNDEFINED,0,Port.ROT_RIGHT,this); - ports[10] = new Port(38,15,Port.TYPE_UNDEFINED,0,Port.ROT_RIGHT,this); - ports[11] = new Port(38, 7,Port.TYPE_UNDEFINED,0,Port.ROT_RIGHT,this); - ports[12] = new Port(31, 1,Port.TYPE_UNDEFINED,0,Port.ROT_UP,this); - ports[13] = new Port(23, 1,Port.TYPE_UNDEFINED,0,Port.ROT_UP,this); - ports[14] = new Port(15, 1,Port.TYPE_UNDEFINED,0,Port.ROT_UP,this); - ports[15] = new Port( 7, 1,Port.TYPE_UNDEFINED,0,Port.ROT_UP,this); - } - icons = new ImageIcon[1]; - icons[0] = new ImageIcon( new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.blue); - g.fillRect(3,3,34,34); - g.fillRect(1,7,2,2); - g.fillRect(1,15,2,2); - g.fillRect(1,23,2,2); - g.fillRect(1,31,2,2); - g.fillRect(7,37,2,2); - g.fillRect(15,37,2,2); - g.fillRect(23,37,2,2); - g.fillRect(31,37,2,2); - g.fillRect(37,31,2,2); - g.fillRect(37,23,2,2); - g.fillRect(37,15,2,2); - g.fillRect(37,7,2,2); - g.fillRect(31,1,2,2); - g.fillRect(23,1,2,2); - g.fillRect(15,1,2,2); - g.fillRect(7,1,2,2); - g.setColor(Color.black); - if (label != null) - { - g.setColor(Color.black); - Font font = new Font("Courier",Font.BOLD, 20); - g.setFont(font); - FontMetrics fm = g.getFontMetrics(); - int X = fm.stringWidth(label); - g.drawString(label, 52-X/2, 32); - } - currentIcon = icons[0].getImage(); - } + portdevices = new PortDevice[16]; + portdevices[0] = new PortDevice(16, 2 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[1] = new PortDevice(16, 4 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[2] = new PortDevice(16, 7 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[3] = new PortDevice(16, 9 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[4] = new PortDevice(4 * 28, 320, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[5] = new PortDevice(7 * 28, 320, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[6] = new PortDevice(12 * 28, 320, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[7] = new PortDevice(15 * 28, 320, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[8] = new PortDevice(500, 9 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[9] = new PortDevice(500, 7 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[10] = new PortDevice(500, 4 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[11] = new PortDevice(500, 2 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[12] = new PortDevice(15 * 28, 12, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[13] = new PortDevice(12 * 28, 12, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[14] = new PortDevice(7 * 28, 12, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[15] = new PortDevice(4 * 28, 12, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[0].rotate(1); + portdevices[1].rotate(1); + portdevices[2].rotate(1); + portdevices[3].rotate(1); + portdevices[8].rotate(-1); + portdevices[9].rotate(-1); + portdevices[10].rotate(-1); + portdevices[11].rotate(-1); + portdevices[12].rotate(1); + portdevices[12].rotate(1); + portdevices[13].rotate(1); + portdevices[13].rotate(1); + portdevices[14].rotate(1); + portdevices[14].rotate(1); + portdevices[15].rotate(1); + portdevices[15].rotate(1); -public void Decorate() - {} + for (int a = 0; a < 16; a++) { + level.items.addElement(portdevices[a]); + } + } -public void writeRef(ObjectOutputStream s) throws IOException - { - super.writeRef(s); - for (int a=0; a<16; a++) - s.writeInt(level.items.indexOf(portdevices[a])); - } + public void GenerateIcons() { + if (ports == null) { + ports = new Port[16]; + ports[0] = new Port(1, 8, Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); + ports[1] = new Port(1, 16, Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); + ports[2] = new Port(1, 24, Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); + ports[3] = new Port(1, 32, Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); + ports[4] = new Port(8, 38, Port.TYPE_UNDEFINED, 0, Port.ROT_DOWN, this); + ports[5] = new Port(16, 38, Port.TYPE_UNDEFINED, 0, Port.ROT_DOWN, this); + ports[6] = new Port(24, 38, Port.TYPE_UNDEFINED, 0, Port.ROT_DOWN, this); + ports[7] = new Port(32, 38, Port.TYPE_UNDEFINED, 0, Port.ROT_DOWN, this); + ports[8] = new Port(38, 31, Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); + ports[9] = new Port(38, 23, Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); + ports[10] = new Port(38, 15, Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); + ports[11] = new Port(38, 7, Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); + ports[12] = new Port(31, 1, Port.TYPE_UNDEFINED, 0, Port.ROT_UP, this); + ports[13] = new Port(23, 1, Port.TYPE_UNDEFINED, 0, Port.ROT_UP, this); + ports[14] = new Port(15, 1, Port.TYPE_UNDEFINED, 0, Port.ROT_UP, this); + ports[15] = new Port(7, 1, Port.TYPE_UNDEFINED, 0, Port.ROT_UP, this); + } + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.blue); + g.fillRect(3, 3, 34, 34); + g.fillRect(1, 7, 2, 2); + g.fillRect(1, 15, 2, 2); + g.fillRect(1, 23, 2, 2); + g.fillRect(1, 31, 2, 2); + g.fillRect(7, 37, 2, 2); + g.fillRect(15, 37, 2, 2); + g.fillRect(23, 37, 2, 2); + g.fillRect(31, 37, 2, 2); + g.fillRect(37, 31, 2, 2); + g.fillRect(37, 23, 2, 2); + g.fillRect(37, 15, 2, 2); + g.fillRect(37, 7, 2, 2); + g.fillRect(31, 1, 2, 2); + g.fillRect(23, 1, 2, 2); + g.fillRect(15, 1, 2, 2); + g.fillRect(7, 1, 2, 2); + g.setColor(Color.black); + if (label != null) { + g.setColor(Color.black); + Font font = new Font("Courier", Font.BOLD, 20); + g.setFont(font); + FontMetrics fm = g.getFontMetrics(); + int X = fm.stringWidth(label); + g.drawString(label, 52 - X / 2, 32); + } + currentIcon = icons[0].getImage(); + } -public void readRef(ObjectInputStream s) throws IOException - { - super.readRef(s); - portdevices = new PortDevice[16]; - for (int a=0; a19) bigXr=19; - if (bigYb>11) bigYb=11; - - for (int a=bigYt; a<=bigYb; a++) - for (int b=bigXl; b<=bigXr; b++) - { - if (level.materials.elementAt(room.RoomArray[a][b]) instanceof ChipTrash) - { - SetRoom(null); - level.items.removeElement(this); - level.PlaySound(room,level.DISCHARGESOUND); - return; - } - } - } + public void writeRef(ObjectOutputStream s) throws IOException { + super.writeRef(s); + for (int a = 0; a < 16; a++) { + s.writeInt(level.items.indexOf(portdevices[a])); + } + } -public boolean Function() - { - // Transfer values bewteen the ports and the portdevices. - boolean changed = false; - for (int a = 0; a<16; a++) - { - Port outer = ports[a]; - Port inner = portdevices[a].ports[0]; - - if (outer.type == Port.TYPE_INPUT) - if (outer.value != inner.value) - { - changed=true; - inner.value = outer.value; - } - if (outer.type == Port.TYPE_OUTPUT) - if (outer.value != inner.value) - { - changed=true; - outer.value = inner.value; - } - - - if (outer.myWire==null && inner.myWire==null) - { - outer.type = Port.TYPE_UNDEFINED; - inner.type = Port.TYPE_UNDEFINED; - } - - if (outer.type == Port.TYPE_UNDEFINED) - { - if (inner.myWire != null) - { - if (inner.type == Port.TYPE_INPUT) - outer.type = Port.TYPE_OUTPUT; - else if (inner.type == Port.TYPE_OUTPUT) - outer.type = Port.TYPE_INPUT; - } - } - if (inner.type == Port.TYPE_UNDEFINED) - { - if (outer.myWire != null) - { - if (outer.type == Port.TYPE_INPUT) - inner.type = Port.TYPE_OUTPUT; - else if (outer.type == Port.TYPE_OUTPUT) - inner.type = Port.TYPE_INPUT; - } - } - - } - return changed; - } + public void readRef(ObjectInputStream s) throws IOException { + super.readRef(s); + portdevices = new PortDevice[16]; + for (int a = 0; a < ports.length; a++) { + Item item = level.FindItem(s.readInt()); + portdevices[a] = (PortDevice) item; + } + GenerateIcons(); + } -public void Erase() - { - super.Erase(); - for (int a=0; a 19) { + bigXr = 19; + } + if (bigYb > 11) { + bigYb = 11; + } + + for (int a = bigYt; a <= bigYb; a++) { + for (int b = bigXl; b <= bigXr; b++) { + if (level.materials.elementAt(room.RoomArray[a][b]) instanceof ChipTrash) { + SetRoom(null); + level.items.removeElement(this); + level.PlaySound(room, level.DISCHARGESOUND); + return; + } + } + } + } + + public boolean Function() { + // Transfer values between the ports and the portdevices. + boolean changed = false; + for (int a = 0; a < 16; a++) { + Port outer = ports[a]; + Port inner = portdevices[a].ports[0]; + + if (outer.type == Port.TYPE_INPUT) { + if (outer.value != inner.value) { + changed = true; + inner.value = outer.value; + } + } + if (outer.type == Port.TYPE_OUTPUT) { + if (outer.value != inner.value) { + changed = true; + outer.value = inner.value; + } + } + + + if (outer.myWire == null && inner.myWire == null) { + outer.type = Port.TYPE_UNDEFINED; + inner.type = Port.TYPE_UNDEFINED; + } + + if (outer.type == Port.TYPE_UNDEFINED) { + if (inner.myWire != null) { + if (inner.type == Port.TYPE_INPUT) { + outer.type = Port.TYPE_OUTPUT; + } + else if (inner.type == Port.TYPE_OUTPUT) { + outer.type = Port.TYPE_INPUT; + } + } + } + if (inner.type == Port.TYPE_UNDEFINED) { + if (outer.myWire != null) { + if (outer.type == Port.TYPE_INPUT) { + inner.type = Port.TYPE_OUTPUT; + } + else if (outer.type == Port.TYPE_OUTPUT) { + inner.type = Port.TYPE_INPUT; + } + } + } + + } + return changed; + } + + public void Erase() { + super.Erase(); + for (int a = 0; a < portdevices.length; a++) { + portdevices[a] = null; + } + } } diff --git a/src/com/droidquest/devices/Prototype32Chip.java b/src/com/droidquest/devices/Prototype32Chip.java index 5662cb6..ff0d05d 100644 --- a/src/com/droidquest/devices/Prototype32Chip.java +++ b/src/com/droidquest/devices/Prototype32Chip.java @@ -1,331 +1,314 @@ package com.droidquest.devices; -import java.awt.Color; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics2D; +import com.droidquest.Room; +import com.droidquest.chipstuff.Port; +import com.droidquest.items.Item; +import com.droidquest.levels.Level; +import com.droidquest.materials.ChipTrash; +import com.droidquest.materials.Material; + +import javax.swing.*; +import java.awt.*; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import javax.swing.ImageIcon; +public class Prototype32Chip extends GenericChip { + private transient PortDevice[] portdevices; -import com.droidquest.Room; -import com.droidquest.chipstuff.Port; -import com.droidquest.items.Item; -import com.droidquest.materials.ChipTrash; -import com.droidquest.materials.Material; + public Prototype32Chip(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 80; + height = 80; -public class Prototype32Chip extends GenericChip -{ -transient PortDevice portdevices[]; + GenerateIcons(); -public Prototype32Chip(int X, int Y, Room r) - { - x=X; y=Y; room =r; - width=80; height=80; + InternalRoom = new Room(); + InternalRoom.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + Material mat1 = new Material(Color.blue, false, true); + level.materials.addElement(mat1); + int mat1Index = level.materials.size() - 1; + for (int rY = 0; rY < 12; rY++) { + for (int rX = 0; rX < 20; rX++) { + if (InternalRoom.RoomArray[rY][rX] == 1) { + InternalRoom.RoomArray[rY][rX] = mat1Index; + } + } + } + InternalRoom.GenerateArray(); + InternalRoom.portalItem = this; + level.rooms.addElement(InternalRoom); - GenerateIcons(); -// try -// { -// g = icons[0].getImage().getGraphics(); -// } -// catch (NullPointerException e) -// { -// System.out.println("Could not get Graphics pointer to PrototypeChip Image"); -// return; -// } - - InternalRoom = new Room(); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - InternalRoom.RoomArray = table; - Material mat1 = new Material(Color.blue, false, true); - level.materials.addElement(mat1); - int mat1Index = level.materials.size()-1; - for (int rY=0; rY<12; rY++) - for (int rX=0; rX<20; rX++) - if (InternalRoom.RoomArray[rY][rX]==1) InternalRoom.RoomArray[rY][rX] = mat1Index; - InternalRoom.GenerateArray(); - InternalRoom.portalItem = this; - level.rooms.addElement(InternalRoom); + portdevices = new PortDevice[32]; + portdevices[0] = new PortDevice(16, 2 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[1] = new PortDevice(16, 3 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[2] = new PortDevice(16, 4 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[3] = new PortDevice(16, 5 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[4] = new PortDevice(16, 6 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[5] = new PortDevice(16, 7 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[6] = new PortDevice(16, 8 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[7] = new PortDevice(16, 9 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); - portdevices = new PortDevice[32]; - portdevices[0] = new PortDevice(16,2*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[1] = new PortDevice(16,3*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[2] = new PortDevice(16,4*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[3] = new PortDevice(16,5*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[4] = new PortDevice(16,6*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[5] = new PortDevice(16,7*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[6] = new PortDevice(16,8*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[7] = new PortDevice(16,9*32,InternalRoom,28,Port.TYPE_UNDEFINED); + portdevices[8] = new PortDevice(3 * 28, 320, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[9] = new PortDevice(5 * 28, 320, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[10] = new PortDevice(7 * 28, 320, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[11] = new PortDevice(9 * 28, 320, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[12] = new PortDevice(11 * 28, 320, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[13] = new PortDevice(13 * 28, 320, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[14] = new PortDevice(15 * 28, 320, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[15] = new PortDevice(17 * 28, 320, InternalRoom, 28, Port.TYPE_UNDEFINED); - portdevices[8] = new PortDevice(3*28,320,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[9] = new PortDevice(5*28,320,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[10] = new PortDevice(7*28,320,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[11] = new PortDevice(9*28,320,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[12] = new PortDevice(11*28,320,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[13] = new PortDevice(13*28,320,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[14] = new PortDevice(15*28,320,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[15] = new PortDevice(17*28,320,InternalRoom,28,Port.TYPE_UNDEFINED); + portdevices[16] = new PortDevice(500, 9 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[17] = new PortDevice(500, 8 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[18] = new PortDevice(500, 7 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[19] = new PortDevice(500, 6 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[20] = new PortDevice(500, 5 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[21] = new PortDevice(500, 4 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[22] = new PortDevice(500, 3 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[23] = new PortDevice(500, 2 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); - portdevices[16] = new PortDevice(500,9*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[17] = new PortDevice(500,8*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[18] = new PortDevice(500,7*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[19] = new PortDevice(500,6*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[20] = new PortDevice(500,5*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[21] = new PortDevice(500,4*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[22] = new PortDevice(500,3*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[23] = new PortDevice(500,2*32,InternalRoom,28,Port.TYPE_UNDEFINED); + portdevices[24] = new PortDevice(17 * 28, 12, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[25] = new PortDevice(15 * 28, 12, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[26] = new PortDevice(13 * 28, 12, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[27] = new PortDevice(11 * 28, 12, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[28] = new PortDevice(9 * 28, 12, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[29] = new PortDevice(7 * 28, 12, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[30] = new PortDevice(5 * 28, 12, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[31] = new PortDevice(3 * 28, 12, InternalRoom, 28, Port.TYPE_UNDEFINED); - portdevices[24] = new PortDevice(17*28,12,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[25] = new PortDevice(15*28,12,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[26] = new PortDevice(13*28,12,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[27] = new PortDevice(11*28,12,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[28] = new PortDevice(9*28,12,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[29] = new PortDevice(7*28,12,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[30] = new PortDevice(5*28,12,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[31] = new PortDevice(3*28,12,InternalRoom,28,Port.TYPE_UNDEFINED); + for (int a = 0; a < 8; a++) { + portdevices[a].rotate(1); + portdevices[a + 16].rotate(-1); + portdevices[a + 24].rotate(1); + portdevices[a + 24].rotate(1); + } - for (int a=0; a<8; a++) - { - portdevices[a].rotate(1); - portdevices[a+16].rotate(-1); - portdevices[a+24].rotate(1); - portdevices[a+24].rotate(1); - } + for (int a = 0; a < 32; a++) { + level.items.addElement(portdevices[a]); + } + } - for (int a=0; a<32; a++) - level.items.addElement(portdevices[a]); - } + public void GenerateIcons() { + if (ports == null) { + ports = new Port[32]; + ports[0] = new Port(1, 8, Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); + ports[1] = new Port(1, 16, Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); + ports[2] = new Port(1, 24, Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); + ports[3] = new Port(1, 32, Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); + ports[4] = new Port(1, 40, Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); + ports[5] = new Port(1, 48, Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); + ports[6] = new Port(1, 56, Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); + ports[7] = new Port(1, 64, Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); -public void GenerateIcons() - { -// super.GenerateIcons(); - if (ports==null) - { - ports = new Port[32]; - ports[0] = new Port( 1, 8,Port.TYPE_UNDEFINED,0,Port.ROT_LEFT,this); - ports[1] = new Port( 1,16,Port.TYPE_UNDEFINED,0,Port.ROT_LEFT,this); - ports[2] = new Port( 1,24,Port.TYPE_UNDEFINED,0,Port.ROT_LEFT,this); - ports[3] = new Port( 1,32,Port.TYPE_UNDEFINED,0,Port.ROT_LEFT,this); - ports[4] = new Port( 1,40,Port.TYPE_UNDEFINED,0,Port.ROT_LEFT,this); - ports[5] = new Port( 1,48,Port.TYPE_UNDEFINED,0,Port.ROT_LEFT,this); - ports[6] = new Port( 1,56,Port.TYPE_UNDEFINED,0,Port.ROT_LEFT,this); - ports[7] = new Port( 1,64,Port.TYPE_UNDEFINED,0,Port.ROT_LEFT,this); + ports[8] = new Port(8, 76, Port.TYPE_UNDEFINED, 0, Port.ROT_DOWN, this); + ports[9] = new Port(16, 76, Port.TYPE_UNDEFINED, 0, Port.ROT_DOWN, this); + ports[10] = new Port(24, 76, Port.TYPE_UNDEFINED, 0, Port.ROT_DOWN, this); + ports[11] = new Port(32, 76, Port.TYPE_UNDEFINED, 0, Port.ROT_DOWN, this); + ports[12] = new Port(40, 76, Port.TYPE_UNDEFINED, 0, Port.ROT_DOWN, this); + ports[13] = new Port(48, 76, Port.TYPE_UNDEFINED, 0, Port.ROT_DOWN, this); + ports[14] = new Port(56, 76, Port.TYPE_UNDEFINED, 0, Port.ROT_DOWN, this); + ports[15] = new Port(64, 76, Port.TYPE_UNDEFINED, 0, Port.ROT_DOWN, this); - ports[8] = new Port( 8,76,Port.TYPE_UNDEFINED,0,Port.ROT_DOWN,this); - ports[9] = new Port(16,76,Port.TYPE_UNDEFINED,0,Port.ROT_DOWN,this); - ports[10] = new Port(24,76,Port.TYPE_UNDEFINED,0,Port.ROT_DOWN,this); - ports[11] = new Port(32,76,Port.TYPE_UNDEFINED,0,Port.ROT_DOWN,this); - ports[12] = new Port(40,76,Port.TYPE_UNDEFINED,0,Port.ROT_DOWN,this); - ports[13] = new Port(48,76,Port.TYPE_UNDEFINED,0,Port.ROT_DOWN,this); - ports[14] = new Port(56,76,Port.TYPE_UNDEFINED,0,Port.ROT_DOWN,this); - ports[15] = new Port(64,76,Port.TYPE_UNDEFINED,0,Port.ROT_DOWN,this); - - ports[16] = new Port(76,63,Port.TYPE_UNDEFINED,0,Port.ROT_RIGHT,this); - ports[17] = new Port(76,55,Port.TYPE_UNDEFINED,0,Port.ROT_RIGHT,this); - ports[18] = new Port(76,47,Port.TYPE_UNDEFINED,0,Port.ROT_RIGHT,this); - ports[19] = new Port(76,39,Port.TYPE_UNDEFINED,0,Port.ROT_RIGHT,this); - ports[20] = new Port(76,31,Port.TYPE_UNDEFINED,0,Port.ROT_RIGHT,this); - ports[21] = new Port(76,23,Port.TYPE_UNDEFINED,0,Port.ROT_RIGHT,this); - ports[22] = new Port(76,15,Port.TYPE_UNDEFINED,0,Port.ROT_RIGHT,this); - ports[23] = new Port(76, 7,Port.TYPE_UNDEFINED,0,Port.ROT_RIGHT,this); - - ports[24] = new Port(63, 1,Port.TYPE_UNDEFINED,0,Port.ROT_UP,this); - ports[25] = new Port(55, 1,Port.TYPE_UNDEFINED,0,Port.ROT_UP,this); - ports[26] = new Port(47, 1,Port.TYPE_UNDEFINED,0,Port.ROT_UP,this); - ports[27] = new Port(39, 1,Port.TYPE_UNDEFINED,0,Port.ROT_UP,this); - ports[28] = new Port(31, 1,Port.TYPE_UNDEFINED,0,Port.ROT_UP,this); - ports[29] = new Port(23, 1,Port.TYPE_UNDEFINED,0,Port.ROT_UP,this); - ports[30] = new Port(15, 1,Port.TYPE_UNDEFINED,0,Port.ROT_UP,this); - ports[31] = new Port( 7, 1,Port.TYPE_UNDEFINED,0,Port.ROT_UP,this); - } - icons = new ImageIcon[1]; - icons[0] = new ImageIcon( new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.blue); - g.fillRect(3,3,72,72); - - g.fillRect(1,7,2,2); - g.fillRect(1,15,2,2); - g.fillRect(1,23,2,2); - g.fillRect(1,31,2,2); - g.fillRect(1,39,2,2); - g.fillRect(1,47,2,2); - g.fillRect(1,55,2,2); - g.fillRect(1,63,2,2); - - g.fillRect(7,75,2,2); - g.fillRect(15,75,2,2); - g.fillRect(23,75,2,2); - g.fillRect(31,75,2,2); - g.fillRect(39,75,2,2); - g.fillRect(47,75,2,2); - g.fillRect(55,75,2,2); - g.fillRect(63,75,2,2); - - g.fillRect(75,63,2,2); - g.fillRect(75,55,2,2); - g.fillRect(75,47,2,2); - g.fillRect(75,39,2,2); - g.fillRect(75,31,2,2); - g.fillRect(75,23,2,2); - g.fillRect(75,15,2,2); - g.fillRect(75,7,2,2); + ports[16] = new Port(76, 63, Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); + ports[17] = new Port(76, 55, Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); + ports[18] = new Port(76, 47, Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); + ports[19] = new Port(76, 39, Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); + ports[20] = new Port(76, 31, Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); + ports[21] = new Port(76, 23, Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); + ports[22] = new Port(76, 15, Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); + ports[23] = new Port(76, 7, Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); - g.fillRect(63,1,2,2); - g.fillRect(55,1,2,2); - g.fillRect(47,1,2,2); - g.fillRect(39,1,2,2); - g.fillRect(31,1,2,2); - g.fillRect(23,1,2,2); - g.fillRect(15,1,2,2); - g.fillRect(7,1,2,2); + ports[24] = new Port(63, 1, Port.TYPE_UNDEFINED, 0, Port.ROT_UP, this); + ports[25] = new Port(55, 1, Port.TYPE_UNDEFINED, 0, Port.ROT_UP, this); + ports[26] = new Port(47, 1, Port.TYPE_UNDEFINED, 0, Port.ROT_UP, this); + ports[27] = new Port(39, 1, Port.TYPE_UNDEFINED, 0, Port.ROT_UP, this); + ports[28] = new Port(31, 1, Port.TYPE_UNDEFINED, 0, Port.ROT_UP, this); + ports[29] = new Port(23, 1, Port.TYPE_UNDEFINED, 0, Port.ROT_UP, this); + ports[30] = new Port(15, 1, Port.TYPE_UNDEFINED, 0, Port.ROT_UP, this); + ports[31] = new Port(7, 1, Port.TYPE_UNDEFINED, 0, Port.ROT_UP, this); + } + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.blue); + g.fillRect(3, 3, 72, 72); - g.setColor(Color.black); - if (label != null) - { - g.setColor(Color.black); - Font font = new Font("Courier",Font.BOLD, 20); - g.setFont(font); - FontMetrics fm = g.getFontMetrics(); - int X = fm.stringWidth(label); - g.drawString(label, 52-X/2, 32); - } - currentIcon = icons[0].getImage(); - } + g.fillRect(1, 7, 2, 2); + g.fillRect(1, 15, 2, 2); + g.fillRect(1, 23, 2, 2); + g.fillRect(1, 31, 2, 2); + g.fillRect(1, 39, 2, 2); + g.fillRect(1, 47, 2, 2); + g.fillRect(1, 55, 2, 2); + g.fillRect(1, 63, 2, 2); -public void Decorate() - {} + g.fillRect(7, 75, 2, 2); + g.fillRect(15, 75, 2, 2); + g.fillRect(23, 75, 2, 2); + g.fillRect(31, 75, 2, 2); + g.fillRect(39, 75, 2, 2); + g.fillRect(47, 75, 2, 2); + g.fillRect(55, 75, 2, 2); + g.fillRect(63, 75, 2, 2); -public void writeRef(ObjectOutputStream s) throws IOException - { - super.writeRef(s); - for (int a=0; a<32; a++) - s.writeInt(level.items.indexOf(portdevices[a])); - } + g.fillRect(75, 63, 2, 2); + g.fillRect(75, 55, 2, 2); + g.fillRect(75, 47, 2, 2); + g.fillRect(75, 39, 2, 2); + g.fillRect(75, 31, 2, 2); + g.fillRect(75, 23, 2, 2); + g.fillRect(75, 15, 2, 2); + g.fillRect(75, 7, 2, 2); -public void readRef(ObjectInputStream s) throws IOException - { - super.readRef(s); - portdevices = new PortDevice[32]; - for (int a=0; a19) bigXr=19; - if (bigYb>11) bigYb=11; - - for (int a=bigYt; a<=bigYb; a++) - for (int b=bigXl; b<=bigXr; b++) - { - if (level.materials.elementAt(room.RoomArray[a][b]) instanceof ChipTrash) - { - SetRoom(null); - level.items.removeElement(this); - level.PlaySound(room,level.DISCHARGESOUND); - return; - } - } - } + public void Decorate() { + } -public void Erase() - { - super.Erase(); - for (int a=0; a 19) { + bigXr = 19; + } + if (bigYb > 11) { + bigYb = 11; + } + + for (int a = bigYt; a <= bigYb; a++) { + for (int b = bigXl; b <= bigXr; b++) { + if (level.materials.elementAt(room.RoomArray[a][b]) instanceof ChipTrash) { + SetRoom(null); + level.items.removeElement(this); + level.PlaySound(room, Level.DISCHARGESOUND); + return; + } + } + } + } + + public void Erase() { + super.Erase(); + for (int a = 0; a < portdevices.length; a++) { + portdevices[a] = null; + } + } } diff --git a/src/com/droidquest/devices/PrototypeChip.java b/src/com/droidquest/devices/PrototypeChip.java index 39efbc7..46de2e5 100644 --- a/src/com/droidquest/devices/PrototypeChip.java +++ b/src/com/droidquest/devices/PrototypeChip.java @@ -1,292 +1,273 @@ package com.droidquest.devices; -import java.awt.Color; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Rectangle; +import com.droidquest.Room; +import com.droidquest.chipstuff.Port; +import com.droidquest.items.Item; +import com.droidquest.levels.Level; +import com.droidquest.materials.Material; + +import javax.swing.*; +import java.awt.*; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import javax.swing.ImageIcon; +public class PrototypeChip extends GenericChip { + public transient PortDevice portdevices[]; -import com.droidquest.Room; -import com.droidquest.chipstuff.Port; -import com.droidquest.items.Item; -import com.droidquest.materials.Material; + public PrototypeChip(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 104; + height = 64; -public class PrototypeChip extends GenericChip -{ -public transient PortDevice portdevices[]; + GenerateIcons(); -public PrototypeChip(int X, int Y, Room r) - { - x=X; y=Y; room =r; - width=104; height=64; + InternalRoom = new Room(); + InternalRoom.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} + }; + Material mat1 = new Material(Color.blue, false, true); + level.materials.addElement(mat1); + int mat1Index = level.materials.size() - 1; + for (int rY = 0; rY < 12; rY++) { + for (int rX = 0; rX < 20; rX++) { + if (InternalRoom.RoomArray[rY][rX] == 1) { + InternalRoom.RoomArray[rY][rX] = mat1Index; + } + } + } + InternalRoom.GenerateArray(); + InternalRoom.portalItem = this; + level.rooms.addElement(InternalRoom); + InternalRoom.upRoom = null; + InternalRoom.downRoom = null; + InternalRoom.leftRoom = null; + InternalRoom.rightRoom = null; + leftPortal = new Rectangle(8, 12, 8, 10); + rightPortal = new Rectangle(64, 12, 8, 10); + upPortal = new Rectangle(36, -6, 8, 10); + downPortal = new Rectangle(36, 38, 8, 10); - GenerateIcons(); -// try -// { -// g = icons[0].getImage().getGraphics(); -// } -// catch (NullPointerException e) -// { -// System.out.println("Could not get Graphics pointer to PrototypeChip Image"); -// return; -// } - - InternalRoom = new Room(); - int[][] table = { - {1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1} - }; - InternalRoom.RoomArray = table; - Material mat1 = new Material(Color.blue, false, true); - level.materials.addElement(mat1); - int mat1Index = level.materials.size()-1; - for (int rY=0; rY<12; rY++) - for (int rX=0; rX<20; rX++) - if (InternalRoom.RoomArray[rY][rX]==1) InternalRoom.RoomArray[rY][rX] = mat1Index; - InternalRoom.GenerateArray(); - InternalRoom.portalItem = this; - level.rooms.addElement(InternalRoom); - InternalRoom.upRoom = null; - InternalRoom.downRoom = null; - InternalRoom.leftRoom = null; - InternalRoom.rightRoom = null; - leftPortal = new Rectangle (8,12,8,10); - rightPortal = new Rectangle (64,12,8,10); - upPortal = new Rectangle (36,-6,8,10); - downPortal = new Rectangle (36,38,8,10); + portdevices = new PortDevice[8]; + portdevices[0] = new PortDevice(16, 2 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[1] = new PortDevice(16, 4 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[2] = new PortDevice(16, 7 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[3] = new PortDevice(16, 9 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[4] = new PortDevice(500, 9 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[5] = new PortDevice(500, 7 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[6] = new PortDevice(500, 4 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[7] = new PortDevice(500, 2 * 32, InternalRoom, 28, Port.TYPE_UNDEFINED); + portdevices[0].rotate(1); + portdevices[1].rotate(1); + portdevices[2].rotate(1); + portdevices[3].rotate(1); + portdevices[4].rotate(-1); + portdevices[5].rotate(-1); + portdevices[6].rotate(-1); + portdevices[7].rotate(-1); - portdevices = new PortDevice[8]; - portdevices[0] = new PortDevice(16,2*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[1] = new PortDevice(16,4*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[2] = new PortDevice(16,7*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[3] = new PortDevice(16,9*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[4] = new PortDevice(500,9*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[5] = new PortDevice(500,7*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[6] = new PortDevice(500,4*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[7] = new PortDevice(500,2*32,InternalRoom,28,Port.TYPE_UNDEFINED); - portdevices[0].rotate(1); - portdevices[1].rotate(1); - portdevices[2].rotate(1); - portdevices[3].rotate(1); - portdevices[4].rotate(-1); - portdevices[5].rotate(-1); - portdevices[6].rotate(-1); - portdevices[7].rotate(-1); + for (int a = 0; a < 8; a++) { + level.items.addElement(portdevices[a]); + } + } - for (int a=0; a<8; a++) - level.items.addElement(portdevices[a]); - } - -public void GenerateIcons() - { + public void GenerateIcons() { // super.GenerateIcons(); - if (ports==null) - { - ports = new Port[8]; - ports[0] = new Port(12,9,Port.TYPE_UNDEFINED,16,Port.ROT_LEFT,this); - ports[1] = new Port(4,25,Port.TYPE_UNDEFINED,24,Port.ROT_LEFT,this); - ports[2] = new Port(4,41,Port.TYPE_UNDEFINED,24,Port.ROT_LEFT,this); - ports[3] = new Port(12,57,Port.TYPE_UNDEFINED,16,Port.ROT_LEFT,this); - ports[4] = new Port(91,54,Port.TYPE_UNDEFINED,16,Port.ROT_RIGHT,this); - ports[5] = new Port(99,38,Port.TYPE_UNDEFINED,24,Port.ROT_RIGHT,this); - ports[6] = new Port(99,22,Port.TYPE_UNDEFINED,24,Port.ROT_RIGHT,this); - ports[7] = new Port(91,6,Port.TYPE_UNDEFINED,16,Port.ROT_RIGHT,this); - } - icons = new ImageIcon[1]; - icons[0] = new ImageIcon( new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.blue); - g.fillRect(24,0,56,64); - g.setColor(Color.black); - g.fillRect(26,6,4,4); - if (label != null) - { - g.setColor(Color.black); - Font font = new Font("Courier",Font.BOLD, 20); - g.setFont(font); - FontMetrics fm = g.getFontMetrics(); - int X = fm.stringWidth(label); - g.drawString(label, 52-X/2, 32); - } - currentIcon = icons[0].getImage(); - } + if (ports == null) { + ports = new Port[8]; + ports[0] = new Port(12, 9, Port.TYPE_UNDEFINED, 16, Port.ROT_LEFT, this); + ports[1] = new Port(4, 25, Port.TYPE_UNDEFINED, 24, Port.ROT_LEFT, this); + ports[2] = new Port(4, 41, Port.TYPE_UNDEFINED, 24, Port.ROT_LEFT, this); + ports[3] = new Port(12, 57, Port.TYPE_UNDEFINED, 16, Port.ROT_LEFT, this); + ports[4] = new Port(91, 54, Port.TYPE_UNDEFINED, 16, Port.ROT_RIGHT, this); + ports[5] = new Port(99, 38, Port.TYPE_UNDEFINED, 24, Port.ROT_RIGHT, this); + ports[6] = new Port(99, 22, Port.TYPE_UNDEFINED, 24, Port.ROT_RIGHT, this); + ports[7] = new Port(91, 6, Port.TYPE_UNDEFINED, 16, Port.ROT_RIGHT, this); + } + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.blue); + g.fillRect(24, 0, 56, 64); + g.setColor(Color.black); + g.fillRect(26, 6, 4, 4); + if (label != null) { + g.setColor(Color.black); + Font font = new Font("Courier", Font.BOLD, 20); + g.setFont(font); + FontMetrics fm = g.getFontMetrics(); + int X = fm.stringWidth(label); + g.drawString(label, 52 - X / 2, 32); + } + currentIcon = icons[0].getImage(); + } -public void Animate() - { - try - { - g = currentIcon.getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - for (int a=0; a19) bigXr=19; - if (bigYb>11) bigYb=11; - - for (int a=bigYt; a<=bigYb; a++) - for (int b=bigXl; b<=bigXr; b++) - { - if (level.materials.elementAt(room.RoomArray[a][b]).getClass().toString().endsWith("PrototypeBurner")) - { - a=bigYb; b=bigXr; - x = 3*28+4; - y = 5*32+12; - inBurner=true; - } - if (level.materials.elementAt(room.RoomArray[a][b]).getClass().toString().endsWith("ChipTrash")) - { - level.items.removeElement(this); - level.PlaySound(room,level.DISCHARGESOUND); - } - if (level.materials.elementAt(room.RoomArray[a][b]).getClass().toString().endsWith("ChipTester")) - { - a=bigYb; b=bigXr; - x = 10*28-width/2; - y = 5*32-height/2; - inTester=true; - } - } - } + if (outer.type == Port.TYPE_INPUT) { + if (outer.value != inner.value) { + changed = true; + inner.value = outer.value; + } + } + if (outer.type == Port.TYPE_OUTPUT) { + if (outer.value != inner.value) { + changed = true; + outer.value = inner.value; + } + } -public void Erase() - { - super.Erase(); - for (int a=0; a 19) { + bigXr = 19; + } + if (bigYb > 11) { + bigYb = 11; + } + + for (int a = bigYt; a <= bigYb; a++) { + for (int b = bigXl; b <= bigXr; b++) { + if (level.materials.elementAt(room.RoomArray[a][b]).getClass().toString().endsWith("PrototypeBurner")) { + a = bigYb; + b = bigXr; + x = 3 * 28 + 4; + y = 5 * 32 + 12; + inBurner = true; + } + if (level.materials.elementAt(room.RoomArray[a][b]).getClass().toString().endsWith("ChipTrash")) { + level.items.removeElement(this); + level.PlaySound(room, Level.DISCHARGESOUND); + } + if (level.materials.elementAt(room.RoomArray[a][b]).getClass().toString().endsWith("ChipTester")) { + a = bigYb; + b = bigXr; + x = 10 * 28 - width / 2; + y = 5 * 32 - height / 2; + inTester = true; + } + } + } + } + + public void Erase() { + super.Erase(); + for (int a = 0; a < portdevices.length; a++) { + portdevices[a] = null; + } + } } \ No newline at end of file diff --git a/src/com/droidquest/devices/RoomSensor.java b/src/com/droidquest/devices/RoomSensor.java index b15814a..41d402b 100644 --- a/src/com/droidquest/devices/RoomSensor.java +++ b/src/com/droidquest/devices/RoomSensor.java @@ -10,167 +10,155 @@ import com.droidquest.Room; import com.droidquest.chipstuff.Port; import com.droidquest.items.Item; -public class RoomSensor extends Device -{ -String targetClass; -Item target; -Dimension d1 = new Dimension(); // Output pointing Right, Left -Dimension d2 = new Dimension(); // Output pointing Up, Down +public class RoomSensor extends Device { + private String targetClass; + private Item target; + private Dimension d1 = new Dimension(); // Output pointing Right, Left + private Dimension d2 = new Dimension(); // Output pointing Up, Down -public RoomSensor(int X, int Y, Room r, Item item) - { - x=X; y=Y; room = r; - target = item; - editable=true; - targetClass = target.getClass().toString().substring(6); // Removes "class " - rotation = 1; // Right - d1.width = 32 + target.getWidth(); - d1.height = Math.max(target.getHeight()+8,18); - d2.width = Math.max(target.getWidth()+8,18); - d2.height = 32 + target.getHeight(); - width = d1.width; - height = d1.height; - ports = new Port[1]; - ports[0] = new Port(width-2,height/2,Port.TYPE_OUTPUT,24,Port.ROT_UP,this); - icons = new ImageIcon[2]; - GenerateIcons(); - } + public RoomSensor(int X, int Y, Room r, Item item) { + x = X; + y = Y; + room = r; + target = item; + editable = true; + targetClass = target.getClass().toString().substring(6); // Removes "class " + rotation = 1; // Right + d1.width = 32 + target.getWidth(); + d1.height = Math.max(target.getHeight() + 8, 18); + d2.width = Math.max(target.getWidth() + 8, 18); + d2.height = 32 + target.getHeight(); + width = d1.width; + height = d1.height; + ports = new Port[1]; + ports[0] = new Port(width - 2, height / 2, Port.TYPE_OUTPUT, 24, Port.ROT_UP, this); + icons = new ImageIcon[2]; + GenerateIcons(); + } -public void GenerateIcons() - { - if (ports==null) - { - ports = new Port[1]; - ports[0] = new Port(width-2,height/2,Port.TYPE_OUTPUT,24,Port.ROT_UP,this); - if (rotation > 0) - { - int rot = rotation; - if (rotation%2==1) - { - int temp = width; - width = height; - height = temp; - } - rotation = 0; - for (int r=0; r 0) { + int rot = rotation; + if (rotation % 2 == 1) { + int temp = width; + width = height; + height = temp; + } + rotation = 0; + for (int r = 0; r < rot; r++) { + rotate(1); + } + } + } + icons = new ImageIcon[2]; + icons[0] = new ImageIcon(new BufferedImage(d2.width, d2.height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(d1.width, d1.height, BufferedImage.TYPE_4BYTE_ABGR)); + target.GenerateIcons(); + currentIcon = icons[rotation % 2].getImage(); + } -public boolean Function() - { - ports[0].value=false; - if (room.portalItem == null) - { - // Room Sensor is not inside robot. - for (int a=0;a signals = new Vector(); + public Vector gates = new Vector(); -public void GenerateIcons() - { - if (ports==null) - { - ports = new Port[8]; - ports[0] = new Port(0,3,Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); - ports[1] = new Port(0,11,Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); - ports[2] = new Port(0,19,Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); - ports[3] = new Port(0,27,Port.TYPE_UNDEFINED, 0, Port.ROT_LEFT, this); - ports[4] = new Port(25,26,Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); - ports[5] = new Port(25,18,Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); - ports[6] = new Port(25,10,Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); - ports[7] = new Port(25,2,Port.TYPE_UNDEFINED, 0, Port.ROT_RIGHT, this); - } - ChipText chiptext = new ChipText(this); - chiptext.setTitle("Pinout for Chip " + label); - if (portSignals == null) - { - portSignals = new PortSignal[8]; - for (int a=0; a<8; a++) - portSignals[a] = new PortSignal(); - } - icons = new ImageIcon[1]; - icons[0] = new ImageIcon( new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.blue); - g.fillRect(4,0,18,30); - g.fillRect(0,2,26,2); - g.fillRect(0,10,26,2); - g.fillRect(0,18,26,2); - g.fillRect(0,26,26,2); - g.setColor(Color.black); - Font font = new Font("Courier",Font.BOLD, 20); - g.setFont(font); - FontMetrics fm = g.getFontMetrics(); - label = String.valueOf(label.charAt(0)); - int X = fm.stringWidth(label); - g.drawString(label, 13-X/2, 22); - currentIcon = icons[0].getImage(); - } + public SmallChip(int X, int Y, Room r, String l) { + x = X; + y = Y; + room = r; + label = l; + width = 26; + height = 30; + speed = 1; + GenerateIcons(); + for (int a = 0; a < 8; a++) { + portSignals[a] = new PortSignal(); + } + } -public void writeRef(ObjectOutputStream s) throws IOException - { - super.writeRef(s); - for (int a=0; a<8; a++) - { - s.writeInt(signals.indexOf(portSignals[a].internalSignal)); - s.writeInt(portSignals[a].type); - } - for (int a=0; a=0) - portSignals[a].internalSignal = (Signal) signals.elementAt(portIndex); - portSignals[a].type = s.readInt(); - } - for (int a=0; a=0) - gate.portSignals[b].externalSignal = (Signal) signals.elementAt(sigIndex); - gate.portSignals[b].type = s.readInt(); - } - gate.readRef(s); - } - } + public void writeRef(ObjectOutputStream s) throws IOException { + super.writeRef(s); + for (int a = 0; a < 8; a++) { + s.writeInt(signals.indexOf(portSignals[a].internalSignal)); + s.writeInt(portSignals[a].type); + } + for (int a = 0; a < gates.size(); a++) { + Gate gate = gates.elementAt(a); + for (int b = 0; b < 8; b++) { + s.writeInt(signals.indexOf(gate.portSignals[b].externalSignal)); + s.writeInt(gate.portSignals[b].type); + } + gate.writeRef(s); + } + } -public void Decorate() - {} + public void readRef(ObjectInputStream s) throws IOException { + super.readRef(s); + GenerateIcons(); + for (int a = 0; a < 8; a++) { + int portIndex = s.readInt(); + if (portIndex >= 0) { + portSignals[a].internalSignal = signals.elementAt(portIndex); + } + portSignals[a].type = s.readInt(); + } + for (int a = 0; a < gates.size(); a++) { + Gate gate = gates.elementAt(a); + gate.portSignals = new PortSignal[8]; + for (int b = 0; b < 8; b++) { + gate.portSignals[b] = new PortSignal(); + int sigIndex = s.readInt(); + if (sigIndex >= 0) { + gate.portSignals[b].externalSignal = signals.elementAt(sigIndex); + } + gate.portSignals[b].type = s.readInt(); + } + gate.readRef(s); + } + } -public void IsDropped() - { - inBurner = false; - inTester = false; - int bigXl = (x)/28; - int bigXr = (x+width-1)/28; - int bigYt = (y)/32; - int bigYb = (y+height-1)/32; - - if (bigXr>19) bigXr=19; - if (bigYb>11) bigYb=11; - - for (int a=bigYt; a<=bigYb; a++) - for (int b=bigXl; b<=bigXr; b++) - { - if (room.MaterialArray[a][b] instanceof SmallChipBurner) - { - a=bigYb; b=bigXr; - x = 13*28 - width/2; - y = 8*32 - height/2; - inBurner=true; - ChipCompiler.chipSpeed = speed; - TextBox tb = (TextBox) room.textBoxes.elementAt(1); - tb.textString= speed + "x"; - return; - } - if (room.MaterialArray[a][b] instanceof ChipTrash) - { - SetRoom(null); // Cheap way to remove the wires; - level.items.removeElement(this); - level.PlaySound(room,level.DISCHARGESOUND); - return; - } - if (room.MaterialArray[a][b] instanceof ChipTester) - { - a=bigYb; b=bigXr; - x = 10*28-width/2; - y = 5*32-height/2; - inTester=true; - return; - } - } - } + public void Decorate() { + } -public boolean Function() - { - int a; - - for (int s=0; s 19) { + bigXr = 19; + } + if (bigYb > 11) { + bigYb = 11; + } - for (a=0; a<8; a++) - if (ports[a].type==Port.TYPE_OUTPUT) - if (portSignals[a].internalSignal != null) - ports[a].value=portSignals[a].internalSignal.Get(); - } - return false; - } + for (int a = bigYt; a <= bigYb; a++) { + for (int b = bigXl; b <= bigXr; b++) { + if (room.MaterialArray[a][b] instanceof SmallChipBurner) { + x = 13 * 28 - width / 2; + y = 8 * 32 - height / 2; + inBurner = true; + ChipCompiler.chipSpeed = speed; + TextBox tb = room.textBoxes.elementAt(1); + tb.textString = speed + "x"; + return; + } + if (room.MaterialArray[a][b] instanceof ChipTrash) { + SetRoom(null); // Cheap way to remove the wires; + level.items.removeElement(this); + level.PlaySound(room, Level.DISCHARGESOUND); + return; + } + if (room.MaterialArray[a][b] instanceof ChipTester) { + x = 10 * 28 - width / 2; + y = 5 * 32 - height / 2; + inTester = true; + return; + } + } + } + } -public void Erase() - { - super.Erase(); - portSignals = null; - signals = null; - gates = null; - } + public boolean Function() { + int a; -public void Empty() - { - if (signals != null) - signals.removeAllElements(); - signals = new Vector(); - if (gates != null) - gates.removeAllElements(); - gates = new Vector(); - if (portSignals == null) - { - portSignals = new PortSignal[8]; - for (int a=0; a<8; a++) - portSignals[a] = new PortSignal(); - } - for (int a=0; a<8; a++) - { - portSignals[a].externalSignal = null; - portSignals[a].internalSignal = null; - portSignals[a].type = Port.TYPE_UNDEFINED; - } - } + for (int s = 0; s < speed; s++) { + for (a = 0; a < signals.size(); a++) { + signals.elementAt(a).Flip(); + } -public void LoadChip(String filename) - { - try - { - FileInputStream in = new FileInputStream(filename); - ObjectInputStream s = new ObjectInputStream(in); - - // Signals - int numSignals = s.readInt(); - signals = new Vector(); - for (int a=0; a=0) - gate.portSignals[b].externalSignal = (Signal) signals.elementAt(sigIndex); - gate.portSignals[b].type = s.readInt(); - } - if (gate.type.equalsIgnoreCase("Chip")) - gate.LoadSubGate(s); - } - - // PortSignals - for (int a=0; a<8; a++) - { - int sigIndex = s.readInt(); - if (sigIndex>=0) - portSignals[a].internalSignal = (Signal) signals.elementAt(sigIndex); - ports[a].type = s.readInt(); - portSignals[a].type = ports[a].type; - } - - // Description - description = (String) s.readObject(); - - // Speed - speed = s.readInt(); - - s.close(); - in.close(); - } - catch (ClassNotFoundException e) {} - catch (FileNotFoundException e) - { - System.out.println("File Not Found"); - return; - } - catch (IOException e) - { - System.out.println("IO Exception"); - System.out.println(e.getMessage()); - e.printStackTrace(); - return; - } - - // Debug report -// System.out.println(signals.size() + " Signals"); -// System.out.println(gates.size() + " Gates"); -// for(int a=0; a(); + if (gates != null) { + gates.removeAllElements(); + } + gates = new Vector(); + if (portSignals == null) { + portSignals = new PortSignal[8]; + for (int a = 0; a < 8; a++) { + portSignals[a] = new PortSignal(); + } + } + for (int a = 0; a < 8; a++) { + portSignals[a].externalSignal = null; + portSignals[a].internalSignal = null; + portSignals[a].type = Port.TYPE_UNDEFINED; + } + } + + public void LoadChip(String filename) { + try { + FileInputStream in = new FileInputStream(filename); + ObjectInputStream s = new ObjectInputStream(in); + + // Signals + int numSignals = s.readInt(); + signals = new Vector(); + for (int a = 0; a < numSignals; a++) { + Signal sig = new Signal(); + sig.Set(s.readBoolean()); + sig.working = s.readBoolean(); + signals.addElement(sig); + } + + // Gates + int numGates = s.readInt(); + gates = new Vector(); + for (int a = 0; a < numGates; a++) { + Gate gate = new Gate((String) s.readObject()); + gates.addElement(gate); + gate.state = s.readBoolean(); + for (int b = 0; b < 8; b++) { + int sigIndex = s.readInt(); + if (sigIndex >= 0) { + gate.portSignals[b].externalSignal = signals.elementAt(sigIndex); + } + gate.portSignals[b].type = s.readInt(); + } + if (gate.type.equalsIgnoreCase("Chip")) { + gate.LoadSubGate(s); + } + } + + // PortSignals + for (int a = 0; a < 8; a++) { + int sigIndex = s.readInt(); + if (sigIndex >= 0) { + portSignals[a].internalSignal = signals.elementAt(sigIndex); + } + ports[a].type = s.readInt(); + portSignals[a].type = ports[a].type; + } + + // Description + description = (String) s.readObject(); + + // Speed + speed = s.readInt(); + + s.close(); + in.close(); + } + catch (ClassNotFoundException e) { + } + catch (FileNotFoundException e) { + System.out.println("File Not Found"); + return; + } + catch (IOException e) { + System.out.println("IO Exception"); + System.out.println(e.getMessage()); + e.printStackTrace(); + return; + } + + for (int a = 0; a < 8; a++) { + if (ports[a].myWire != null) { + Wire wire = ports[a].myWire; + if (wire.fromPort == ports[a]) { + if (wire.toPort.type == ports[a].type) { + wire.Remove(); + } + } + else if (wire.toPort == ports[a]) { + if (wire.fromPort.type == ports[a].type) { + wire.Remove(); + } + } + } + } + } + + public void SaveChip(String filename) { + try { + FileOutputStream out = new FileOutputStream(filename); + ObjectOutputStream s = new ObjectOutputStream(out); + + // Signals + s.writeInt(signals.size()); + for (int a = 0; a < signals.size(); a++) { + Signal sig = signals.elementAt(a); + s.writeBoolean(sig.Get()); + s.writeBoolean(sig.working); + } + + // Gates + s.writeInt(gates.size()); + for (int a = 0; a < gates.size(); a++) { + Gate gate = gates.elementAt(a); + s.writeObject(gate.type); + s.writeBoolean(gate.state); + for (int b = 0; b < 8; b++) { + s.writeInt(signals.indexOf(gate.portSignals[b].externalSignal)); + s.writeInt(gate.portSignals[b].type); + } + if (gate.type.equalsIgnoreCase("Chip")) { + gate.SaveSubGate(s); + } + } + // PortSignals + for (int a = 0; a < 8; a++) { + s.writeInt(signals.indexOf(portSignals[a].internalSignal)); + s.writeInt(ports[a].type); + } + + // Description + s.writeObject(description); + + // Speed + s.writeInt(speed); + + s.flush(); + s.close(); + out.close(); + } + catch (FileNotFoundException e) { + System.out.println("File Not Found"); + } + catch (IOException e) { + System.out.println("IO Exception"); + System.out.println(e.getMessage()); + } + + } } diff --git a/src/com/droidquest/devices/StormShield.java b/src/com/droidquest/devices/StormShield.java index 6f8b43f..3bc2e04 100644 --- a/src/com/droidquest/devices/StormShield.java +++ b/src/com/droidquest/devices/StormShield.java @@ -1,93 +1,84 @@ package com.droidquest.devices; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.chipstuff.Port; -public class StormShield extends Device -{ -public StormShield(int X, int Y, Room r) - { - x=X; y=Y; room = r; - width=28; height=52; - GenerateIcons(); - } +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; -public void GenerateIcons() - { - super.GenerateIcons(); - if (ports==null) - { - ports = new Port[1]; - ports[0] = new Port(15,49,Port.TYPE_INPUT, 22, Port.ROT_DOWN, this); - } - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.white); - g.fillRect(16,0,4,2); - g.fillRect(4,2,4,2); - g.fillRect(12,4,4,2); - g.fillRect(20,4,4,2); - g.fillRect(4,8,4,2); - g.fillRect(12,8,4,2); - g.fillRect(24,8,4,2); - g.fillRect(0,10,4,2); - g.fillRect(8,10,4,2); - g.fillRect(16,10,4,2); - g.fillRect(24,12,4,2); - g.fillRect(8,14,4,2); - g.fillRect(16,14,4,2); - g.fillRect(0,18,4,2); - g.fillRect(12,18,4,2); - g.fillRect(24,18,4,2); - g.fillRect(16,20,4,2); - g.fillRect(4,22,4,2); - g.fillRect(20,22,4,2); - g.fillRect(8,24,4,2); - g.fillRect(16,24,4,2); - currentIcon = icons[0].getImage(); - } +public class StormShield extends Device { + public StormShield(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 52; + GenerateIcons(); + } -public void Decorate() - { - try - { - g = currentIcon.getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to Device Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - for (int a=0; a 0) - { - int rot = rotation; - if (rotation%2==1) - { - int temp = width; - width = height; - height = temp; - } - rotation = 0; - for (int r=0; r 0) { + int rot = rotation; + if (rotation % 2 == 1) { + int temp = width; + width = height; + height = temp; + } + rotation = 0; + for (int r = 0; r < rot; r++) { + rotate(1); + } + } + } + goesInToolbox = true; + images = new ImageIcon[8]; + int w; + int h; + if (rotation % 2 == 0) { + w = width; + h = height; + } + else { + w = height; + h = width; + } + for (int v = 0; v < 2; v++) { + for (int r = 0; r < 4; r++) { + int a = r + v * 4; + if (r % 2 == 0) { + images[a] = new ImageIcon(new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR)); + } + else { + images[a] = new ImageIcon(new BufferedImage(h, w, BufferedImage.TYPE_4BYTE_ABGR)); + } + try { + g = images[a].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to Device Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + + if (v == 0) { + g.setColor(Color.white); + } + else { + g.setColor(new Color(255, 128, 0)); + } + switch (r) { + case 0: // Up + g.fillRect(8, 18, 12, 2); + g.fillRect(8, 18, 4, 4); + g.fillRect(16, 18, 4, 4); + g.fillRect(4, 20, 4, 6); + g.fillRect(20, 20, 4, 6); + g.fillRect(0, 24, 4, 10); + g.fillRect(24, 24, 4, 10); + g.fillRect(4, 30, 4, 2); + g.fillRect(20, 30, 4, 2); + g.fillRect(8, 32, 12, 2); + g.fillRect(8, 28, 12, 2); + break; + case 1: // Right + g.fillRect(16, 0, 10, 4); + g.fillRect(16, 24, 10, 4); + g.fillRect(24, 4, 6, 4); + g.fillRect(24, 20, 6, 4); + g.fillRect(28, 8, 4, 4); + g.fillRect(28, 16, 4, 4); + g.fillRect(30, 12, 2, 4); + g.fillRect(18, 4, 2, 4); + g.fillRect(18, 20, 2, 4); + g.fillRect(16, 8, 2, 12); + g.fillRect(20, 8, 2, 12); + break; + case 2: // Down + g.fillRect(0, 16, 4, 10); + g.fillRect(24, 16, 4, 10); + g.fillRect(4, 24, 4, 6); + g.fillRect(20, 24, 4, 6); + g.fillRect(8, 28, 4, 4); + g.fillRect(16, 28, 4, 4); + g.fillRect(12, 30, 4, 2); + g.fillRect(4, 18, 4, 2); + g.fillRect(20, 18, 4, 2); + g.fillRect(8, 16, 12, 2); + g.fillRect(8, 20, 12, 2); + break; + case 3: // Left + g.fillRect(24, 0, 10, 4); + g.fillRect(24, 24, 10, 4); + g.fillRect(20, 4, 6, 4); + g.fillRect(20, 20, 6, 4); + g.fillRect(18, 8, 4, 4); + g.fillRect(18, 16, 4, 4); + g.fillRect(18, 12, 2, 4); + g.fillRect(30, 4, 2, 4); + g.fillRect(30, 20, 2, 4); + g.fillRect(28, 8, 2, 12); + g.fillRect(32, 8, 2, 12); + break; + } + } + } + currentIcon = icons[rotation % 2].getImage(); + } + + public boolean Function() { + ports[2].value = ports[0].value ^ ports[1].value; + return false; + } + + public void flip() { + Wire wire1 = ports[0].myWire; + Wire wire2 = ports[1].myWire; + if (wire1 != null) { + if (wire1.fromPort == ports[0]) { + wire1.fromPort = ports[1]; + } + if (wire1.toPort == ports[0]) { + wire1.toPort = ports[1]; + } + if (wire1.inPort == ports[0]) { + wire1.inPort = ports[1]; + } + } + if (wire2 != null) { + if (wire2.fromPort == ports[1]) { + wire2.fromPort = ports[0]; + } + if (wire2.toPort == ports[1]) { + wire2.toPort = ports[0]; + } + if (wire2.inPort == ports[1]) { + wire2.inPort = ports[0]; + } + } + ports[0].myWire = wire2; + ports[1].myWire = wire1; + } } diff --git a/src/com/droidquest/items/AmpireBot.java b/src/com/droidquest/items/AmpireBot.java index d719100..055f8fa 100644 --- a/src/com/droidquest/items/AmpireBot.java +++ b/src/com/droidquest/items/AmpireBot.java @@ -1,21 +1,16 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; -public class AmpireBot extends Item -{ -int animationState=0; // 0-4 -boolean alive=true; -int behaviorState=0; -// 0=Wait for Player +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; + +public class AmpireBot extends Item { + private int animationState = 0; // 0-4 + private boolean alive = true; + private int behaviorState = 0; + // 0=Wait for Player // 1=Patrol Init // 2=Patrol Left // 3=Patrol Up @@ -23,329 +18,356 @@ int behaviorState=0; // 5=Patrol Down // 6=Pounce // 7=Drain -int previousBehavior; // Used to return from Attack -Item target; + private int previousBehavior; // Used to return from Attack + private Item target; -public AmpireBot(int X, int Y, Room r) - { - x=X; y=Y; room=r; - grabbable = false; - width=26;height=32; - GenerateIcons(); - currentIcon = icons[0].getImage(); - } + public AmpireBot(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + grabbable = false; + width = 26; + height = 32; + GenerateIcons(); + currentIcon = icons[0].getImage(); + } -public void GenerateIcons() - { - icons = new ImageIcon[6]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[2]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[3]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[4]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[5]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - Graphics2D g2; - Color transparent = new Color(0,0,0,0); - - // 0= blue 1 - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.blue); - g.fillRect(8,0,8,2); - g.fillRect(0,2,26,10); - g.fillRect(4,12,18,12); - g.fillRect(0,16,26,6); - g.fillRect(12,24,2,8); - g.fillRect(2,6,8,2); - g.setColor(Color.black); - g.fillRect(2,4,22,6); - g.fillRect(10,16,6,6); - g.fillRect(6,18,14,2); - g.setColor(Color.blue); - g.fillRect(2,6,8,2); + public void GenerateIcons() { + icons = new ImageIcon[6]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[2] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[3] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[4] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[5] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + Graphics2D g2; + Color transparent = new Color(0, 0, 0, 0); - // 1= blue 2 - try - { - g = icons[1].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.blue); - g.fillRect(8,0,8,2); - g.fillRect(0,2,26,10); - g.fillRect(4,12,18,12); - g.fillRect(0,16,26,6); - g.fillRect(12,24,2,8); - g.fillRect(2,6,8,2); - g.fillRect(8,28,10,2); - g.setColor(Color.black); - g.fillRect(2,4,22,6); - g.fillRect(10,14,6,6); - g.fillRect(6,16,14,2); - g.setColor(Color.blue); - g.fillRect(8,6,8,2); + // 0= blue 1 + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.blue); + g.fillRect(8, 0, 8, 2); + g.fillRect(0, 2, 26, 10); + g.fillRect(4, 12, 18, 12); + g.fillRect(0, 16, 26, 6); + g.fillRect(12, 24, 2, 8); + g.fillRect(2, 6, 8, 2); + g.setColor(Color.black); + g.fillRect(2, 4, 22, 6); + g.fillRect(10, 16, 6, 6); + g.fillRect(6, 18, 14, 2); + g.setColor(Color.blue); + g.fillRect(2, 6, 8, 2); - // 2= blue 3 - try - { - g = icons[2].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.blue); - g.fillRect(8,0,8,2); - g.fillRect(0,2,26,10); - g.fillRect(4,12,18,12); - g.fillRect(0,16,26,6); - g.fillRect(12,24,2,8); - g.fillRect(12,24,2,4); - g.fillRect(0,28,6,2); - g.fillRect(20,28,6,2); - g.fillRect(8,30,10,2); - g.setColor(Color.black); - g.fillRect(2,4,22,6); - g.fillRect(10,12,6,6); - g.fillRect(6,14,14,2); - g.setColor(Color.blue); - g.fillRect(18,6,8,2); + // 1= blue 2 + try { + g = icons[1].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.blue); + g.fillRect(8, 0, 8, 2); + g.fillRect(0, 2, 26, 10); + g.fillRect(4, 12, 18, 12); + g.fillRect(0, 16, 26, 6); + g.fillRect(12, 24, 2, 8); + g.fillRect(2, 6, 8, 2); + g.fillRect(8, 28, 10, 2); + g.setColor(Color.black); + g.fillRect(2, 4, 22, 6); + g.fillRect(10, 14, 6, 6); + g.fillRect(6, 16, 14, 2); + g.setColor(Color.blue); + g.fillRect(8, 6, 8, 2); - // 3= green 1 - try - { - g = icons[3].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.green); - g.fillRect(8,0,8,2); - g.fillRect(0,2,26,10); - g.fillRect(4,12,18,12); - g.fillRect(0,16,26,6); - g.fillRect(12,24,2,8); - g.fillRect(2,6,8,2); - g.setColor(Color.black); - g.fillRect(2,4,22,6); - g.fillRect(10,16,6,6); - g.fillRect(6,18,14,2); - g.setColor(Color.green); - g.fillRect(2,6,8,2); + // 2= blue 3 + try { + g = icons[2].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.blue); + g.fillRect(8, 0, 8, 2); + g.fillRect(0, 2, 26, 10); + g.fillRect(4, 12, 18, 12); + g.fillRect(0, 16, 26, 6); + g.fillRect(12, 24, 2, 8); + g.fillRect(12, 24, 2, 4); + g.fillRect(0, 28, 6, 2); + g.fillRect(20, 28, 6, 2); + g.fillRect(8, 30, 10, 2); + g.setColor(Color.black); + g.fillRect(2, 4, 22, 6); + g.fillRect(10, 12, 6, 6); + g.fillRect(6, 14, 14, 2); + g.setColor(Color.blue); + g.fillRect(18, 6, 8, 2); - // 4= orange 2 - try - { - g = icons[4].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(new Color(255,128,0)); - g.fillRect(8,0,8,2); - g.fillRect(0,2,26,10); - g.fillRect(4,12,18,12); - g.fillRect(0,16,26,6); - g.fillRect(12,24,2,8); - g.fillRect(2,6,8,2); - g.fillRect(8,28,10,2); - g.setColor(Color.black); - g.fillRect(2,4,22,6); - g.fillRect(10,14,6,6); - g.fillRect(6,16,14,2); - g.setColor(new Color(255,128,0)); - g.fillRect(8,6,8,2); + // 3= green 1 + try { + g = icons[3].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.green); + g.fillRect(8, 0, 8, 2); + g.fillRect(0, 2, 26, 10); + g.fillRect(4, 12, 18, 12); + g.fillRect(0, 16, 26, 6); + g.fillRect(12, 24, 2, 8); + g.fillRect(2, 6, 8, 2); + g.setColor(Color.black); + g.fillRect(2, 4, 22, 6); + g.fillRect(10, 16, 6, 6); + g.fillRect(6, 18, 14, 2); + g.setColor(Color.green); + g.fillRect(2, 6, 8, 2); - // 5= green 3 - try - { - g = icons[5].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.green); - g.fillRect(8,0,8,2); - g.fillRect(0,2,26,10); - g.fillRect(4,12,18,12); - g.fillRect(0,16,26,6); - g.fillRect(12,24,2,8); - g.fillRect(12,24,2,4); - g.fillRect(0,28,6,2); - g.fillRect(20,28,6,2); - g.fillRect(8,30,10,2); - g.setColor(Color.black); - g.fillRect(2,4,22,6); - g.fillRect(10,12,6,6); - g.fillRect(6,14,14,2); - g.setColor(Color.green); - g.fillRect(18,6,8,2); - - if (animationState==4) animationState=0; - int frame = animationState; - if (animationState==3) frame=1; - if (!alive) frame +=3; - currentIcon = icons[frame].getImage(); - } + // 4= orange 2 + try { + g = icons[4].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(new Color(255, 128, 0)); + g.fillRect(8, 0, 8, 2); + g.fillRect(0, 2, 26, 10); + g.fillRect(4, 12, 18, 12); + g.fillRect(0, 16, 26, 6); + g.fillRect(12, 24, 2, 8); + g.fillRect(2, 6, 8, 2); + g.fillRect(8, 28, 10, 2); + g.setColor(Color.black); + g.fillRect(2, 4, 22, 6); + g.fillRect(10, 14, 6, 6); + g.fillRect(6, 16, 14, 2); + g.setColor(new Color(255, 128, 0)); + g.fillRect(8, 6, 8, 2); -public void Animate() - { - animationState++; - if (animationState==4) animationState=0; - int frame = animationState; - if (animationState==3) frame=1; - if (!alive) frame +=3; - currentIcon = icons[frame].getImage(); - - if (alive) - { - if (behaviorState<6) - for (int a=0;a0) - { - previousBehavior=behaviorState; - behaviorState=6; - a=level.items.size(); - } - } - switch (behaviorState) - { - case 0: - if (level.player.room == room) behaviorState=1; - break; - case 1: - if (y>=192) - behaviorState = 2; - else - { - MoveDown( 8); - if (x<280) MoveRight(8); - if (x>280) MoveLeft(8); - } - break; - case 2: - if (room==(Room) level.rooms.elementAt(18) && x<=280) - behaviorState = 3; - else - { - MoveLeft( 8); - if (y<192) MoveDown(8); - if (y>192) MoveUp(8); - } - break; - case 3: - if (room==(Room) level.rooms.elementAt(19) && y<=192) - behaviorState = 4; - else - { - MoveUp( 8); - if (x<280) MoveRight(8); - if (x>280) MoveLeft(8); - } - break; - case 4: - if (room==(Room) level.rooms.elementAt(15) && x>=280) - behaviorState = 5; - else - { - MoveRight( 8); - if (y<192) MoveDown(8); - if (y>192) MoveUp(8); - } - break; - case 5: - if (room==(Room) level.rooms.elementAt(16) && y>=192) - behaviorState = 2; - else - { - MoveDown( 8); - if (x<280) MoveRight(8); - if (x>280) MoveLeft(8); - } - break; - case 6: - if (target.room != room) - behaviorState = previousBehavior; - if (Overlaps(target)) - { - behaviorState=7; - break; - } - Dimension d = target.GetXY(); - if (d.widthx) MoveRight(false); - if (d.heighty) MoveDown(false); - break; - case 7: - if (target.room != room) - { - behaviorState = previousBehavior; - break; - } - if (target.charge>0 && Overlaps(target)) - { - if (target.getClass().toString().endsWith("BlackCrystal")) - alive = false; - else - target.charge-=3125; - } - else - behaviorState = 6; - if (target.charge <=0) - { - target.charge=0; - behaviorState=previousBehavior; - } - break; - } - } - } + // 5= green 3 + try { + g = icons[5].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.green); + g.fillRect(8, 0, 8, 2); + g.fillRect(0, 2, 26, 10); + g.fillRect(4, 12, 18, 12); + g.fillRect(0, 16, 26, 6); + g.fillRect(12, 24, 2, 8); + g.fillRect(12, 24, 2, 4); + g.fillRect(0, 28, 6, 2); + g.fillRect(20, 28, 6, 2); + g.fillRect(8, 30, 10, 2); + g.setColor(Color.black); + g.fillRect(2, 4, 22, 6); + g.fillRect(10, 12, 6, 6); + g.fillRect(6, 14, 14, 2); + g.setColor(Color.green); + g.fillRect(18, 6, 8, 2); -public void Erase() - { - super.Erase(); - target = null; - } + if (animationState == 4) { + animationState = 0; + } + int frame = animationState; + if (animationState == 3) { + frame = 1; + } + if (!alive) { + frame += 3; + } + currentIcon = icons[frame].getImage(); + } + + public void Animate() { + animationState++; + if (animationState == 4) { + animationState = 0; + } + int frame = animationState; + if (animationState == 3) { + frame = 1; + } + if (!alive) { + frame += 3; + } + currentIcon = icons[frame].getImage(); + + if (alive) { + if (behaviorState < 6) { + for (int a = 0; a < level.items.size(); a++) { + target = level.items.elementAt(a); + if (target.room == room) { + if (target.charge > 0) { + previousBehavior = behaviorState; + behaviorState = 6; + a = level.items.size(); + } + } + } + } + switch (behaviorState) { + case 0: + if (level.player.room == room) { + behaviorState = 1; + } + break; + case 1: + if (y >= 192) { + behaviorState = 2; + } + else { + MoveDown(8); + if (x < 280) { + MoveRight(8); + } + if (x > 280) { + MoveLeft(8); + } + } + break; + case 2: + if (room == level.rooms.elementAt(18) && x <= 280) { + behaviorState = 3; + } + else { + MoveLeft(8); + if (y < 192) { + MoveDown(8); + } + if (y > 192) { + MoveUp(8); + } + } + break; + case 3: + if (room == level.rooms.elementAt(19) && y <= 192) { + behaviorState = 4; + } + else { + MoveUp(8); + if (x < 280) { + MoveRight(8); + } + if (x > 280) { + MoveLeft(8); + } + } + break; + case 4: + if (room == level.rooms.elementAt(15) && x >= 280) { + behaviorState = 5; + } + else { + MoveRight(8); + if (y < 192) { + MoveDown(8); + } + if (y > 192) { + MoveUp(8); + } + } + break; + case 5: + if (room == level.rooms.elementAt(16) && y >= 192) { + behaviorState = 2; + } + else { + MoveDown(8); + if (x < 280) { + MoveRight(8); + } + if (x > 280) { + MoveLeft(8); + } + } + break; + case 6: + if (target.room != room) { + behaviorState = previousBehavior; + } + if (Overlaps(target)) { + behaviorState = 7; + break; + } + Dimension d = target.GetXY(); + if (d.width < x) { + MoveLeft(false); + } + if (d.width > x) { + MoveRight(false); + } + if (d.height < y) { + MoveUp(false); + } + if (d.height > y) { + MoveDown(false); + } + break; + case 7: + if (target.room != room) { + behaviorState = previousBehavior; + break; + } + if (target.charge > 0 && Overlaps(target)) { + if (target.getClass().toString().endsWith("BlackCrystal")) { + alive = false; + } + else { + target.charge -= 3125; + } + } + else { + behaviorState = 6; + } + if (target.charge <= 0) { + target.charge = 0; + behaviorState = previousBehavior; + } + break; + } + } + } + + public void Erase() { + super.Erase(); + target = null; + } } diff --git a/src/com/droidquest/items/AutoWire.java b/src/com/droidquest/items/AutoWire.java index aed7b56..e4eac3a 100644 --- a/src/com/droidquest/items/AutoWire.java +++ b/src/com/droidquest/items/AutoWire.java @@ -1,177 +1,158 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; -import com.droidquest.Wire; import com.droidquest.chipstuff.Port; import com.droidquest.devices.Device; import com.droidquest.devices.PortDevice; import com.droidquest.devices.PrototypeChip; import com.droidquest.devices.SmallChip; -public class AutoWire extends Item -{ -int animation; // 0=Wait to Wire - // 1-8 = Wiring/Unwiring Port 1-8 -Device chip; -PortDevice[] portdevices = new PortDevice[8]; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; -public AutoWire(int X, int Y, Room r) - { - x=X; y=Y; room=r; - width=28; height=30; - GenerateIcons(); - } +public class AutoWire extends Item { + private int animation; // 0=Wait to Wire + // 1-8 = Wiring/Unwiring Port 1-8 + private Device chip; + private PortDevice[] portdevices = new PortDevice[8]; -public void GenerateIcons() - { - icons = new ImageIcon[2]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - Graphics2D g2; - Color transparent = new Color(0,0,0,0); - - // 0 = Off - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g.setColor(Color.white); - g.fillRect(0,0,28,30); - g.setColor(Color.black); - g.fillRect(8,8,12,14); - g.fillRect(4,10,20,10); - g.setColor(Color.white); - g.fillRect(12,10,4,10); - g.fillRect(8,12,12,6); + public AutoWire(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 30; + GenerateIcons(); + } - // 1 = On - try - { - g = icons[1].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g.setColor(new Color(255,128,0)); - g.fillRect(0,0,28,30); - g.setColor(Color.black); - g.fillRect(8,8,12,14); - g.fillRect(4,10,20,10); - g.setColor(new Color(255,128,0)); - g.fillRect(12,10,4,10); - g.fillRect(8,12,12,6); + public void GenerateIcons() { + icons = new ImageIcon[2]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; - currentIcon = icons[0].getImage(); - - } + // 0 = Off + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g.setColor(Color.white); + g.fillRect(0, 0, 28, 30); + g.setColor(Color.black); + g.fillRect(8, 8, 12, 14); + g.fillRect(4, 10, 20, 10); + g.setColor(Color.white); + g.fillRect(12, 10, 4, 10); + g.fillRect(8, 12, 12, 6); -public boolean CanBePickedUp(Item i) - { - if (animation!=0) return false; - // Find the Item that has inTester set true; - chip=null; - int pdcount =0; - for (int a=0; a=2 && animation <=8) - { - if (portdevices[0].ports[0].myWire!=null) - { // Wiring - if (portdevices[animation-1].ports[0].myWire==null) - { - portdevices[animation-1].ports[0].type = Port.TYPE_UNDEFINED; - portdevices[animation-1].ports[0].value = false; - Wire wire = new Wire(portdevices[animation-1].ports[0], chip.ports[animation-1]); - } - } - else - { // Unwiring - if (portdevices[animation-1].ports[0].myWire!=null) - { - portdevices[animation-1].ports[0].myWire.Remove(); - portdevices[animation-1].ports[0].type = Port.TYPE_UNDEFINED; - portdevices[animation-1].ports[0].value = false; - } - } - animation++; - } + currentIcon = icons[0].getImage(); - if (animation==9) - { - currentIcon = icons[0].getImage(); - animation=0; - } - - } + } -public void Erase() - { - super.Erase(); - chip=null; - portdevices = null; - } + public boolean CanBePickedUp(Item i) { + if (animation != 0) { + return false; + } + // Find the Item that has inTester set true; + chip = null; + int pdcount = 0; + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item instanceof PrototypeChip) { + PrototypeChip pc = (PrototypeChip) item; + if (pc.inTester) { + chip = pc; + } + } + if (item instanceof SmallChip) { + SmallChip sc = (SmallChip) item; + if (sc.inTester) { + chip = sc; + } + } + if (item instanceof PortDevice) { + if (item.room == room) { + portdevices[pdcount] = (PortDevice) item; + pdcount++; + } + } + } + if (chip == null) { + return false; + } + animation = 1; + return false; + } + + public void Animate() { + if (animation == 0) { + return; + } + + if (animation == 1) { + if (portdevices[0].ports[0].myWire == null) { // Wiring + portdevices[0].ports[0].type = Port.TYPE_UNDEFINED; + portdevices[0].ports[0].value = false; + } + else { // Unwiring + portdevices[0].ports[0].myWire.Remove(); + portdevices[0].ports[0].type = Port.TYPE_UNDEFINED; + portdevices[0].ports[0].value = false; + } + animation++; + currentIcon = icons[1].getImage(); + return; + } + + if (animation >= 2 && animation <= 8) { + if (portdevices[0].ports[0].myWire != null) { // Wiring + if (portdevices[animation - 1].ports[0].myWire == null) { + portdevices[animation - 1].ports[0].type = Port.TYPE_UNDEFINED; + portdevices[animation - 1].ports[0].value = false; + } + } + else { // Unwiring + if (portdevices[animation - 1].ports[0].myWire != null) { + portdevices[animation - 1].ports[0].myWire.Remove(); + portdevices[animation - 1].ports[0].type = Port.TYPE_UNDEFINED; + portdevices[animation - 1].ports[0].value = false; + } + } + animation++; + } + + if (animation == 9) { + currentIcon = icons[0].getImage(); + animation = 0; + } + + } + + public void Erase() { + super.Erase(); + chip = null; + portdevices = null; + } } diff --git a/src/com/droidquest/items/BinaryKey.java b/src/com/droidquest/items/BinaryKey.java index 3d89ade..73b6289 100644 --- a/src/com/droidquest/items/BinaryKey.java +++ b/src/com/droidquest/items/BinaryKey.java @@ -1,58 +1,53 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; -public class BinaryKey extends Item -{ -public BinaryKey (int X, int Y, Room r) - { - x=X; y=Y; room=r; - width=26; height=28; - GenerateIcons(); - } +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(new Color(255,128,0)); - g.fillRect(4,0,4,8); - g.fillRect(4,10,4,2); - g.fillRect(0,12,4,4); - g.fillRect(8,12,4,4); - g.fillRect(4,16,4,2); - g.fillRect(4,20,4,8); - g.fillRect(16,0,4,2); - g.fillRect(12,2,4,4); - g.fillRect(20,2,4,4); - g.fillRect(16,6,4,2); - g.fillRect(16,10,4,8); - g.fillRect(16,20,4,2); - g.fillRect(12,22,4,4); - g.fillRect(20,22,4,4); - g.fillRect(16,26,4,2); - currentIcon = icons[0].getImage(); - } +public class BinaryKey extends Item { + public BinaryKey(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 26; + height = 28; + GenerateIcons(); + } + + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(new Color(255, 128, 0)); + g.fillRect(4, 0, 4, 8); + g.fillRect(4, 10, 4, 2); + g.fillRect(0, 12, 4, 4); + g.fillRect(8, 12, 4, 4); + g.fillRect(4, 16, 4, 2); + g.fillRect(4, 20, 4, 8); + g.fillRect(16, 0, 4, 2); + g.fillRect(12, 2, 4, 4); + g.fillRect(20, 2, 4, 4); + g.fillRect(16, 6, 4, 2); + g.fillRect(16, 10, 4, 8); + g.fillRect(16, 20, 4, 2); + g.fillRect(12, 22, 4, 4); + g.fillRect(20, 22, 4, 4); + g.fillRect(16, 26, 4, 2); + currentIcon = icons[0].getImage(); + } } diff --git a/src/com/droidquest/items/BlackCrystal.java b/src/com/droidquest/items/BlackCrystal.java index 2a266e7..55c6485 100644 --- a/src/com/droidquest/items/BlackCrystal.java +++ b/src/com/droidquest/items/BlackCrystal.java @@ -9,46 +9,42 @@ import javax.swing.ImageIcon; import com.droidquest.Room; -public class BlackCrystal extends Crystal -{ -public BlackCrystal(int X, int Y, Room r) - { - super(X,Y,r,10); - } +public class BlackCrystal extends Crystal { + public BlackCrystal(int X, int Y, Room r) { + super(X, Y, r, 10); + } -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - Graphics2D g2; - Color transparent = new Color(0,0,0,0); - - // 0 = blue - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.black); - g.fillRect(12,0,4,24); - g.fillRect(8,4,12,16); - g.fillRect(4,6,20,12); - g.fillRect(0,10,28,4); - g.fillRect(0,4,4,2); - g.fillRect(0,18,4,2); - g.fillRect(24,4,4,2); - g.fillRect(24,18,4,2); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + Graphics2D g2; + Color transparent = new Color(0, 0, 0, 0); -public void Decorate() {} + // 0 = blue + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.black); + g.fillRect(12, 0, 4, 24); + g.fillRect(8, 4, 12, 16); + g.fillRect(4, 6, 20, 12); + g.fillRect(0, 10, 28, 4); + g.fillRect(0, 4, 4, 2); + g.fillRect(0, 18, 4, 2); + g.fillRect(24, 4, 4, 2); + g.fillRect(24, 18, 4, 2); + currentIcon = icons[0].getImage(); + } + + public void Decorate() { + } } \ No newline at end of file diff --git a/src/com/droidquest/items/BlueRobot.java b/src/com/droidquest/items/BlueRobot.java index 32a587e..27fc1b7 100644 --- a/src/com/droidquest/items/BlueRobot.java +++ b/src/com/droidquest/items/BlueRobot.java @@ -1,8 +1,5 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Graphics; - import com.droidquest.Room; import com.droidquest.chipstuff.Port; import com.droidquest.devices.Antenna; @@ -10,53 +7,52 @@ import com.droidquest.devices.Bumper; import com.droidquest.devices.Grabber; import com.droidquest.devices.Thruster; -public class BlueRobot extends GenericRobot -{ -private int scan; -private int scandir; +import java.awt.*; -public BlueRobot(int X, int Y, Room r) - { - super(X,Y,r,Color.blue); - scan=0; - scandir=2; - Animate(); - devices[0] = new Thruster(176,16,InternalRoom,Port.ROT_UP,Color.white); - devices[1] = new Thruster(476,128,InternalRoom,Port.ROT_RIGHT,Color.white); - devices[2] = new Thruster(356,336,InternalRoom,Port.ROT_DOWN,Color.white); - devices[3] = new Thruster(32,236,InternalRoom,Port.ROT_LEFT,Color.white); - devices[4] = new Bumper(396,16,InternalRoom,Port.ROT_UP,Color.white); - devices[5] = new Bumper(480,256,InternalRoom,Port.ROT_RIGHT,Color.white); - devices[6] = new Bumper(128,330,InternalRoom,Port.ROT_DOWN,Color.white); - devices[7] = new Bumper(28,134,InternalRoom,Port.ROT_LEFT,Color.white); - devices[8] = new Antenna(64,70,InternalRoom,Color.white); - devices[9] = new Grabber(126,44,InternalRoom,Color.white); - for (int a=0; a<10; a++) - level.items.addElement(devices[a]); +public class BlueRobot extends GenericRobot { + private int scan; + private int scandir; - } + public BlueRobot(int X, int Y, Room r) { + super(X, Y, r, Color.blue); + scan = 0; + scandir = 2; + Animate(); + devices[0] = new Thruster(176, 16, InternalRoom, Port.ROT_UP, Color.white); + devices[1] = new Thruster(476, 128, InternalRoom, Port.ROT_RIGHT, Color.white); + devices[2] = new Thruster(356, 336, InternalRoom, Port.ROT_DOWN, Color.white); + devices[3] = new Thruster(32, 236, InternalRoom, Port.ROT_LEFT, Color.white); + devices[4] = new Bumper(396, 16, InternalRoom, Port.ROT_UP, Color.white); + devices[5] = new Bumper(480, 256, InternalRoom, Port.ROT_RIGHT, Color.white); + devices[6] = new Bumper(128, 330, InternalRoom, Port.ROT_DOWN, Color.white); + devices[7] = new Bumper(28, 134, InternalRoom, Port.ROT_LEFT, Color.white); + devices[8] = new Antenna(64, 70, InternalRoom, Color.white); + devices[9] = new Grabber(126, 44, InternalRoom, Color.white); + for (int a = 0; a < 10; a++) { + level.items.addElement(devices[a]); + } -public void Decorate() - { - super.Decorate(); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); - return; - } - g.setColor(Color.black); - g.fillRect(22,44,42,4); - - if (scan+scandir>36 || scan+scandir<0) - scandir=-scandir; - scan=scan+scandir; - g.setColor(new Color(255,128,0)); - g.fillRect(22+scan,44,6,4); - } + } + + public void Decorate() { + super.Decorate(); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); + return; + } + g.setColor(Color.black); + g.fillRect(22, 44, 42, 4); + + if (scan + scandir > 36 || scan + scandir < 0) { + scandir = -scandir; + } + scan = scan + scandir; + g.setColor(new Color(255, 128, 0)); + g.fillRect(22 + scan, 44, 6, 4); + } } diff --git a/src/com/droidquest/items/Burner.java b/src/com/droidquest/items/Burner.java index 3bda1b0..68337c7 100644 --- a/src/com/droidquest/items/Burner.java +++ b/src/com/droidquest/items/Burner.java @@ -2,130 +2,122 @@ package com.droidquest.items; import java.awt.Color; import java.awt.Graphics; -import java.awt.Graphics2D; import java.awt.image.BufferedImage; import javax.swing.ImageIcon; import com.droidquest.Room; -import com.droidquest.Wire; import com.droidquest.chipstuff.ChipCompiler; -import com.droidquest.chipstuff.Gate; -import com.droidquest.chipstuff.Signal; -import com.droidquest.devices.Device; -import com.droidquest.devices.FlipFlop; import com.droidquest.devices.PrototypeChip; import com.droidquest.devices.SmallChip; import com.droidquest.levels.Level; -public class Burner extends Item -{ -int burning; -int animation; +public class Burner extends Item { + private int burning; + private int animation; -public Burner(int X, int Y, Room r) - { - x=X; y=Y; room=r; - width=28; height=30; - GenerateIcons(); - } + public Burner(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 30; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[2]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - Graphics2D g2; - Color transparent = new Color(0,0,0,0); - - // 0 = Off - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g.setColor(Color.white); - g.fillRect(0,0,28,30); - g.setColor(Color.black); - g.fillRect(8,8,12,14); - g.fillRect(4,10,20,10); - g.setColor(Color.white); - g.fillRect(12,10,4,10); - g.fillRect(8,12,12,6); + public void GenerateIcons() { + icons = new ImageIcon[2]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; - // 1 = On - try - { - g = icons[1].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g.setColor(new Color(255,128,0)); - g.fillRect(0,0,28,30); - g.setColor(Color.black); - g.fillRect(8,8,12,14); - g.fillRect(4,10,20,10); - g.setColor(new Color(255,128,0)); - g.fillRect(12,10,4,10); - g.fillRect(8,12,12,6); + // 0 = Off + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g.setColor(Color.white); + g.fillRect(0, 0, 28, 30); + g.setColor(Color.black); + g.fillRect(8, 8, 12, 14); + g.fillRect(4, 10, 20, 10); + g.setColor(Color.white); + g.fillRect(12, 10, 4, 10); + g.fillRect(8, 12, 12, 6); - currentIcon = icons[0].getImage(); - - } + // 1 = On + try { + g = icons[1].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g.setColor(new Color(255, 128, 0)); + g.fillRect(0, 0, 28, 30); + g.setColor(Color.black); + g.fillRect(8, 8, 12, 14); + g.fillRect(4, 10, 20, 10); + g.setColor(new Color(255, 128, 0)); + g.fillRect(12, 10, 4, 10); + g.fillRect(8, 12, 12, 6); -public boolean CanBePickedUp(Item i) - { - // Find the SmallChip and Erase it - Item sc=null; - for (int a=0; a0) - { - animation = 1- animation; - currentIcon = icons[animation].getImage(); - burning--; - } - else - currentIcon = icons[0].getImage(); - } + } + + public boolean CanBePickedUp(Item i) { + // Find the SmallChip and Erase it + Item sc = null; + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item.getClass().toString().endsWith("SmallChip")) { + if (((SmallChip) item).inBurner) { + sc = item; + } + } + } + if (sc == null) { + return false; + } + ((SmallChip) sc).Empty(); + + // Find the PrototypeChip + Item pc = null; + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item.getClass().toString().endsWith("PrototypeChip")) { + if (((PrototypeChip) item).inBurner) { + pc = item; + } + } + } + if (pc == null) { + return false; + } + + // Start the ChipCompiler thread + ChipCompiler cc = new ChipCompiler((PrototypeChip) pc, (SmallChip) sc); + + level.PlaySound(room, Level.BURNSOUND); + burning = 10; + + return false; + } + + public void Animate() { + if (burning > 0) { + animation = 1 - animation; + currentIcon = icons[animation].getImage(); + burning--; + } + else { + currentIcon = icons[0].getImage(); + } + } } diff --git a/src/com/droidquest/items/Button.java b/src/com/droidquest/items/Button.java index ca718c3..553fadc 100644 --- a/src/com/droidquest/items/Button.java +++ b/src/com/droidquest/items/Button.java @@ -9,47 +9,45 @@ import javax.swing.ImageIcon; import com.droidquest.Room; -public class Button extends Item -{ -Color color; +public class Button extends Item { + private Color color; -public Button(int X, int Y, Room r, Color c) - { - x=X; y=Y; room=r; - width=28; height=26; - color=c; - GenerateIcons(); - } + public Button(int X, int Y, Room r, Color c) { + x = X; + y = Y; + room = r; + width = 28; + height = 26; + color = c; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(color); - g.fillRect(8,0,12,26); - g.fillRect(4,2,20,22); - g.fillRect(0,4,28,18); - g.setColor(Color.black); - g.fillRect(8,6,12,14); - g.fillRect(4,8,20,10); - g.setColor(color); - g.fillRect(12,8,4,10); - g.fillRect(8,10,12,6); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(color); + g.fillRect(8, 0, 12, 26); + g.fillRect(4, 2, 20, 22); + g.fillRect(0, 4, 28, 18); + g.setColor(Color.black); + g.fillRect(8, 6, 12, 14); + g.fillRect(4, 8, 20, 10); + g.setColor(color); + g.fillRect(12, 8, 4, 10); + g.fillRect(8, 10, 12, 6); + currentIcon = icons[0].getImage(); + } } \ No newline at end of file diff --git a/src/com/droidquest/items/CamDisk.java b/src/com/droidquest/items/CamDisk.java index 21c616c..69a5b43 100644 --- a/src/com/droidquest/items/CamDisk.java +++ b/src/com/droidquest/items/CamDisk.java @@ -6,39 +6,35 @@ import com.droidquest.Room; import com.droidquest.decorations.TextBox; import com.droidquest.materials.Material; -public class CamDisk extends Disk -{ -transient SpyCam spycam=null; +public class CamDisk extends Disk { + private transient SpyCam spycam = null; -public CamDisk(int X, int Y, Room r) - { - super(X,Y,r,Color.white,0); - } + public CamDisk(int X, int Y, Room r) { + super(X, Y, r, Color.white, 0); + } -public void IsDropped() - { - if (spycam==null) - for (int a=0; a=0; a--) - { - Wire wire = (Wire)pc.InternalRoom.wires.elementAt(a); - wire.Remove(); - } - - for (int a=0; a<8; a++) - { - pc.portdevices[a].ports[0].type = Port.TYPE_UNDEFINED; - pc.ports[a].type = Port.TYPE_UNDEFINED; - pc.ports[a].value = false; - } - - for (int a=0; a4) // Need many nodes - { - Port[] ports = new Port[numConnections]; - for (int b=0; b 504) device.x = 504; - if (device.y < 32) device.y = 32; - if (device.y > 320) device.y = 320; - } - } - - // Rotate devices to point to the "next" device. AND, OR, NOT, XOR only - for (int a=0; aMath.abs(dy)) - { - if (dx<0) device.rotate(-1); - else device.rotate(1); - } - else - { - if (dy>0) - { - device.rotate(1); - device.rotate(1); - } - } - } - - } - } - - pc.grabbable = true; - sc.grabbable = true; - - } +import java.util.Vector; -public Port FindPort(Signal sig, int num, PrototypeChip pc, SmallChip sc, Vector deviceList) -{ - // Find Nth port that this signal attaches to in given SmallChip. - - int n=0; - - for (int a=0; a<8; a++) - if (sc.portSignals[a].internalSignal == sig) - { - n++; - if (n==num) return pc.portdevices[a].ports[0]; - } - for (int a=0; a deviceList = new Vector(); + pc.grabbable = false; + sc.grabbable = false; + + // Remove all wires and devices from Prototype Chip, expect for PortDevices + for (int a = pc.InternalRoom.wires.size() - 1; a >= 0; a--) { + Wire wire = pc.InternalRoom.wires.elementAt(a); + wire.Remove(); + } + + for (int a = 0; a < 8; a++) { + pc.portdevices[a].ports[0].type = Port.TYPE_UNDEFINED; + pc.ports[a].type = Port.TYPE_UNDEFINED; + pc.ports[a].value = false; + } + + for (int a = 0; a < pc.level.items.size(); a++) { + Item item = pc.level.items.elementAt(a); + if (item.room == pc.InternalRoom + && item instanceof Device + && !(item instanceof PortDevice)) { + pc.level.items.removeElement(item); + a--; + } + } + + // Set the PortDevice types to match the SC PortSignal types + for (int a = 0; a < 8; a++) { + if (sc.portSignals[a].type != Port.TYPE_UNDEFINED) { + pc.portdevices[a].ports[0].type = 1 - sc.portSignals[a].type; + } + else { + pc.portdevices[a].ports[0].type = Port.TYPE_UNDEFINED; + } + } + + // Add a corresponding Device for every Gate in the SmallChip + for (int a = 0; a < sc.gates.size(); a++) { + Gate gate = sc.gates.elementAt(a); + if (gate.type.equalsIgnoreCase("AND")) { + ANDGate andGate = new ANDGate(10 * 28, 6 * 32, pc.InternalRoom); + deviceList.addElement(andGate); + pc.level.items.addElement(andGate); + } + if (gate.type.equalsIgnoreCase("OR")) { + ORGate orGate = new ORGate(10 * 28, 6 * 32, pc.InternalRoom); + deviceList.addElement(orGate); + pc.level.items.addElement(orGate); + } + if (gate.type.equalsIgnoreCase("NOT")) { + NOTGate notGate = new NOTGate(10 * 28, 6 * 32, pc.InternalRoom); + deviceList.addElement(notGate); + pc.level.items.addElement(notGate); + } + if (gate.type.equalsIgnoreCase("XOR")) { + XORGate xorGate = new XORGate(10 * 28, 6 * 32, pc.InternalRoom); + deviceList.addElement(xorGate); + pc.level.items.addElement(xorGate); + } + if (gate.type.equalsIgnoreCase("FF")) { + FlipFlop flipflop = new FlipFlop(10 * 28, 6 * 32, pc.InternalRoom); + deviceList.addElement(flipflop); + pc.level.items.addElement(flipflop); + flipflop.state = gate.state; + } + if (gate.type.equalsIgnoreCase("Chip")) { + SmallChip smallchip = new SmallChip(10 * 28, 6 * 32, pc.InternalRoom, "X"); + deviceList.addElement(smallchip); + pc.level.items.addElement(smallchip); + smallchip.speed = gate.speed; + + for (int b = 0; b < gate.mySignals.size(); b++) { + Signal newsig = new Signal(); + Signal oldsig = gate.mySignals.elementAt(b); + newsig.Set(oldsig.Get()); + newsig.working = oldsig.working; + smallchip.signals.addElement(newsig); + } + for (int b = 0; b < gate.myGates.size(); b++) { + Gate oldgate = gate.myGates.elementAt(b); + Gate newgate = new Gate(oldgate); + smallchip.gates.addElement(newgate); + for (int c = 0; c < 8; c++) { + if (oldgate.portSignals[c].externalSignal != null) { + int sigIndex = gate.mySignals.indexOf(oldgate.portSignals[c].externalSignal); + newgate.portSignals[c].externalSignal = (Signal) smallchip.signals.elementAt(sigIndex); + } + } + } + for (int b = 0; b < 8; b++) { + if (gate.portSignals[b].internalSignal != null) { + int sigIndex = gate.mySignals.indexOf(gate.portSignals[b].internalSignal); + smallchip.portSignals[b].internalSignal = (Signal) smallchip.signals.elementAt(sigIndex); + } + smallchip.portSignals[b].type = gate.portSignals[b].type; + smallchip.ports[b].type = gate.portSignals[b].type; + } + } + } + + + // Wire Devices according to the way the Gates are linked to Signals + for (int a = 0; a < sc.signals.size(); a++) { + Signal sig = sc.signals.elementAt(a); + if (sig.working) { + int numConnections = 0; + for (int b = 0; b < 8; b++) { + if (sc.portSignals[b].internalSignal == sig) { + numConnections++; + } + } + for (int b = 0; b < sc.gates.size(); b++) { + Gate thisGate = sc.gates.elementAt(b); + for (int c = 0; c < 8; c++) { + if (thisGate.portSignals[c].externalSignal == sig) { + numConnections++; + } + } + } + if (numConnections == 2) // Simple wire from A to B + { + Port port1 = FindPort(sig, 1, pc, sc, deviceList); + Port port2 = FindPort(sig, 2, pc, sc, deviceList); + if (port1 != null && port2 != null) { + Wire dummy = new Wire(port1, port2); + } + else { + System.out.println("Could not make connection for Signal " + a); + if (port1 == null) { + System.out.println("port1=null"); + } + else { + System.out.println("port1 is in " + port1.myDevice.getClass()); + } + if (port2 == null) { + System.out.println("port2=null"); + } + else { + System.out.println("port2 is in " + port2.myDevice.getClass()); + } + + } + } + + else if (numConnections == 3) // Need a regular Node + { + Port port1 = FindPort(sig, 1, pc, sc, deviceList); + Port port2 = FindPort(sig, 2, pc, sc, deviceList); + Port port3 = FindPort(sig, 3, pc, sc, deviceList); + Node node = new Node(10 * 28, 6 * 32, pc.InternalRoom, Node.TYPE_STRAIGHT); + pc.level.items.addElement(node); + deviceList.addElement(node); + if (port1.type == Port.TYPE_OUTPUT) { + Wire dummy1 = new Wire(port1, node.ports[0]); + Wire dummy2 = new Wire(port2, node.ports[1]); + Wire dummy3 = new Wire(port3, node.ports[2]); + } + else if (port2.type == Port.TYPE_OUTPUT) { + Wire dummy1 = new Wire(port2, node.ports[0]); + Wire dummy2 = new Wire(port1, node.ports[1]); + Wire dummy3 = new Wire(port3, node.ports[2]); + } + else if (port3.type == Port.TYPE_OUTPUT) { + Wire dummy1 = new Wire(port3, node.ports[0]); + Wire dummy2 = new Wire(port1, node.ports[1]); + Wire dummy3 = new Wire(port2, node.ports[2]); + } + else if (port1.type == Port.TYPE_UNDEFINED) { + Wire dummy1 = new Wire(port1, node.ports[0]); + Wire dummy2 = new Wire(port2, node.ports[1]); + Wire dummy3 = new Wire(port3, node.ports[2]); + } + else if (port2.type == Port.TYPE_UNDEFINED) { + Wire dummy1 = new Wire(port2, node.ports[0]); + Wire dummy2 = new Wire(port1, node.ports[1]); + Wire dummy3 = new Wire(port3, node.ports[2]); + } + else if (port3.type == Port.TYPE_UNDEFINED) { + Wire dummy1 = new Wire(port3, node.ports[0]); + Wire dummy2 = new Wire(port1, node.ports[1]); + Wire dummy3 = new Wire(port2, node.ports[2]); + } + } + + else if (numConnections == 4) // Need a 3 output Node + { + Port port1 = FindPort(sig, 1, pc, sc, deviceList); + Port port2 = FindPort(sig, 2, pc, sc, deviceList); + Port port3 = FindPort(sig, 3, pc, sc, deviceList); + Port port4 = FindPort(sig, 4, pc, sc, deviceList); + Node node = new Node(10 * 28, 6 * 32, pc.InternalRoom, Node.TYPE_THREE); + pc.level.items.addElement(node); + deviceList.addElement(node); + if (port1.type == Port.TYPE_OUTPUT) { + Wire dummy1 = new Wire(port1, node.ports[0]); + Wire dummy2 = new Wire(port2, node.ports[1]); + Wire dummy3 = new Wire(port3, node.ports[2]); + Wire dummy4 = new Wire(port4, node.ports[3]); + } + else if (port2.type == Port.TYPE_OUTPUT) { + Wire dummy1 = new Wire(port2, node.ports[0]); + Wire dummy2 = new Wire(port1, node.ports[1]); + Wire dummy3 = new Wire(port3, node.ports[2]); + Wire dummy4 = new Wire(port4, node.ports[3]); + } + else if (port3.type == Port.TYPE_OUTPUT) { + Wire dummy1 = new Wire(port3, node.ports[0]); + Wire dummy2 = new Wire(port1, node.ports[1]); + Wire dummy3 = new Wire(port2, node.ports[2]); + Wire dummy4 = new Wire(port4, node.ports[3]); + } + else if (port4.type == Port.TYPE_OUTPUT) { + Wire dummy1 = new Wire(port4, node.ports[0]); + Wire dummy2 = new Wire(port1, node.ports[1]); + Wire dummy3 = new Wire(port2, node.ports[2]); + Wire dummy4 = new Wire(port3, node.ports[3]); + } + else if (port1.type == Port.TYPE_UNDEFINED) { + Wire dummy1 = new Wire(port1, node.ports[0]); + Wire dummy2 = new Wire(port2, node.ports[1]); + Wire dummy3 = new Wire(port3, node.ports[2]); + Wire dummy4 = new Wire(port4, node.ports[3]); + } + else if (port2.type == Port.TYPE_UNDEFINED) { + Wire dummy1 = new Wire(port2, node.ports[0]); + Wire dummy2 = new Wire(port1, node.ports[1]); + Wire dummy3 = new Wire(port3, node.ports[2]); + Wire dummy4 = new Wire(port4, node.ports[3]); + } + else if (port3.type == Port.TYPE_UNDEFINED) { + Wire dummy1 = new Wire(port3, node.ports[0]); + Wire dummy2 = new Wire(port1, node.ports[1]); + Wire dummy3 = new Wire(port2, node.ports[2]); + Wire dummy4 = new Wire(port4, node.ports[3]); + } + else if (port4.type == Port.TYPE_UNDEFINED) { + Wire dummy1 = new Wire(port4, node.ports[0]); + Wire dummy2 = new Wire(port1, node.ports[1]); + Wire dummy3 = new Wire(port2, node.ports[2]); + Wire dummy4 = new Wire(port3, node.ports[3]); + } + } + + else if (numConnections > 4) // Need many nodes + { + Port[] ports = new Port[numConnections]; + for (int b = 0; b < numConnections; b++) { + ports[b] = FindPort(sig, b + 1, pc, sc, deviceList); + } + + Node[] nodes = new Node[numConnections - 2]; + for (int b = 0; b < numConnections - 2; b++) { + nodes[b] = new Node(10 * 28, 6 * 32, pc.InternalRoom, Node.TYPE_STRAIGHT); + pc.level.items.addElement(nodes[b]); + deviceList.addElement(nodes[b]); + } + + for (int b = 1; b < numConnections - 2; b++) { + Wire dummy = new Wire(nodes[b - 1].ports[2], nodes[b].ports[0]); + } + + int nodecounter = 0; + boolean inputfound = false; + for (int b = 0; b < numConnections; b++) { + if (ports[b].type == Port.TYPE_OUTPUT) { + Wire dummy = new Wire(nodes[0].ports[0], ports[b]); + inputfound = true; + } + else if (ports[b].type == Port.TYPE_INPUT) { + if (nodecounter < nodes.length) { + Wire dummy = new Wire(nodes[nodecounter].ports[1], ports[b]); + nodecounter++; + } + else { + Wire dummy = new Wire(nodes[nodecounter - 1].ports[2], ports[b]); + } + } + else { + System.out.println(ports[b].myDevice.getClass() + + " port " + b + " id undefined."); + } + } + if (!inputfound) { + for (int b = 0; b < numConnections; b++) { + if (ports[b].type == Port.TYPE_UNDEFINED) { + Wire dummy = new Wire(nodes[0].ports[0], ports[b]); + } + } + } + } + } + + } + + // Routing: Move the devices around based on what they are connected to. + for (int a = 0; a < 10; a++) { + for (int b = 0; b < deviceList.size(); b++) { + Device device = deviceList.elementAt(b); + int numConnections = 1; + int x = device.x; + int y = device.y; + for (int c = 0; c < device.ports.length; c++) { + if (device.ports[c].myWire != null) { + if (device.ports[c].type == Port.TYPE_INPUT) { + x += device.ports[c].myWire.outPort.myDevice.x; + y += device.ports[c].myWire.outPort.myDevice.y; + } + else if (device.ports[c].type == Port.TYPE_OUTPUT) { + x += device.ports[c].myWire.inPort.myDevice.x; + y += device.ports[c].myWire.inPort.myDevice.y; + } + numConnections++; + } + } + device.x = x / numConnections; + device.y = y / numConnections; + if (device.x < 56) { + device.x = 56; + } + if (device.x > 504) { + device.x = 504; + } + if (device.y < 32) { + device.y = 32; + } + if (device.y > 320) { + device.y = 320; + } + } + } + + // Rotate devices to point to the "next" device. AND, OR, NOT, XOR only + for (int a = 0; a < deviceList.size(); a++) { + Device device = deviceList.elementAt(a); + if (!(device instanceof SmallChip + || device instanceof Node + || device instanceof FlipFlop)) { + Port port; + if (device instanceof NOTGate) { + port = device.ports[1]; + } + else { + port = device.ports[2]; + } + if (port.myWire != null) { + Port otherPort = port.myWire.otherPort(port); + Device otherDevice = (Device) otherPort.myDevice; + int dx = otherDevice.x - device.x; + int dy = otherDevice.y - device.y; + if (Math.abs(dx) > Math.abs(dy)) { + if (dx < 0) { + device.rotate(-1); + } + else { + device.rotate(1); + } + } + else { + if (dy > 0) { + device.rotate(1); + device.rotate(1); + } + } + } + + } + } + + pc.grabbable = true; + sc.grabbable = true; + + } + + Port FindPort(Signal sig, int num, PrototypeChip pc, SmallChip sc, Vector deviceList) { + // Find Nth port that this signal attaches to in given SmallChip. + + int n = 0; + + for (int a = 0; a < 8; a++) { + if (sc.portSignals[a].internalSignal == sig) { + n++; + if (n == num) { + return pc.portdevices[a].ports[0]; + } + } + } + for (int a = 0; a < sc.gates.size(); a++) { + Gate thisgate = sc.gates.elementAt(a); + for (int b = 0; b < 8; b++) { + if (thisgate.portSignals[b].externalSignal == sig) { + n++; + if (n == num) { + Device device = deviceList.elementAt(a); + return device.ports[b]; + } + } + } + } + return null; + } } diff --git a/src/com/droidquest/items/Crystal.java b/src/com/droidquest/items/Crystal.java index 9a49794..c9e3be1 100644 --- a/src/com/droidquest/items/Crystal.java +++ b/src/com/droidquest/items/Crystal.java @@ -9,114 +9,108 @@ import javax.swing.ImageIcon; import com.droidquest.Room; -public class Crystal extends Item -{ -int color = 0; // 0 = blue; 1 = orange +public class Crystal extends Item { + private int color = 0; // 0 = blue; 1 = orange -public Crystal(int X, int Y, Room r, int ch) - { - x=X; y=Y; room=r; - charge=ch; - width=28; height=24; - editable=true; - GenerateIcons(); - currentIcon = icons[0].getImage(); - } + public Crystal(int X, int Y, Room r, int ch) { + x = X; + y = Y; + room = r; + charge = ch; + width = 28; + height = 24; + editable = true; + GenerateIcons(); + currentIcon = icons[0].getImage(); + } -public void GenerateIcons() - { - icons = new ImageIcon[3]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[2]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - Graphics2D g2; - Color transparent = new Color(0,0,0,0); - - // 0 = blue - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.blue); - g.fillRect(12,0,4,24); - g.fillRect(8,4,12,16); - g.fillRect(4,6,20,12); - g.fillRect(0,10,28,4); - g.fillRect(0,4,4,2); - g.fillRect(0,18,4,2); - g.fillRect(24,4,4,2); - g.fillRect(24,18,4,2); + public void GenerateIcons() { + icons = new ImageIcon[3]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[2] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + Graphics2D g2; + Color transparent = new Color(0, 0, 0, 0); - // 1 = orange - try - { - g = icons[1].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(new Color(255,128,0)); - g.fillRect(12,0,4,24); - g.fillRect(8,4,12,16); - g.fillRect(4,6,20,12); - g.fillRect(0,10,28,4); - g.fillRect(0,4,4,2); - g.fillRect(0,18,4,2); - g.fillRect(24,4,4,2); - g.fillRect(24,18,4,2); - - // 2 = white - try - { - g = icons[2].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.white); - g.fillRect(12,0,4,24); - g.fillRect(8,4,12,16); - g.fillRect(4,6,20,12); - g.fillRect(0,10,28,4); - g.fillRect(0,4,4,2); - g.fillRect(0,18,4,2); - g.fillRect(24,4,4,2); - g.fillRect(24,18,4,2); - - currentIcon = icons[color].getImage(); - if (charge==0) - currentIcon = icons[2].getImage(); - } + // 0 = blue + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.blue); + g.fillRect(12, 0, 4, 24); + g.fillRect(8, 4, 12, 16); + g.fillRect(4, 6, 20, 12); + g.fillRect(0, 10, 28, 4); + g.fillRect(0, 4, 4, 2); + g.fillRect(0, 18, 4, 2); + g.fillRect(24, 4, 4, 2); + g.fillRect(24, 18, 4, 2); -public void Decorate() - { - if (charge>0) - { - color = 1-color; - currentIcon = icons[color].getImage(); - } - else - currentIcon = icons[2].getImage(); - } + // 1 = orange + try { + g = icons[1].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(new Color(255, 128, 0)); + g.fillRect(12, 0, 4, 24); + g.fillRect(8, 4, 12, 16); + g.fillRect(4, 6, 20, 12); + g.fillRect(0, 10, 28, 4); + g.fillRect(0, 4, 4, 2); + g.fillRect(0, 18, 4, 2); + g.fillRect(24, 4, 4, 2); + g.fillRect(24, 18, 4, 2); + + // 2 = white + try { + g = icons[2].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.white); + g.fillRect(12, 0, 4, 24); + g.fillRect(8, 4, 12, 16); + g.fillRect(4, 6, 20, 12); + g.fillRect(0, 10, 28, 4); + g.fillRect(0, 4, 4, 2); + g.fillRect(0, 18, 4, 2); + g.fillRect(24, 4, 4, 2); + g.fillRect(24, 18, 4, 2); + + currentIcon = icons[color].getImage(); + if (charge == 0) { + currentIcon = icons[2].getImage(); + } + } + + public void Decorate() { + if (charge > 0) { + color = 1 - color; + currentIcon = icons[color].getImage(); + } + else { + currentIcon = icons[2].getImage(); + } + } } diff --git a/src/com/droidquest/items/Disk.java b/src/com/droidquest/items/Disk.java index d33a10d..c331113 100644 --- a/src/com/droidquest/items/Disk.java +++ b/src/com/droidquest/items/Disk.java @@ -1,94 +1,85 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Graphics; +import com.droidquest.Room; +import com.droidquest.materials.Material; + +import javax.swing.*; +import java.awt.*; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import javax.swing.ImageIcon; +public class Disk extends Item { + private transient Room helpRoom = null; + private Color color; + private transient Room helpCamRoom = null; -import com.droidquest.Room; -import com.droidquest.decorations.TextBox; -import com.droidquest.materials.Material; + public Disk(int X, int Y, Room r, Color col, int hr) { + x = X; + y = Y; + room = r; + color = col; + width = 28; + height = 24; + grabbable = true; + helpRoom = level.rooms.elementAt(hr); + GenerateIcons(); + } -public class Disk extends Item -{ -transient Room helpRoom = null; -Color color; -transient Room helpCamRoom = null; - -public Disk(int X, int Y, Room r, Color col, int hr) - { - x=X; y=Y; room=r; - color = col; - width=28; height=24; - grabbable=true; - helpRoom = (Room) level.rooms.elementAt(hr); - GenerateIcons(); - } - -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g.setColor(color); - g.fillRect(0,0,width,height); - g.setColor(Color.black); - g.fillRect(24,4,4,2); - g.fillRect(12,8,4,8); - g.fillRect(8,10,12,4); - g.fillRect(20,14,4,2); - g.fillRect(12,18,4,4); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g.setColor(color); + g.fillRect(0, 0, width, height); + g.setColor(Color.black); + g.fillRect(24, 4, 4, 2); + g.fillRect(12, 8, 4, 8); + g.fillRect(8, 10, 12, 4); + g.fillRect(20, 14, 4, 2); + g.fillRect(12, 18, 4, 4); + currentIcon = icons[0].getImage(); + } -public void writeRef(ObjectOutputStream s) throws IOException - { - super.writeRef(s); - s.writeInt(level.rooms.indexOf(helpRoom)); - } + public void writeRef(ObjectOutputStream s) throws IOException { + super.writeRef(s); + s.writeInt(level.rooms.indexOf(helpRoom)); + } -public void readRef(ObjectInputStream s) throws IOException - { - super.readRef(s); - helpRoom = (Room) level.FindRoom(s.readInt()); - } + public void readRef(ObjectInputStream s) throws IOException { + super.readRef(s); + helpRoom = level.FindRoom(s.readInt()); + } -public void IsDropped() - { - - int bigX = (x+width/2)/28; - int bigY = (y+height/2)/32; - Material mat = room.MaterialArray[bigY][bigX]; - if (mat.getClass().toString().endsWith("Monitor")) - { - helpCamRoom = level.helpCam.room; // Temporary storage - level.helpCam.room = helpRoom; - level.currentViewer=level.helpCam; - level.player=level.helpCam; - } - } + public void IsDropped() { -public boolean CanBePickedUp(Item item) - { - if (level.helpCam.room == room) - level.helpCam.room = helpCamRoom; - level.currentViewer = level.player; - return true; - } + int bigX = (x + width / 2) / 28; + int bigY = (y + height / 2) / 32; + Material mat = room.MaterialArray[bigY][bigX]; + if (mat.getClass().toString().endsWith("Monitor")) { + helpCamRoom = level.helpCam.room; // Temporary storage + level.helpCam.room = helpRoom; + level.currentViewer = level.helpCam; + level.player = level.helpCam; + } + } + + public boolean CanBePickedUp(Item item) { + if (level.helpCam.room == room) { + level.helpCam.room = helpCamRoom; + } + level.currentViewer = level.player; + return true; + } } diff --git a/src/com/droidquest/items/ElevatorKey.java b/src/com/droidquest/items/ElevatorKey.java index fca9039..d71d53d 100644 --- a/src/com/droidquest/items/ElevatorKey.java +++ b/src/com/droidquest/items/ElevatorKey.java @@ -8,56 +8,53 @@ import javax.swing.ImageIcon; import com.droidquest.Room; -public class ElevatorKey extends Item -{ -boolean jumping=true; +public class ElevatorKey extends Item { + private boolean jumping = true; -public ElevatorKey(int X, int Y, Room r) - { - x=X; y=Y; room=r; - width=28; height=32; - grabbable=true; - GenerateIcons(); - } + public ElevatorKey(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 32; + grabbable = true; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g.setColor(Color.white); - g.fillRect(0,0,28,32); - g.setColor(Color.black); - g.fillRect(4,4,4,2); - g.fillRect(12,4,4,2); - g.fillRect(4,8,4,2); - g.fillRect(20,8,4,2); - g.fillRect(20,26,4,2); - g.fillRect(4,14,12,4); - g.fillRect(4,22,12,4); - g.fillRect(20,12,4,12); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g.setColor(Color.white); + g.fillRect(0, 0, 28, 32); + g.setColor(Color.black); + g.fillRect(4, 4, 4, 2); + g.fillRect(12, 4, 4, 2); + g.fillRect(4, 8, 4, 2); + g.fillRect(20, 8, 4, 2); + g.fillRect(20, 26, 4, 2); + g.fillRect(4, 14, 12, 4); + g.fillRect(4, 22, 12, 4); + g.fillRect(20, 12, 4, 12); + currentIcon = icons[0].getImage(); + } -public void Animate() - { - if (carriedBy!=null) - jumping=false; - - if (jumping==true) - { - x=level.random.nextInt(8*28)+28; - y=level.random.nextInt(2*32)+(8*32); - } - } + public void Animate() { + if (carriedBy != null) { + jumping = false; + } + + if (jumping) { + x = level.random.nextInt(8 * 28) + 28; + y = level.random.nextInt(2 * 32) + (8 * 32); + } + } } \ No newline at end of file diff --git a/src/com/droidquest/items/ElevatorSwitch.java b/src/com/droidquest/items/ElevatorSwitch.java index 40d93d1..2ca5219 100644 --- a/src/com/droidquest/items/ElevatorSwitch.java +++ b/src/com/droidquest/items/ElevatorSwitch.java @@ -5,82 +5,76 @@ import com.droidquest.decorations.Arrow; import com.droidquest.materials.ElevatorOutPortal; import com.droidquest.materials.Switch; -public class ElevatorSwitch extends Switch -{ -int animationState=0; -// 0=open +public class ElevatorSwitch extends Switch { + private int animationState = 0; + // 0=open // 1=closing // 2=closing // 3=switch arrow, switch outRoom // 4=opening // 5=opening -transient static Room room; + private transient static Room room; -public ElevatorSwitch() - { - super(Switch.ROT_LEFT); - } + public ElevatorSwitch() { + super(Switch.ROT_LEFT); + } -public void TouchedByItem(Item item) - { - room = item.room; - if (animationState==0) - animationState = 1; - } + public void TouchedByItem(Item item) { + room = item.room; + if (animationState == 0) { + animationState = 1; + } + } -public void Animate() - { - super.Animate(); - switch (animationState) - { - case 0: value =false; break; - case 1: - // Play sound - value=true; - room.SetMaterial(0,7,4); - room.SetMaterial(0,10,4); - animationState++; - break; - case 2: - room.SetMaterial(0,8,4); - room.SetMaterial(0,9,4); - animationState++; - break; - case 3: - if (ElevatorOutPortal.outRoom == (Room) level.rooms.elementAt(11)) - { - for (int a=0; a 2) diff = 2; - MoveRight(diff * dir); - } - if (y != goToY) - { - int diff = Math.abs(goToY - y); - int dir = diff / (goToY - y); - if (diff > 2) diff = 2; - MoveDown(diff * dir); - } - } - else - { - behavior=0; - level.items.removeElement(carrying); - carrying = null; - StormShield ss=null; - for (int a=0; a 2) { + diff = 2; + } + MoveRight(diff * dir); + } + if (y != goToY) { + int diff = Math.abs(goToY - y); + int dir = diff / (goToY - y); + if (diff > 2) { + diff = 2; + } + MoveDown(diff * dir); + } + } + else { + behavior = 0; + level.items.removeElement(carrying); + carrying = null; + StormShield ss = null; + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item.getClass().toString().endsWith("StormShield")) { + ss = (StormShield) item; + } + } + if (ss != null) { + ss.SetRoom(null); // Removes wires + level.items.removeElement(ss); + } + room.SetMaterial(7, 7, 21); + } + } + } } diff --git a/src/com/droidquest/items/GenericRobot.java b/src/com/droidquest/items/GenericRobot.java index 28bcd1c..91ef09f 100644 --- a/src/com/droidquest/items/GenericRobot.java +++ b/src/com/droidquest/items/GenericRobot.java @@ -1,464 +1,466 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.chipstuff.Port; import com.droidquest.decorations.Spark; import com.droidquest.devices.Device; import com.droidquest.levels.Level; -import com.droidquest.materials.BatteryIn; -import com.droidquest.materials.BatteryOut; -import com.droidquest.materials.Material; -import com.droidquest.materials.PeriscopeDown; -import com.droidquest.materials.PeriscopeUp; +import com.droidquest.materials.*; -public class GenericRobot extends Item -{ -public Device devices[] = new Device[10]; -public boolean topBumper; -public boolean bottomBumper; -public boolean leftBumper; -public boolean rightBumper; -public boolean thrusterPower; -public boolean topThruster; -public boolean bottomThruster; -public boolean leftThruster; -public boolean rightThruster; -public boolean antenna; -public boolean broadcasting; -public int grabber; // use Port.ROT_ for rotations. -Color color; -public boolean periscope; -public int periscopeAnimation; -transient public boolean oldTopBumper; -transient public boolean oldBottomBumper; -transient public boolean oldLeftBumper; -transient public boolean oldRightBumper; -transient ImageIcon images[]; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; -public GenericRobot(int X, int Y, Room r, Color c) - { - x=X; y=Y; room=r; - grabber = 1; - charge=100000; - color = c; +public class GenericRobot extends Item { + public Device devices[] = new Device[10]; + public boolean topBumper; + public boolean bottomBumper; + public boolean leftBumper; + public boolean rightBumper; + public boolean thrusterPower; + public boolean topThruster; + public boolean bottomThruster; + public boolean leftThruster; + public boolean rightThruster; + public boolean antenna; + public boolean broadcasting; + public int grabber; // use Port.ROT_ for rotations. + private Color color; + public boolean periscope; + private int periscopeAnimation; + private transient boolean oldTopBumper; + private transient boolean oldBottomBumper; + private transient boolean oldLeftBumper; + private transient boolean oldRightBumper; + private transient ImageIcon[] images; + + GenericRobot(int X, int Y, Room r, Color c) { + x = X; + y = Y; + room = r; + grabber = 1; + charge = 100000; + color = c; // orgX = 32; orgY = 24; - orgX = 14; orgY = 24; + orgX = 14; + orgY = 24; // orgX = 14; orgY = 0; - width = 56; height = 42; + width = 56; + height = 42; - - InternalRoom = new Room(); - int[][] table = { - {0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0}, - {0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0}, - {0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, - {1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, - {0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0}, - {0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0} - }; - InternalRoom.RoomArray = table; - Material mat1 = Material.FindSimiliar(new Material(color, false, true)); - int mat1Index = level.materials.indexOf(mat1); - Material perUp = Material.FindSimiliar(new PeriscopeUp()); - int perUpIndex = level.materials.indexOf(perUp); - Material perDown = Material.FindSimiliar(new PeriscopeDown()); - int perDownIndex = level.materials.indexOf(perDown); - Material battIn = Material.FindSimiliar(new BatteryIn()); - int battInIndex = level.materials.indexOf(battIn); - Material battOut = Material.FindSimiliar(new BatteryOut()); - int battOutIndex = level.materials.indexOf(battOut); - ((BatteryIn)battIn).robot = this; - ((BatteryOut)battOut).robot = this; - - for (int rY=0; rY<12; rY++) - for (int rX=0; rX<20; rX++) - if (InternalRoom.RoomArray[rY][rX]==1) InternalRoom.RoomArray[rY][rX] = mat1Index; - InternalRoom.RoomArray[2][17] = perUpIndex; - InternalRoom.RoomArray[2][16] = perDownIndex; - InternalRoom.RoomArray[3][17] = perDownIndex; - InternalRoom.RoomArray[9][2] = battOutIndex; - InternalRoom.RoomArray[9][3] = battInIndex; - InternalRoom.portalItem = this; - level.rooms.addElement(InternalRoom); - InternalRoom.upRoom = null; - InternalRoom.downRoom = null; - InternalRoom.leftRoom = null; - InternalRoom.rightRoom = null; + InternalRoom = new Room(); + InternalRoom.RoomArray = new int[][]{ + {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0}, + {0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, + {0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0} + }; + + Material mat1 = Material.FindSimiliar(new Material(color, false, true)); + int mat1Index = level.materials.indexOf(mat1); + Material perUp = Material.FindSimiliar(new PeriscopeUp()); + int perUpIndex = level.materials.indexOf(perUp); + Material perDown = Material.FindSimiliar(new PeriscopeDown()); + int perDownIndex = level.materials.indexOf(perDown); + Material battIn = Material.FindSimiliar(new BatteryIn()); + int battInIndex = level.materials.indexOf(battIn); + Material battOut = Material.FindSimiliar(new BatteryOut()); + int battOutIndex = level.materials.indexOf(battOut); + ((BatteryIn) battIn).robot = this; + ((BatteryOut) battOut).robot = this; + + for (int rY = 0; rY < 12; rY++) { + for (int rX = 0; rX < 20; rX++) { + if (InternalRoom.RoomArray[rY][rX] == 1) { + InternalRoom.RoomArray[rY][rX] = mat1Index; + } + } + } + InternalRoom.RoomArray[2][17] = perUpIndex; + InternalRoom.RoomArray[2][16] = perDownIndex; + InternalRoom.RoomArray[3][17] = perDownIndex; + InternalRoom.RoomArray[9][2] = battOutIndex; + InternalRoom.RoomArray[9][3] = battInIndex; + InternalRoom.portalItem = this; + level.rooms.addElement(InternalRoom); + InternalRoom.upRoom = null; + InternalRoom.downRoom = null; + InternalRoom.leftRoom = null; + InternalRoom.rightRoom = null; // leftPortal = new Rectangle (-14,0,8,10); // rightPortal = new Rectangle (36,0,8,10); // upPortal = new Rectangle (12,-18,12,8); // downPortal = new Rectangle (10,24,12,8); // - leftPortal = new Rectangle (-28,0,8,14); - rightPortal = new Rectangle (50,0,8,14); - upPortal = new Rectangle (10,-30,12,18); - downPortal = new Rectangle (10,24,12,18); - - level.items.addElement(new PowerSwitch(17*28-4,9*32-4,InternalRoom)); + leftPortal = new Rectangle(-28, 0, 8, 14); + rightPortal = new Rectangle(50, 0, 8, 14); + upPortal = new Rectangle(10, -30, 12, 18); + downPortal = new Rectangle(10, 24, 12, 18); - GenerateIcons(); - Animate(); - } + level.items.addElement(new PowerSwitch(17 * 28 - 4, 9 * 32 - 4, InternalRoom)); -public void GenerateIcons() - { + GenerateIcons(); + Animate(); + } + + public void GenerateIcons() { // orgX = 14; orgY = 24; // width = 56; height = 42; - orgX = 14; orgY = 24; - width = 56; height = 44; - icons = new ImageIcon[1]; + orgX = 14; + orgY = 24; + width = 56; + height = 44; + icons = new ImageIcon[1]; // icons[0]= new ImageIcon(new BufferedImage(122,92,BufferedImage.TYPE_4BYTE_ABGR)); - icons[0]= new ImageIcon(new BufferedImage(84,84,BufferedImage.TYPE_4BYTE_ABGR)); - currentIcon = icons[0].getImage(); - ((BatteryIn)level.materials.elementAt(InternalRoom.RoomArray[9][3])).robot = this; - ((BatteryOut)level.materials.elementAt(InternalRoom.RoomArray[9][2])).robot = this; - images = new ImageIcon[10]; - for (int a=0; a<10; a++) - { + icons[0] = new ImageIcon(new BufferedImage(84, 84, BufferedImage.TYPE_4BYTE_ABGR)); + currentIcon = icons[0].getImage(); + ((BatteryIn) level.materials.elementAt(InternalRoom.RoomArray[9][3])).robot = this; + ((BatteryOut) level.materials.elementAt(InternalRoom.RoomArray[9][2])).robot = this; + images = new ImageIcon[10]; + for (int a = 0; a < 10; a++) { // images[a] = new ImageIcon( new BufferedImage(122,92,BufferedImage.TYPE_4BYTE_ABGR)); - images[a] = new ImageIcon( new BufferedImage(84,84,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = images[a].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); + images[a] = new ImageIcon(new BufferedImage(84, 84, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = images[a].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); // g2.clearRect(0,0,122,92); - g2.clearRect(0,0,84,84); - - switch (a) - { - case 0: // Robot Body - { - g.setColor(color); - int X=orgX+18; - int Y=orgY+6; - g.fillRect(X, Y, 22,32); - g.fillRect(X-4, Y+2, 30,28); - g.fillRect(X-8, Y+4, 38,24); - g.fillRect(X-12, Y+6, 46,20); - } - break; + g2.clearRect(0, 0, 84, 84); - case 1: // Grabber Up - g.setColor(Color.white); - { - int X=orgX+40; - int Y=orgY-16; - g.fillRect(X+0,Y+20,20,4); - g.fillRect(X+16,Y+16,4,8); - g.fillRect(X+12,Y+10,4,8); - g.fillRect(X+20,Y+10,4,8); - g.fillRect(X+12,Y+12,12,2); - g.fillRect(X+8,Y+2,4,10); - g.fillRect(X+24,Y+2,4,10); - g.fillRect(X+12,Y+0,4,4); - g.fillRect(X+20,Y+0,4,4); - break; - } - case 2: // Grabber Right - g.setColor(Color.white); - { - int X=orgX+46; - int Y=orgY+34; - g.fillRect(X+0,Y+0,4,10); - g.fillRect(X+0,Y+4,12,2); - g.fillRect(X+0,Y+8,12,2); - g.fillRect(X+8,Y+2,4,10); - g.fillRect(X+12,Y+0,4,4); - g.fillRect(X+12,Y+10,4,4); - g.fillRect(X+12,Y+0,12,2); - g.fillRect(X+12,Y+12,12,2); - g.fillRect(X+16,Y+0,4,4); - g.fillRect(X+16,Y+10,4,4); - g.fillRect(X+20,Y+2,4,4); - g.fillRect(X+20,Y+8,4,4); - } - break; - case 3: // Grabber Down - g.setColor(Color.white); - { - int X=orgX-10; - int Y=orgY+32; - g.fillRect(X+8,Y+0,12,4); - g.fillRect(X+8,Y+0,4,10); - g.fillRect(X+4,Y+8,4,8); - g.fillRect(X+12,Y+8,4,8); - g.fillRect(X+4,Y+12,12,2); - g.fillRect(X+0,Y+14,4,10); - g.fillRect(X+16,Y+14,4,10); - g.fillRect(X+4,Y+22,4,4); - g.fillRect(X+12,Y+22,4,4); - } - break; - case 4: // Grabber Left - g.setColor(Color.white); - { - int X=orgX-16; - int Y=orgY-6; - g.fillRect(X+24,Y+4,4,10); - g.fillRect(X+16,Y+4,12,2); - g.fillRect(X+16,Y+8,12,2); - g.fillRect(X+16,Y+2,4,10); - g.fillRect(X+12,Y+0,4,4); - g.fillRect(X+12,Y+10,4,4); - g.fillRect(X+4,Y+0,12,2); - g.fillRect(X+4,Y+12,12,2); - g.fillRect(X+4,Y+0,4,4); - g.fillRect(X+4,Y+10,4,4); - g.fillRect(X+0,Y+2,4,4); - g.fillRect(X+0,Y+8,4,4); - break; - } + switch (a) { + case 0: // Robot Body + { + g.setColor(color); + int X = orgX + 18; + int Y = orgY + 6; + g.fillRect(X, Y, 22, 32); + g.fillRect(X - 4, Y + 2, 30, 28); + g.fillRect(X - 8, Y + 4, 38, 24); + g.fillRect(X - 12, Y + 6, 46, 20); + } + break; - case 5: // Antenna Off - { - int X=orgX+14; - int Y=orgY-18; - g.setColor(Color.white); - g.fillRect(X,Y,12,6); - g.fillRect(X+4,Y+6,4,16); - } - break; - case 6: // Antenna On - { - int X=orgX+14; - int Y=orgY-18; - g.setColor(new Color(255,128,0)); - g.fillRect(X,Y,12,6); - g.fillRect(X+4,Y+6,4,16); - } - break; + case 1: // Grabber Up + g.setColor(Color.white); + { + int X = orgX + 40; + int Y = orgY - 16; + g.fillRect(X + 0, Y + 20, 20, 4); + g.fillRect(X + 16, Y + 16, 4, 8); + g.fillRect(X + 12, Y + 10, 4, 8); + g.fillRect(X + 20, Y + 10, 4, 8); + g.fillRect(X + 12, Y + 12, 12, 2); + g.fillRect(X + 8, Y + 2, 4, 10); + g.fillRect(X + 24, Y + 2, 4, 10); + g.fillRect(X + 12, Y + 0, 4, 4); + g.fillRect(X + 20, Y + 0, 4, 4); + break; + } + case 2: // Grabber Right + g.setColor(Color.white); + { + int X = orgX + 46; + int Y = orgY + 34; + g.fillRect(X + 0, Y + 0, 4, 10); + g.fillRect(X + 0, Y + 4, 12, 2); + g.fillRect(X + 0, Y + 8, 12, 2); + g.fillRect(X + 8, Y + 2, 4, 10); + g.fillRect(X + 12, Y + 0, 4, 4); + g.fillRect(X + 12, Y + 10, 4, 4); + g.fillRect(X + 12, Y + 0, 12, 2); + g.fillRect(X + 12, Y + 12, 12, 2); + g.fillRect(X + 16, Y + 0, 4, 4); + g.fillRect(X + 16, Y + 10, 4, 4); + g.fillRect(X + 20, Y + 2, 4, 4); + g.fillRect(X + 20, Y + 8, 4, 4); + } + break; + case 3: // Grabber Down + g.setColor(Color.white); + { + int X = orgX - 10; + int Y = orgY + 32; + g.fillRect(X + 8, Y + 0, 12, 4); + g.fillRect(X + 8, Y + 0, 4, 10); + g.fillRect(X + 4, Y + 8, 4, 8); + g.fillRect(X + 12, Y + 8, 4, 8); + g.fillRect(X + 4, Y + 12, 12, 2); + g.fillRect(X + 0, Y + 14, 4, 10); + g.fillRect(X + 16, Y + 14, 4, 10); + g.fillRect(X + 4, Y + 22, 4, 4); + g.fillRect(X + 12, Y + 22, 4, 4); + } + break; + case 4: // Grabber Left + g.setColor(Color.white); + { + int X = orgX - 16; + int Y = orgY - 6; + g.fillRect(X + 24, Y + 4, 4, 10); + g.fillRect(X + 16, Y + 4, 12, 2); + g.fillRect(X + 16, Y + 8, 12, 2); + g.fillRect(X + 16, Y + 2, 4, 10); + g.fillRect(X + 12, Y + 0, 4, 4); + g.fillRect(X + 12, Y + 10, 4, 4); + g.fillRect(X + 4, Y + 0, 12, 2); + g.fillRect(X + 4, Y + 12, 12, 2); + g.fillRect(X + 4, Y + 0, 4, 4); + g.fillRect(X + 4, Y + 10, 4, 4); + g.fillRect(X + 0, Y + 2, 4, 4); + g.fillRect(X + 0, Y + 8, 4, 4); + break; + } - case 7: // Periscope Left - { - int X = orgX+40; - int Y = orgY+5; - g.fillRect(X-10,Y-24,6,14); - g.fillRect(X-6,Y-22,12,10); - g.fillRect(X+6,Y-20,4,6); - g.fillRect(X+2,Y-12,4,18); - } - break; - case 8: // Periscope Straight - { - int X = orgX+40; - int Y = orgY+5; - g.fillRect(X-2,Y-24,12,2); - g.fillRect(X-2,Y-14,12,2); - g.fillRect(X-6,Y-22,4,2); - g.fillRect(X-6,Y-16,4,2); - g.fillRect(X+10,Y-22,4,2); - g.fillRect(X+10,Y-16,4,2); - g.fillRect(X-10,Y-20,4,4); - g.fillRect(X+2,Y-20,4,4); - g.fillRect(X+14,Y-20,4,4); - g.fillRect(X+2,Y-12,4,18); - } - break; - case 9: // Periscope Right - { - int X = orgX+40; - int Y = orgY+5; - g.fillRect(X+14,Y-24,6,14); - g.fillRect(X+2,Y-22,12,10); - g.fillRect(X-2,Y-20,4,6); - g.fillRect(X+2,Y-12,4,18); - } - break; - } - } - } + case 5: // Antenna Off + { + int X = orgX + 14; + int Y = orgY - 18; + g.setColor(Color.white); + g.fillRect(X, Y, 12, 6); + g.fillRect(X + 4, Y + 6, 4, 16); + } + break; + case 6: // Antenna On + { + int X = orgX + 14; + int Y = orgY - 18; + g.setColor(new Color(255, 128, 0)); + g.fillRect(X, Y, 12, 6); + g.fillRect(X + 4, Y + 6, 4, 16); + } + break; -public void Animate() - { - // Do Thrusting - if (charge>0 && level.electricity && (carriedBy == null) && thrusterPower) - { - if (topThruster) - MoveDown(8); - if (rightThruster) - MoveLeft(8); - if (bottomThruster) - MoveUp(8); - if (leftThruster) - MoveRight(8); - } - - if (charge>0 && level.electricity && thrusterPower) - { - Dimension d = GetXY(); - int X = d.width; - int Y = d.height; - if (topThruster) - { - level.sparks.addElement(new Spark(X-orgX+32+level.random.nextInt(24),Y-orgY+24,0,-4,room)); - level.sparks.addElement(new Spark(X-orgX+32+level.random.nextInt(24),Y-orgY+24,0,-4,room)); - charge-=2; - } - if (rightThruster) - { - level.sparks.addElement(new Spark(X-orgX+74,Y-orgY+36+level.random.nextInt(20),4,0,room)); - level.sparks.addElement(new Spark(X-orgX+74,Y-orgY+36+level.random.nextInt(20),4,0,room)); - charge-=2; - } - if (bottomThruster) - { - level.sparks.addElement(new Spark(X-orgX+32+level.random.nextInt(24),Y-orgY+64,0,4,room)); - level.sparks.addElement(new Spark(X-orgX+32+level.random.nextInt(24),Y-orgY+64,0,4,room)); - charge-=2; - } - if (leftThruster) - { - level.sparks.addElement(new Spark(X-orgX+14,Y-orgY+36+level.random.nextInt(20),-4,0,room)); - level.sparks.addElement(new Spark(X-orgX+14,Y-orgY+36+level.random.nextInt(20),-4,0,room)); - charge-=2; - } - charge--; - if (charge<0) charge=0; - } + case 7: // Periscope Left + { + int X = orgX + 40; + int Y = orgY + 5; + g.fillRect(X - 10, Y - 24, 6, 14); + g.fillRect(X - 6, Y - 22, 12, 10); + g.fillRect(X + 6, Y - 20, 4, 6); + g.fillRect(X + 2, Y - 12, 4, 18); + } + break; + case 8: // Periscope Straight + { + int X = orgX + 40; + int Y = orgY + 5; + g.fillRect(X - 2, Y - 24, 12, 2); + g.fillRect(X - 2, Y - 14, 12, 2); + g.fillRect(X - 6, Y - 22, 4, 2); + g.fillRect(X - 6, Y - 16, 4, 2); + g.fillRect(X + 10, Y - 22, 4, 2); + g.fillRect(X + 10, Y - 16, 4, 2); + g.fillRect(X - 10, Y - 20, 4, 4); + g.fillRect(X + 2, Y - 20, 4, 4); + g.fillRect(X + 14, Y - 20, 4, 4); + g.fillRect(X + 2, Y - 12, 4, 18); + } + break; + case 9: // Periscope Right + { + int X = orgX + 40; + int Y = orgY + 5; + g.fillRect(X + 14, Y - 24, 6, 14); + g.fillRect(X + 2, Y - 22, 12, 10); + g.fillRect(X - 2, Y - 20, 4, 6); + g.fillRect(X + 2, Y - 12, 4, 18); + } + break; + } + } + } + + public void Animate() { + // Do Thrusting + if (charge > 0 && level.electricity && (carriedBy == null) && thrusterPower) { + if (topThruster) { + MoveDown(8); + } + if (rightThruster) { + MoveLeft(8); + } + if (bottomThruster) { + MoveUp(8); + } + if (leftThruster) { + MoveRight(8); + } + } + + if (charge > 0 && level.electricity && thrusterPower) { + Dimension d = GetXY(); + int X = d.width; + int Y = d.height; + if (topThruster) { + level.sparks.addElement(new Spark(X - orgX + 32 + level.random.nextInt(24), Y - orgY + 24, 0, -4, room)); + level.sparks.addElement(new Spark(X - orgX + 32 + level.random.nextInt(24), Y - orgY + 24, 0, -4, room)); + charge -= 2; + } + if (rightThruster) { + level.sparks.addElement(new Spark(X - orgX + 74, Y - orgY + 36 + level.random.nextInt(20), 4, 0, room)); + level.sparks.addElement(new Spark(X - orgX + 74, Y - orgY + 36 + level.random.nextInt(20), 4, 0, room)); + charge -= 2; + } + if (bottomThruster) { + level.sparks.addElement(new Spark(X - orgX + 32 + level.random.nextInt(24), Y - orgY + 64, 0, 4, room)); + level.sparks.addElement(new Spark(X - orgX + 32 + level.random.nextInt(24), Y - orgY + 64, 0, 4, room)); + charge -= 2; + } + if (leftThruster) { + level.sparks.addElement(new Spark(X - orgX + 14, Y - orgY + 36 + level.random.nextInt(20), -4, 0, room)); + level.sparks.addElement(new Spark(X - orgX + 14, Y - orgY + 36 + level.random.nextInt(20), -4, 0, room)); + charge -= 2; + } + charge--; + if (charge < 0) { + charge = 0; + } + } - // Draw Antenna sparks around Broadcasting Antenna - if (broadcasting && level.electricity) - { - Dimension d = GetXY(); - level.sparks.addElement(new Spark(d.width-orgX+34,d.height-orgY+10, - level.random.nextInt(9)-4, - level.random.nextInt(9)-4, - room)); - } - - // Make sounds - if (topBumper) - if (oldTopBumper != topBumper) - level.PlaySound(room, Level.BUMPSOUND); - if (bottomBumper) - if (oldBottomBumper != bottomBumper) - level.PlaySound(room, Level.BUMPSOUND); - if (rightBumper) - if (oldRightBumper != rightBumper) - level.PlaySound(room, Level.BUMPSOUND); - if (leftBumper) - if (oldLeftBumper != leftBumper) - level.PlaySound(room, Level.BUMPSOUND); - if (broadcasting && level.electricity) - level.PlaySound(room, Level.BEEPSOUND); - oldTopBumper = topBumper; - oldBottomBumper = bottomBumper; - oldRightBumper = rightBumper; - oldLeftBumper = leftBumper; - - } + // Draw Antenna sparks around Broadcasting Antenna + if (broadcasting && level.electricity) { + Dimension d = GetXY(); + level.sparks.addElement(new Spark(d.width - orgX + 34, d.height - orgY + 10, + level.random.nextInt(9) - 4, + level.random.nextInt(9) - 4, + room)); + } -public void Decorate() - { - // Paint background - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,123,92); - - // Paint Robot Body - g.drawImage(images[0].getImage(), 0, 0, level); + // Make sounds + if (topBumper && !oldTopBumper) { + level.PlaySound(room, Level.BUMPSOUND); + } + if (bottomBumper && !oldBottomBumper) { + level.PlaySound(room, Level.BUMPSOUND); + } + if (rightBumper && !oldRightBumper) { + level.PlaySound(room, Level.BUMPSOUND); + } + if (leftBumper && !oldLeftBumper) { + level.PlaySound(room, Level.BUMPSOUND); + } + if (broadcasting && level.electricity) { + level.PlaySound(room, Level.BEEPSOUND); + } + oldTopBumper = topBumper; + oldBottomBumper = bottomBumper; + oldRightBumper = rightBumper; + oldLeftBumper = leftBumper; - // Draw Bumpers - if (topBumper) - g.setColor(new Color(255,128,0)); - else - g.setColor(Color.white); - g.fillRect(32,24,22,2); - - if (bottomBumper) - g.setColor(new Color(255,128,0)); - else - g.setColor(Color.white); - g.fillRect(32,66,22,2); - - if (leftBumper) - g.setColor(new Color(255,128,0)); - else - g.setColor(Color.white); - g.fillRect(12,36,4,20); + } - if (rightBumper) - g.setColor(new Color(255,128,0)); - else - g.setColor(Color.white); - g.fillRect(70,36,4,20); - - // Draw Antenna - if (antenna) - g.drawImage(images[6].getImage(), 0, 0, level); - else - g.drawImage(images[5].getImage(), 0, 0, level); - - // Draw Grabber - g.setColor(Color.white); - switch (grabber) - { - case Port.ROT_UP: - g.drawImage(images[1].getImage(), 0, 0, level); - break; - case Port.ROT_RIGHT: - g.drawImage(images[2].getImage(), 0, 0, level); - break; - case Port.ROT_DOWN: - g.drawImage(images[3].getImage(), 0, 0, level); - break; - case Port.ROT_LEFT: - g.drawImage(images[4].getImage(), 0, 0, level); - break; - } + public void Decorate() { + // Paint background + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, 123, 92); - // Draw Periscope + // Paint Robot Body + g.drawImage(images[0].getImage(), 0, 0, level); + + // Draw Bumpers + if (topBumper) { + g.setColor(new Color(255, 128, 0)); + } + else { + g.setColor(Color.white); + } + g.fillRect(32, 24, 22, 2); + + if (bottomBumper) { + g.setColor(new Color(255, 128, 0)); + } + else { + g.setColor(Color.white); + } + g.fillRect(32, 66, 22, 2); + + if (leftBumper) { + g.setColor(new Color(255, 128, 0)); + } + else { + g.setColor(Color.white); + } + g.fillRect(12, 36, 4, 20); + + if (rightBumper) { + g.setColor(new Color(255, 128, 0)); + } + else { + g.setColor(Color.white); + } + g.fillRect(70, 36, 4, 20); + + // Draw Antenna + if (antenna) { + g.drawImage(images[6].getImage(), 0, 0, level); + } + else { + g.drawImage(images[5].getImage(), 0, 0, level); + } + + // Draw Grabber + g.setColor(Color.white); + switch (grabber) { + case Port.ROT_UP: + g.drawImage(images[1].getImage(), 0, 0, level); + break; + case Port.ROT_RIGHT: + g.drawImage(images[2].getImage(), 0, 0, level); + break; + case Port.ROT_DOWN: + g.drawImage(images[3].getImage(), 0, 0, level); + break; + case Port.ROT_LEFT: + g.drawImage(images[4].getImage(), 0, 0, level); + break; + } + + // Draw Periscope // if (periscope) - if (level.currentViewer == this) - { - periscopeAnimation ++; - if (periscopeAnimation == 32) periscopeAnimation =0; - if (periscopeAnimation <8) - g.drawImage(images[7].getImage(), 0, 0, level); - if ((periscopeAnimation >=8 && periscopeAnimation <16) - || periscopeAnimation >=24) - g.drawImage(images[8].getImage(), 0, 0, level); - if (periscopeAnimation >=16 && periscopeAnimation <24) - g.drawImage(images[9].getImage(), 0, 0, level); - } - + if (level.currentViewer == this) { + periscopeAnimation++; + if (periscopeAnimation == 32) { + periscopeAnimation = 0; + } + if (periscopeAnimation < 8) { + g.drawImage(images[7].getImage(), 0, 0, level); + } + if ((periscopeAnimation >= 8 && periscopeAnimation < 16) + || periscopeAnimation >= 24) { + g.drawImage(images[8].getImage(), 0, 0, level); + } + if (periscopeAnimation >= 16 && periscopeAnimation < 24) { + g.drawImage(images[9].getImage(), 0, 0, level); + } + } + // g.setColor(Color.magenta); // g.drawRect(orgX+leftPortal.x, orgY+leftPortal.y, // leftPortal.width+28, leftPortal.height+32); @@ -468,22 +470,17 @@ public void Decorate() // upPortal.width+28, upPortal.height+32); // g.drawRect(orgX+downPortal.x, orgY+downPortal.y, // downPortal.width+28, downPortal.height+32); - - } -public boolean CanBePickedUp(Item item) - { - if (item.getClass().toString().endsWith("Robot")) - return false; - else - return super.CanBePickedUp(item); - } + } -public void Erase() - { - super.Erase(); - devices = null; - } + public boolean CanBePickedUp(Item item) { + return !item.getClass().toString().endsWith("Robot") && super.CanBePickedUp(item); + } + + public void Erase() { + super.Erase(); + devices = null; + } } diff --git a/src/com/droidquest/items/Ghost.java b/src/com/droidquest/items/Ghost.java index 4d341a2..030d4b9 100644 --- a/src/com/droidquest/items/Ghost.java +++ b/src/com/droidquest/items/Ghost.java @@ -11,183 +11,182 @@ import javax.swing.ImageIcon; import com.droidquest.Room; import com.droidquest.levels.Level; -public class Ghost extends Item -{ -int animationState = 0; // 0=Right, 1=Down, 2=Left, 3=Up +public class Ghost extends Item { + private int animationState = 0; // 0=Right, 1=Down, 2=Left, 3=Up // x values are 42, 154, 266, 378 // y values are 58, 186, 314 -transient boolean searched=false; -transient Item robot[]; + private transient boolean searched = false; + private transient Item[] robot; -public Ghost(int X, int Y, Room r) - { - x=X; y=Y; room=r; - width = 28; height = 32; - grabbable = false; - GenerateIcons(); - } + public Ghost(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 32; + grabbable = false; + GenerateIcons(); + } -public void GenerateIcons() - { - robot = new Item[4]; - icons = new ImageIcon[4]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[2]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[3]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - for (int a=0; a<4; a++) - { - try - { - g = icons[a].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.red); - g.fillArc(0,0,28,32,0,180); - g.fillRect(0,16,28,16); - g.setColor(Color.white); - g.fillOval(4,8,8,8); - g.fillOval(16,8,8,8); - g.setColor(Color.black); - switch(a) - { - case 0: // Right - g.fillOval(9,10,4,4); - g.fillOval(21,10,4,4); - break; - case 1: // Down - g.fillOval(7,12,4,4); - g.fillOval(19,12,4,4); - break; - case 2: // Left - g.fillOval(4,10,4,4); - g.fillOval(16,10,4,4); - break; - case 3: // Up - g.fillOval(7,8,4,4); - g.fillOval(19,8,4,4); - break; - } - } - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + robot = new Item[4]; + icons = new ImageIcon[4]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[2] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[3] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + for (int a = 0; a < 4; a++) { + try { + g = icons[a].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.red); + g.fillArc(0, 0, 28, 32, 0, 180); + g.fillRect(0, 16, 28, 16); + g.setColor(Color.white); + g.fillOval(4, 8, 8, 8); + g.fillOval(16, 8, 8, 8); + g.setColor(Color.black); + switch (a) { + case 0: // Right + g.fillOval(9, 10, 4, 4); + g.fillOval(21, 10, 4, 4); + break; + case 1: // Down + g.fillOval(7, 12, 4, 4); + g.fillOval(19, 12, 4, 4); + break; + case 2: // Left + g.fillOval(4, 10, 4, 4); + g.fillOval(16, 10, 4, 4); + break; + case 3: // Up + g.fillOval(7, 8, 4, 4); + g.fillOval(19, 8, 4, 4); + break; + } + } + currentIcon = icons[0].getImage(); + } -public void Animate() - { - // Positions: There are 4x3=12 "nodes" where the ghost travels to - // and from. Every time the ghost reaches a node position, it looks - // around for any robots in the area. If it sees a robot it then - // heads in that direction. Robots that are hit are put in the - // penalty box and drained of energy. If no robot is found it moves - // in a random direction. + public void Animate() { + // Positions: There are 4x3=12 "nodes" where the ghost travels to + // and from. Every time the ghost reaches a node position, it looks + // around for any robots in the area. If it sees a robot it then + // heads in that direction. Robots that are hit are put in the + // penalty box and drained of energy. If no robot is found it moves + // in a random direction. - if (!searched) - { - int rcounter = 0; - for (int a=0; a0) - animationState=1; - else - animationState=3; - } - else - { - if (dx>0) - animationState=0; - else - animationState=2; - } - } - } - } - } - if (!decision) - { - boolean good; - int backwards = (animationState+2)%4; - do - { - good = true; - animationState = level.random.nextInt(4); - if (animationState==0 && x==378) good=false; - if (animationState==1 && y==304) good=false; - if (animationState==2 && x== 42) good=false; - if (animationState==3 && y== 48) good=false; - if (animationState==backwards) good=false; - } - while (!good); - } - } - - switch (animationState) - { - case 0: // Right - MoveRight(4); - break; - case 1: // Down - MoveDown(4); - break; - case 2: // Left - MoveLeft(4); - break; - case 3: // Up - MoveUp(4); - break; - } - currentIcon = icons[animationState].getImage(); + if (!searched) { + int rcounter = 0; + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item instanceof GenericRobot) { + robot[rcounter] = item; + rcounter++; + } + } + searched = true; + } - for (int a=0; a<4; a++) - if (robot[a] != null) - if (Overlaps(robot[a])) - { - robot[a].charge=0; - level.PlaySound(room, Level.DISCHARGESOUND); - robot[a].x = 16*28+14; - robot[a].y = 32; - } - } + boolean flag = false; + if (((x == 42) || (x == 154) || (x == 266) || (x == 378)) + && ((y == 48) || (y == 176) || (y == 304))) { + flag = true; + } + + if (flag) { + boolean decision = false; + for (Item aRobot : robot) { + if (aRobot != null) { + if (aRobot.room == room) { + Dimension d = aRobot.GetXY(); + if (d.width < 14 * 28) { + int dx = (d.width + aRobot.width / 2) - (x + width / 2); + int dy = (d.height + aRobot.height / 2) - (y + height / 2); + if ((Math.abs(dx) < 56) || (Math.abs(dy) < 64)) { + decision = true; + if (Math.abs(dx) < 56) { + if (dy > 0) { + animationState = 1; + } + else { + animationState = 3; + } + } + else { + if (dx > 0) { + animationState = 0; + } + else { + animationState = 2; + } + } + } + } + } + } + } + if (!decision) { + boolean good; + int backwards = (animationState + 2) % 4; + do { + good = true; + animationState = level.random.nextInt(4); + if (animationState == 0 && x == 378) { + good = false; + } + if (animationState == 1 && y == 304) { + good = false; + } + if (animationState == 2 && x == 42) { + good = false; + } + if (animationState == 3 && y == 48) { + good = false; + } + if (animationState == backwards) { + good = false; + } + } + while (!good); + } + } + + switch (animationState) { + case 0: // Right + MoveRight(4); + break; + case 1: // Down + MoveDown(4); + break; + case 2: // Left + MoveLeft(4); + break; + case 3: // Up + MoveUp(4); + break; + } + currentIcon = icons[animationState].getImage(); + + for (int a = 0; a < 4; a++) { + if (robot[a] != null) { + if (Overlaps(robot[a])) { + robot[a].charge = 0; + level.PlaySound(room, Level.DISCHARGESOUND); + robot[a].x = 16 * 28 + 14; + robot[a].y = 32; + } + } + } + } } diff --git a/src/com/droidquest/items/Handle.java b/src/com/droidquest/items/Handle.java index 6779572..109ecd3 100644 --- a/src/com/droidquest/items/Handle.java +++ b/src/com/droidquest/items/Handle.java @@ -1,93 +1,83 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.event.KeyEvent; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; -public class Handle extends Item -{ - // Handle used to pull sliding wall +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.image.BufferedImage; - public Handle(int X, int Y, Room r) - { - x=X; y=Y; room=r; - width=28; height=12; - GenerateIcons(); - } +public class Handle extends Item { + // Handle used to pull sliding wall - public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.white); - g.fillRect(0,4,16,4); - g.fillRect(16,2,12,8); - g.fillRect(20,0,4,12); - currentIcon = icons[0].getImage(); - } + public Handle(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 12; + GenerateIcons(); + } - public boolean CanBePickedUp(Item item) - { - if (item != level.player) return false; - PicksUp(item); - level.player = this; - return false; - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.white); + g.fillRect(0, 4, 16, 4); + g.fillRect(16, 2, 12, 8); + g.fillRect(20, 0, 4, 12); + currentIcon = icons[0].getImage(); + } - public boolean KeyUp(KeyEvent e) - { - if (e.getKeyCode() == e.VK_RIGHT) - { - if (x<15*28) - { - room.SetMaterial(x/28-12, 4, 0); - MoveRight(28); - room.SetMaterial(x/28-1, 4, 8); - } - } + public boolean CanBePickedUp(Item item) { + if (item != level.player) { + return false; + } + PicksUp(item); + level.player = this; + return false; + } - if (e.getKeyCode() == e.VK_LEFT) - { - if (x>13*28) - { - room.SetMaterial(x/28-13, 4, 8); - room.SetMaterial(x/28-1, 4, 0); - MoveLeft(28); - } - } + public boolean KeyUp(KeyEvent e) { + if (e.getKeyCode() == e.VK_RIGHT) { + if (x < 15 * 28) { + room.SetMaterial(x / 28 - 12, 4, 0); + MoveRight(28); + room.SetMaterial(x / 28 - 1, 4, 8); + } + } - if (e.getKeyCode() == e.VK_SPACE) - { - level.player=carrying; - Drops(); - room.SetMaterial(1, 4, 8); - room.SetMaterial(2, 4, 8); - room.SetMaterial(13, 4, 0); - room.SetMaterial(14, 4, 0); - x=13*28; - } - return false; - } + if (e.getKeyCode() == e.VK_LEFT) { + if (x > 13 * 28) { + room.SetMaterial(x / 28 - 13, 4, 8); + room.SetMaterial(x / 28 - 1, 4, 0); + MoveLeft(28); + } + } - } + if (e.getKeyCode() == e.VK_SPACE) { + level.player = carrying; + Drops(); + room.SetMaterial(1, 4, 8); + room.SetMaterial(2, 4, 8); + room.SetMaterial(13, 4, 0); + room.SetMaterial(14, 4, 0); + x = 13 * 28; + } + return false; + } + +} diff --git a/src/com/droidquest/items/Hexagon.java b/src/com/droidquest/items/Hexagon.java index 7c1915b..e9cd534 100644 --- a/src/com/droidquest/items/Hexagon.java +++ b/src/com/droidquest/items/Hexagon.java @@ -9,42 +9,40 @@ import javax.swing.ImageIcon; import com.droidquest.Room; -public class Hexagon extends Item -{ -Color color; +public class Hexagon extends Item { + private Color color; -public Hexagon(int X, int Y, Room r, Color c) - { - x=X; y=Y; room=r; - width=28; height=28; - color = c; - editable=true; - GenerateIcons(); - } + public Hexagon(int X, int Y, Room r, Color c) { + x = X; + y = Y; + room = r; + width = 28; + height = 28; + color = c; + editable = true; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(color); - int[] xp = { 7, 21, 27, 21, 7, 0}; - int[] yp = { 0, 0, 14, 27, 27, 14}; - g.fillPolygon(xp,yp,6); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(color); + int[] xp = {7, 21, 27, 21, 7, 0}; + int[] yp = {0, 0, 14, 27, 27, 14}; + g.fillPolygon(xp, yp, 6); + currentIcon = icons[0].getImage(); + } } diff --git a/src/com/droidquest/items/HiddenCamera.java b/src/com/droidquest/items/HiddenCamera.java index 85ef835..450968e 100644 --- a/src/com/droidquest/items/HiddenCamera.java +++ b/src/com/droidquest/items/HiddenCamera.java @@ -6,17 +6,17 @@ import javax.swing.JPanel; import com.droidquest.Room; -public class HiddenCamera extends Item -{ -public HiddenCamera(Room r) - { - x=0; y=0; - room = r; - width=0; height=0; - grabbable=false; - } +public class HiddenCamera extends Item { + public HiddenCamera(Room r) { + x = 0; + y = 0; + room = r; + width = 0; + height = 0; + grabbable = false; + } -public void Draw(Graphics g, JPanel jp) - {} + public void Draw(Graphics g, JPanel jp) { + } } diff --git a/src/com/droidquest/items/Initializer.java b/src/com/droidquest/items/Initializer.java index 7e511c1..3bfc879 100644 --- a/src/com/droidquest/items/Initializer.java +++ b/src/com/droidquest/items/Initializer.java @@ -1,13 +1,16 @@ package com.droidquest.items; -public class Initializer extends Item -{ -public Initializer() - { - width=0; height=0; x=0; y=0; room=null; - } +public class Initializer extends Item { + protected Initializer() { + width = 0; + height = 0; + x = 0; + y = 0; + room = null; + } -public void Init() {} + public void Init() { + } } \ No newline at end of file diff --git a/src/com/droidquest/items/Item.java b/src/com/droidquest/items/Item.java index a159b36..d32bb98 100644 --- a/src/com/droidquest/items/Item.java +++ b/src/com/droidquest/items/Item.java @@ -1,10 +1,13 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Image; -import java.awt.Rectangle; +import com.droidquest.Room; +import com.droidquest.Wire; +import com.droidquest.devices.Device; +import com.droidquest.levels.Level; +import com.droidquest.materials.ChipTrash; + +import javax.swing.*; +import java.awt.*; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; @@ -13,700 +16,744 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import javax.swing.ImageIcon; -import javax.swing.JPanel; +public class Item implements Serializable, Cloneable { + public transient static Level level; + public transient Item carrying; // What this item is carrying. + public transient Item carriedBy; // What is carrying this item. + public transient Image currentIcon; // Current image of this item. + public transient ImageIcon[] icons; // Array of images for this item + public transient Room room; // Room this item is currently in + private transient Color outline; // Null, White, Grey + public transient int automove; // 0=normal movement, 1=Move to autoX,autoY, 2=Move in autoX,autoY + public transient int autoX; // Destination of automovement + public transient int autoY; // Destination of automovement + public Room InternalRoom = null; // Room inside this item, if any. -import com.droidquest.Room; -import com.droidquest.Wire; -import com.droidquest.devices.Device; -import com.droidquest.levels.Level; -import com.droidquest.materials.ChipTrash; + protected int repeating = 0; // Keyboard repeat. + public int charge = 0; // Battery Charge of this item, if any. + public boolean grabbable = true; // Can this item be picked up? + public int x, y; // Position X,Y + int orgX; + int orgY; // origin, within graphics + protected int width, height; // width & height of object from origin + protected Rectangle leftPortal; + protected Rectangle rightPortal; + protected Rectangle upPortal; + protected Rectangle downPortal; + public boolean editable = false; -public class Item implements Serializable, Cloneable -{ - public transient static Level level; - public transient Item carrying; // What this item is carrying. - public transient Item carriedBy; // What is carrying this item. - public transient Image currentIcon; // Current image of this item. - public transient ImageIcon[] icons; // Array of images for this item - public transient Room room; // Room this item is currently in - public transient Color outline; // Null, White, Grey - public transient int automove; // 0=normal movement, 1=Move to autoX,autoY, 2=Move in autoX,autoY - public transient int autoX; // Destination of automovement - public transient int autoY; // Destination of automovement - public Room InternalRoom = null; // Room inside this item, if any. + protected Item() { + x = 0; + y = 0; + } - protected int repeating=0; // Keyboard repeat. - public int charge =0; // Battery Charge of this item, if any. - public boolean grabbable=true; // Can this item be picked up? - public int x,y; // Position X,Y - protected int orgX, orgY; // origin, within graphics - protected int width, height; // width & height of object from origin - public Rectangle leftPortal; - public Rectangle rightPortal; - public Rectangle upPortal; - public Rectangle downPortal; - public boolean editable=false; + public Item(String filename, int X, int Y, Room r) { + x = X; + y = Y; + room = r; + grabbable = true; + // icons = new Image[1]; + // icons[0]=Toolkit.getDefaultToolkit().getImage(filename); + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(filename); + currentIcon = icons[0].getImage(); + } - public Item() - { - x=0; y=0; - } + public void writeRef(ObjectOutputStream s) throws IOException { + s.writeInt(level.items.indexOf(carrying)); + s.writeInt(level.items.indexOf(carriedBy)); + s.writeInt(level.rooms.indexOf(room)); + s.writeInt(level.rooms.indexOf(InternalRoom)); + } - public Item(String filename, int X, int Y, Room r) - { - x=X; y=Y; - room = r; - grabbable = true; - // icons = new Image[1]; - // icons[0]=Toolkit.getDefaultToolkit().getImage(filename); - icons = new ImageIcon[1]; - icons[0]=new ImageIcon(filename); - currentIcon = icons[0].getImage(); - } + public void readRef(ObjectInputStream s) throws IOException { + carrying = level.FindItem(s.readInt()); + carriedBy = level.FindItem(s.readInt()); + room = level.FindRoom(s.readInt()); + InternalRoom = level.FindRoom(s.readInt()); + GenerateIcons(); + } - public void writeRef(ObjectOutputStream s) throws IOException - { - s.writeInt(level.items.indexOf(carrying)); - s.writeInt(level.items.indexOf(carriedBy)); - s.writeInt(level.rooms.indexOf(room)); - s.writeInt(level.rooms.indexOf(InternalRoom)); - } + public Image getIcon() { + return currentIcon; + } - public void readRef(ObjectInputStream s) throws IOException - { - carrying = level.FindItem(s.readInt()); - carriedBy = level.FindItem(s.readInt()); - room = level.FindRoom(s.readInt()); - InternalRoom = level.FindRoom(s.readInt()); - GenerateIcons(); - } + public int getWidth() { + return width; + } - public Image getIcon() - { - return currentIcon; - } + public int getHeight() { + return height; + } - public int getWidth() - { - return width; - } + public int getX() { + return (x - orgX); + } - public int getHeight() - { - return height; - } + public int getY() { + return (y - orgY); + } - public int getX() - { - return (x-orgX); - } + public Room getRoom() { + return room; + } - public int getY() - { - return (y-orgY); - } + public void PicksUp(Item item) { + // This picks up an item + if (carrying == null) { + if (item.CanBePickedUp(this) && item.carriedBy == null) { + carrying = item; + item.carriedBy = this; + item.x -= x; + item.y -= y; + item.outline = Color.white; + level.PlaySound(room, Level.PICKUPSOUND); + } + } + } - public Room getRoom() - { - return room; - } + public void Drops() { + // This drops the carried item + if (carrying != null) { + Item item = carrying; + carrying.carriedBy = null; + Dimension d = GetXY(); + carrying.x += d.width; + carrying.y += d.height; + if (carrying.x < 0) { + carrying.x += 560; + carrying.room = room.leftRoom; + } + if (carrying.y < 0) { + carrying.y += 384; + carrying.room = room.upRoom; + } + if (carrying.x > 559) { + carrying.x -= 560; + carrying.room = room.rightRoom; + } + if (carrying.y > 383) { + carrying.y -= 384; + carrying.room = room.downRoom; + } + carrying = null; + outline = new Color(128, 128, 128); + item.IsDropped(); + level.PlaySound(room, Level.DROPSOUND); + } + } - public void PicksUp(Item item) - { - // This picks up an item - if (carrying == null) - if (item.CanBePickedUp(this) == true && item.carriedBy == null) - { - carrying = item; - item.carriedBy = this; - item.x -= x; - item.y -= y; - item.outline=Color.white; - level.PlaySound(room,Level.PICKUPSOUND); - } - } + protected void IsDropped() { + if (!editable) { + return; + } - public void Drops() - { - // This drops the carried item - if (carrying != null) - { - Item item = carrying; - carrying.carriedBy = null; - Dimension d = GetXY(); - carrying.x += d.width; - carrying.y += d.height; - if (carrying.x<0) - { - carrying.x += 560; - carrying.room = room.leftRoom; - } - if (carrying.y<0) - { - carrying.y += 384; - carrying.room = room.upRoom; - } - if (carrying.x>559) - { - carrying.x -= 560; - carrying.room = room.rightRoom; - } - if (carrying.y>383) - { - carrying.y -= 384; - carrying.room = room.downRoom; - } - carrying = null; - outline=new Color(128,128,128); - item.IsDropped(); - level.PlaySound(room, Level.DROPSOUND); - } - } + int bigXl = (x) / 28; + int bigXr = (x + width - 1) / 28; + int bigYt = (y) / 32; + int bigYb = (y + height - 1) / 32; - public void IsDropped() - { - if (!editable) return; + if (bigXr > 19) { + bigXr = 19; + } + if (bigYb > 11) { + bigYb = 11; + } - int bigXl = (x)/28; - int bigXr = (x+width-1)/28; - int bigYt = (y)/32; - int bigYb = (y+height-1)/32; + for (int a = bigYt; a <= bigYb; a++) { + for (int b = bigXl; b <= bigXr; b++) { + if (room.MaterialArray[a][b] instanceof ChipTrash) { + SetRoom(null); // Cheap way to remove the wires; + level.items.removeElement(this); + level.PlaySound(room, Level.DISCHARGESOUND); + return; + } + } + } - if (bigXr>19) bigXr=19; - if (bigYb>11) bigYb=11; + } - for (int a=bigYt; a<=bigYb; a++) - for (int b=bigXl; b<=bigXr; b++) - { - if (room.MaterialArray[a][b] instanceof ChipTrash) - { - SetRoom(null); // Cheap way to remove the wires; - level.items.removeElement(this); - level.PlaySound(room,Level.DISCHARGESOUND); - return; - } - } + public void SetRoom(Room r) { + // Goes through recursively from Item to carried item to carried + // item.... Puts all items in the same room. + Room cr = r; + if (r != room) { + if (isDevice()) { + Device device = (Device) this; + for (int a = 0; a < device.ports.length; a++) { + if (device.ports[a].myWire != null) { + Wire wire = device.ports[a].myWire; + wire.Remove(); + } + } + } + } + if (carriedBy == null) { + if (x < 0) { + cr = r.leftRoom; + x += 560; + } + if (y < 0) { + cr = r.upRoom; + y += 384; + } + if (x >= 560) { + cr = r.rightRoom; + x -= 560; + } + if (y >= 384) { + cr = r.downRoom; + y -= 384; + } + } + room = cr; + automove = 0; + if (carrying != null) { + carrying.SetRoom(cr); + } + } - return; - } + public boolean KeyUp(KeyEvent e) { + // Handles keybord input. + // Return TRUE if repaint is needed (usually for movement) + return false; + } - public void SetRoom(Room r) - { - // Goes through recursively from Item to carried item to carried - // item.... Puts all items in the same room. - Room cr = r; - if (r != room) - if (isDevice()) - { - Device device = (Device) this; - for (int a = 0; a=560) { cr=r.rightRoom; x-=560; } - if (y>=384) { cr=r.downRoom; y-=384; } - } - room = cr; - automove=0; - if (carrying != null) - carrying.SetRoom(cr); - } + public boolean KeyDown(KeyEvent e) { + // Handles keybord input. + // Return TRUE if repaint is needed (usually for movement) + return false; + } - public boolean KeyUp(KeyEvent e) - { - // Handles keybord input. - // Return TRUE if repaint is needed (usually for movement) - return false; - } + public void MouseClick(MouseEvent e) { + int button = 0; + if ((e.getModifiers() & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) { + button = 1; + } + if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { + button = 3; + } - public boolean KeyDown(KeyEvent e) - { - // Handles keybord input. - // Return TRUE if repaint is needed (usually for movement) - return false; - } + if (button == 1) { + if (e.getClickCount() == 1) { + autoX = e.getX() - width / 2; + autoY = e.getY() - height / 2; + autoX -= autoX % 2; // Even numbered pixel only! + autoY -= autoY % 2; + automove = 1; + } + else if (e.getClickCount() == 2) { + int dx = e.getX() - width / 2 - x; + int dy = e.getY() - height / 2 - y; + if (Math.abs(dx) > Math.abs(dy)) { + autoY = 0; + autoX = 28; + if (dx < 0) { + autoX = -28; + } + automove = 2; + } + else { + autoX = 0; + autoY = 32; + if (dy < 0) { + autoY = -32; + } + automove = 2; + } + } + } - public void MouseClick(MouseEvent e) - { - int button=0; - if ((e.getModifiers() & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) - button = 1; - if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) - button = 3; + if (button == 3) { + KeyEvent k = new KeyEvent(e.getComponent(), e.getID(), + e.getWhen(), 0, + KeyEvent.VK_SPACE, ' '); + KeyUp(k); + } - if (button==1) - { - if (e.getClickCount()==1) - { - autoX = e.getX() - width/2; - autoY = e.getY() - height/2; - autoX -= autoX%2; // Even numbered pixel only! - autoY -= autoY%2; - automove = 1; - } - else if (e.getClickCount()==2) - { - int dx = e.getX() - width/2 - x; - int dy = e.getY() - height/2 - y; - if (Math.abs(dx) > Math.abs(dy)) - { - autoY=0; autoX=28; - if (dx<0) autoX=-28; - automove=2; - } - else - { - autoX=0; autoY=32; - if (dy<0) autoY=-32; - automove=2; - } - } - } + } - if (button==3) - { - KeyEvent k = new KeyEvent(e.getComponent(), e.getID(), - e.getWhen(), 0, - KeyEvent.VK_SPACE,' '); - KeyUp(k); - } + protected void MoveUp(int dist) { + int bigXl = x / 28; + int bigXr = (x + getWidth() - 1) / 28; + int bigY = (y - dist) / 32; + if ((!level.materialAt(bigXl, bigY, room).Passable(this)) + || (!level.materialAt(bigXr, bigY, room).Passable(this))) { + automove = 0; + y = (bigY + 1) * 32; + ItemEffectsMaterials(); + return; + } + y = y - dist; + if (y < 0) { + if (room.getUpRoom(this) != null) { // change Rooms + y = y + 384; + SetRoom(room.getUpRoom(this)); + } + else if (this == level.player && room.portalItem != null) { // Exit item, Player only + Dimension d = room.portalItem.GetXY(); + x = d.width + (room.portalItem.width - width) / 2; + y = d.height + (room.portalItem.height - height) / 2; + SetRoom(room.portalItem.room); + MoveUp(dist); + } + else { // stop at top + y += 384; + automove = 0; + } + } + ItemEffectsMaterials(); + } - } + protected void MoveDown(int dist) { + int bigXl = x / 28; + int bigXr = (x + getWidth() - 1) / 28; + int bigY = (y + getHeight() - 1 + dist) / 32; + if ((!level.materialAt(bigXl, bigY, room).Passable(this)) + || (!level.materialAt(bigXr, bigY, room).Passable(this))) { + automove = 0; + int newDist = bigY * 32 - getHeight() - y; + y += newDist; + ItemEffectsMaterials(); + return; + } + y = y + dist; + if (y > 383) { + if (room.getDownRoom(this) != null) { // change Rooms + y = y - 384; + SetRoom(room.getDownRoom(this)); + } + else if (this == level.player && room.portalItem != null) { // Exit item, GameCursor only + Dimension d = room.portalItem.GetXY(); + x = d.width + (room.portalItem.width - width) / 2; + y = d.height + (room.portalItem.height - height) / 2; + SetRoom(room.portalItem.room); + MoveDown(dist); + } + else { // stop at bottom + y -= 384; + automove = 0; + } + } + ItemEffectsMaterials(); + } - public void MoveUp(int dist) - { - int bigXl = x/28; - int bigXr = (x+getWidth()-1)/28; - int bigY = (y-dist)/32; - if ( (level.materialAt(bigXl,bigY,room).Passable(this) == false) - || (level.materialAt(bigXr,bigY,room).Passable(this) == false) ) - { - automove=0; - int newDist = y - (bigY+1)*32; - y = (bigY+1)*32; - ItemEffectsMaterials(); - return; - } - y=y-dist; - if (y<0) - { - if (room.getUpRoom(this) != null) - { // change Rooms - y=y+384; - SetRoom(room.getUpRoom(this)); - } - else if (this==level.player && room.portalItem != null) - { // Exit item, Player only - Dimension d = room.portalItem.GetXY(); - x = d.width + (room.portalItem.width - width)/2; - y = d.height + (room.portalItem.height - height)/2; - SetRoom(room.portalItem.room); - MoveUp(dist); - } - else - { // stop at top - y+=384; - automove=0; - } - } - ItemEffectsMaterials(); - } + protected void MoveLeft(int dist) { + int bigX = (x - dist) / 28; + int bigYt = y / 32; + int bigYb = (y + getHeight() - 1) / 32; + if ((!level.materialAt(bigX, bigYt, room).Passable(this)) + || (!level.materialAt(bigX, bigYb, room).Passable(this))) { + automove = 0; + x = (bigX + 1) * 28; + ItemEffectsMaterials(); + return; + } + x = x - dist; + if (x < 0) { + if (room.getLeftRoom(this) != null) { // change Rooms + x = x + 560; + SetRoom(room.getLeftRoom(this)); + } + else if (this == level.player && room.portalItem != null) { // Exit item, GameCursor only + Dimension d = room.portalItem.GetXY(); + x = d.width + (room.portalItem.width - width) / 2; + y = d.height + (room.portalItem.height - height) / 2; + SetRoom(room.portalItem.room); + MoveLeft(dist); + } + else { // stop at Left + x += 560; + automove = 0; + } + } + ItemEffectsMaterials(); + } - public void MoveDown(int dist) - { - int bigXl = x/28; - int bigXr = (x+getWidth()-1)/28; - int bigY = (y+getHeight()-1+dist)/32; - if ( (level.materialAt(bigXl,bigY,room).Passable(this) == false) - || (level.materialAt(bigXr,bigY,room).Passable(this) == false) ) - { - automove=0; - int newDist = bigY*32 - getHeight() - y; - y += newDist; - ItemEffectsMaterials(); - return; - } - y=y+dist; - if (y>383) - { - if (room.getDownRoom(this) != null) - { // change Rooms - y=y-384; - SetRoom(room.getDownRoom(this)); - } - else if (this==level.player && room.portalItem != null) - { // Exit item, GameCursor only - Dimension d = room.portalItem.GetXY(); - x = d.width + (room.portalItem.width - width)/2; - y = d.height + (room.portalItem.height - height)/2; - SetRoom(room.portalItem.room); - MoveDown(dist); - } - else - { // stop at bottom - y-=384; - automove=0; - } - } - ItemEffectsMaterials(); - } + protected void MoveRight(int dist) { + int bigX = (x + getWidth() - 1 + dist) / 28; + int bigYt = y / 32; + int bigYb = (y + getHeight() - 1) / 32; + // if (bigX<20 && bigYb<20 && bigYt>=0) + if ((!level.materialAt(bigX, bigYt, room).Passable(this)) + || (!level.materialAt(bigX, bigYb, room).Passable(this))) { + automove = 0; + int newDist = bigX * 28 - getWidth() - x; + x += newDist; + ItemEffectsMaterials(); + return; + } + x = x + dist; + if (x > 559) { + if (room.getRightRoom(this) != null) { // change Rooms + x = x - 560; + SetRoom(room.getRightRoom(this)); + } + else if (this == level.player && room.portalItem != null) { // Exit item, GameCursor only + Dimension d = room.portalItem.GetXY(); + x = d.width + (room.portalItem.width - width) / 2; + y = d.height + (room.portalItem.height - height) / 2; + SetRoom(room.portalItem.room); + MoveRight(dist); + } + else { // stop at Right + x -= 560; + automove = 0; + } + } + ItemEffectsMaterials(); + } - public void MoveLeft(int dist) - { - int bigX = (x-dist)/28; - int bigYt = y/32; - int bigYb = (y+getHeight()-1)/32; - if ( (level.materialAt(bigX,bigYt,room).Passable(this) == false) - || (level.materialAt(bigX,bigYb,room).Passable(this) == false) ) - { - automove=0; - int newDist = x - (bigX+1)*28 ; - x = (bigX+1)*28; - ItemEffectsMaterials(); - return; - } - x=x-dist; - if (x<0) - { - if (room.getLeftRoom(this) != null) - { // change Rooms - x=x+560; - SetRoom(room.getLeftRoom(this)); - } - else if (this==level.player && room.portalItem != null) - { // Exit item, GameCursor only - Dimension d = room.portalItem.GetXY(); - x = d.width + (room.portalItem.width - width)/2; - y = d.height + (room.portalItem.height - height)/2; - SetRoom(room.portalItem.room); - MoveLeft(dist); - } - else - { // stop at Left - x+=560; - automove=0; - } - } - ItemEffectsMaterials(); - } + protected void MoveUp(boolean nudge) { + int dist = 32; + if (nudge) { + dist = 2; + } + MoveUp(dist); + } - public void MoveRight(int dist) - { - int bigX = (x+getWidth()-1+dist)/28; - int bigYt = y/32; - int bigYb = (y+getHeight()-1)/32; - // if (bigX<20 && bigYb<20 && bigYt>=0) - if ( (level.materialAt(bigX,bigYt,room).Passable(this) == false) - || (level.materialAt(bigX,bigYb,room).Passable(this) == false) ) - { - automove=0; - int newDist = bigX*28 - getWidth()- x; - x += newDist; - ItemEffectsMaterials(); - return; - } - x=x+dist; - if (x>559) - { - if (room.getRightRoom(this) != null) - { // change Rooms - x=x-560; - SetRoom(room.getRightRoom(this)); - } - else if (this==level.player && room.portalItem != null) - { // Exit item, GameCursor only - Dimension d = room.portalItem.GetXY(); - x = d.width + (room.portalItem.width - width)/2; - y = d.height + (room.portalItem.height - height)/2; - SetRoom(room.portalItem.room); - MoveRight(dist); - } - else - { // stop at Right - x-=560; - automove=0; - } - } - ItemEffectsMaterials(); - } + protected void MoveDown(boolean nudge) { + int dist = 32; + if (nudge) { + dist = 2; + } + MoveDown(dist); + } - public void MoveUp(boolean nudge) - { - int dist = 32; - if (nudge) dist = 2; - MoveUp(dist); - } + protected void MoveLeft(boolean nudge) { + int dist = 28; + if (nudge) { + dist = 2; + } + MoveLeft(dist); + } - public void MoveDown(boolean nudge) - { - int dist = 32; - if (nudge) dist = 2; - MoveDown(dist); - } + protected void MoveRight(boolean nudge) { + int dist = 28; + if (nudge) { + dist = 2; + } + MoveRight(dist); + } - public void MoveLeft(boolean nudge) - { - int dist = 28; - if (nudge) dist = 2; - MoveLeft(dist); - } + public void Animate() { + if (automove == 1 && room == null) { + automove = 0; + } + if (automove == 1) { + int dx = autoX - x; + int dy = autoY - y; + if (dx == 0 && dy == 0) { + automove = 0; + } + if (dx < -28) { + dx = -28; + } + if (dx > 28) { + dx = 28; + } + if (dy < -32) { + dy = -32; + } + if (dy > 32) { + dy = 32; + } + if (dx > 0) { + MoveRight(dx); + } + if (dx < 0) { + MoveLeft(-dx); + } + if (dy > 0) { + MoveDown(dy); + } + if (dy < 0) { + MoveUp(-dy); + } + } + if (automove == 2) { + if (autoX > 0) { + MoveRight(autoX); + } + if (autoX < 0) { + MoveLeft(-autoX); + } + if (autoY > 0) { + MoveDown(autoY); + } + if (autoY < 0) { + MoveUp(-autoY); + } + } + } - public void MoveRight(boolean nudge) - { - int dist = 28; - if (nudge) dist = 2; - MoveRight(dist); - } + public void Decorate() { + } - public void Animate() - { - if (automove==1 && room == null) - automove=0; - if (automove==1) - { - int dx = autoX - x; - int dy = autoY - y; - if (dx==0 && dy==0) automove=0; - if (dx<-28) dx =-28; - if (dx>28) dx=28; - if (dy<-32) dy=-32; - if (dy>32) dy=32; - if (dx>0) MoveRight(dx); - if (dx<0) MoveLeft(-dx); - if (dy>0) MoveDown(dy); - if (dy<0) MoveUp(-dy); - } - if (automove==2) - { - if (autoX>0) MoveRight(autoX); - if (autoX<0) MoveLeft(-autoX); - if (autoY>0) MoveDown(autoY); - if (autoY<0) MoveUp(-autoY); - } - } + public void GenerateIcons() { + // This is where the icons[] array is filled with ImageIcons, and + // the ImageIcons are painted. Depending on the Item, this can be + // done either once during initialization, or once per Animation + // phase. + } - public void Decorate() - { - } + public boolean CanBePickedUp(Item i) { + // Returns True if THIS Item can be picked up by Item i. + return grabbable; + } - public void GenerateIcons() - { - // This is where the icons[] array is filled with ImageIcons, and - // the ImageIcons are painted. Depending on the Item, this can be - // done either once during initialization, or once per Animation - // phase. - } + private void ItemEffectsMaterials() { + // called after every Move() function + // + // Checks the materials touched by this item, and calls their + // Material.TouchedByItem(Item) - public boolean CanBePickedUp(Item i) - { - // Returns True if THIS Item can be picked up by Item i. - return grabbable; - } + if (room == null) { + return; + } - private void ItemEffectsMaterials() - { - // called after every Move() function - // - // Checks the materials touched by this item, and calls their - // Material.TouchedByItem(Item) + Dimension d = GetXY(); - if (room == null) return; + int bigXl = (d.width) / 28; + int bigXr = (d.width + width - 1) / 28; + int bigYt = (d.height) / 32; + int bigYb = (d.height + height - 1) / 32; - Dimension d = GetXY(); + if (bigXr > 19) { + bigXr = 19; + } + if (bigYb > 11) { + bigYb = 11; + } - int bigXl = (d.width)/28; - int bigXr = (d.width+width-1)/28; - int bigYt = (d.height)/32; - int bigYb = (d.height+height-1)/32; + for (int a = bigYt; a <= bigYb; a++) { + for (int b = bigXl; b <= bigXr; b++) { + if (a >= 0 && a < 12 && b >= 0 && b < 20) { + room.MaterialArray[a][b].TouchedByItem(this); + } + } + } - if (bigXr>19) bigXr=19; - if (bigYb>11) bigYb=11; - - for (int a=bigYt; a<=bigYb; a++) - for (int b=bigXl; b<=bigXr; b++) - if (a>=0 && a<12 && b>=0 &&b<20) - room.MaterialArray[a][b].TouchedByItem(this); - - if (carrying != null) - carrying.ItemEffectsMaterials(); + if (carrying != null) { + carrying.ItemEffectsMaterials(); + } - } + } - public Dimension GetXY() - { - // Recursively goes up the carrying tree to figure out the XY - // coordinates of an item. + public Dimension GetXY() { + // Recursively goes up the carrying tree to figure out the XY + // coordinates of an item. - if (carriedBy != null) - { - Dimension d = carriedBy.GetXY(); - d.width += x; - d.height += y; - return d; - } - else - return new Dimension(x,y); - } + if (carriedBy != null) { + Dimension d = carriedBy.GetXY(); + d.width += x; + d.height += y; + return d; + } + else { + return new Dimension(x, y); + } + } - public void Draw(Graphics g, JPanel jp) - { - Dimension d = GetXY(); - if (currentIcon != null) - g.drawImage(currentIcon, d.width-orgX, d.height-orgY, jp); - else - System.out.println("Cannot draw " + getClass()); - if (outline != null) - { - g.setColor(outline); - g.drawRect(d.width,d.height, width+1, height+1); - g.drawRect(d.width+1,d.height+1, width-1, height-1); - outline=null; - } - } + public void Draw(Graphics g, JPanel jp) { + Dimension d = GetXY(); + if (currentIcon != null) { + g.drawImage(currentIcon, d.width - orgX, d.height - orgY, jp); + } + else { + System.out.println("Cannot draw " + getClass()); + } + if (outline != null) { + g.setColor(outline); + g.drawRect(d.width, d.height, width + 1, height + 1); + g.drawRect(d.width + 1, d.height + 1, width - 1, height - 1); + outline = null; + } + } - public void Draw(Graphics g, int X, int Y, JPanel jp) - { - g.drawImage(currentIcon, X - orgX, Y - orgY, jp); - } + public void Draw(Graphics g, int X, int Y, JPanel jp) { + g.drawImage(currentIcon, X - orgX, Y - orgY, jp); + } - public boolean Overlaps(Item testItem) - { - boolean overlap = false; - if (this!=testItem && this.room == testItem.room) - { - overlap = true; - Dimension d1 = GetXY(); - Dimension d2 = testItem.GetXY(); - if (this.carrying == testItem) {overlap=false;} - if (this == testItem.carrying) {overlap=false;} - if (d1.width + this.width < d2.width) {overlap=false;} - if (d2.width + testItem.width < d1.width) {overlap=false;} - if (d1.height + this.height < d2.height) {overlap=false;} - if (d2.height + testItem.height < d1.height) {overlap=false;} - } - return overlap; - } + public boolean Overlaps(Item testItem) { + boolean overlap = false; + if (this != testItem && this.room == testItem.room) { + overlap = true; + Dimension d1 = GetXY(); + Dimension d2 = testItem.GetXY(); + if (this.carrying == testItem) { + overlap = false; + } + if (this == testItem.carrying) { + overlap = false; + } + if (d1.width + this.width < d2.width) { + overlap = false; + } + if (d2.width + testItem.width < d1.width) { + overlap = false; + } + if (d1.height + this.height < d2.height) { + overlap = false; + } + if (d2.height + testItem.height < d1.height) { + overlap = false; + } + } + return overlap; + } - public boolean RightEnterOverlap(Item item) - { - boolean result = true; - if (leftPortal!= null) - { - if (item.x < x + leftPortal.x) result = false; - if (item.x > x + leftPortal.x + leftPortal.width) result = false; - if (item.y < y + leftPortal.y) result = false; - if (item.y > y + leftPortal.y + leftPortal.height) result = false; - } - else - result = false; - if (OverWall()) result=false; - return result; - } + public boolean RightEnterOverlap(Item item) { + boolean result = true; + if (leftPortal != null) { + if (item.x < x + leftPortal.x) { + result = false; + } + if (item.x > x + leftPortal.x + leftPortal.width) { + result = false; + } + if (item.y < y + leftPortal.y) { + result = false; + } + if (item.y > y + leftPortal.y + leftPortal.height) { + result = false; + } + } + else { + result = false; + } + if (OverWall()) { + result = false; + } + return result; + } - public boolean DownEnterOverlap(Item item) - { - boolean result = true; - if (upPortal!=null) - { - if (item.x < x + upPortal.x) result = false; - if (item.x > x + upPortal.x + upPortal.width) result = false; - if (item.y < y + upPortal.y) result = false; - if (item.y > y + upPortal.y + upPortal.height) result = false; - } - else - result = false; - if (OverWall()) result=false; - return result; - } + public boolean DownEnterOverlap(Item item) { + boolean result = true; + if (upPortal != null) { + if (item.x < x + upPortal.x) { + result = false; + } + if (item.x > x + upPortal.x + upPortal.width) { + result = false; + } + if (item.y < y + upPortal.y) { + result = false; + } + if (item.y > y + upPortal.y + upPortal.height) { + result = false; + } + } + else { + result = false; + } + if (OverWall()) { + result = false; + } + return result; + } - public boolean LeftEnterOverlap(Item item) - { - boolean result = true; - if (leftPortal!=null) - { - if (item.x < x + rightPortal.x) result = false; - if (item.x > x + rightPortal.x + rightPortal.width) result = false; - if (item.y < y + rightPortal.y) result = false; - if (item.y > y + rightPortal.y + rightPortal.height) result = false; - } - else - result = false; - if (OverWall()) result=false; - return result; - } + public boolean LeftEnterOverlap(Item item) { + boolean result = true; + if (leftPortal != null) { + if (item.x < x + rightPortal.x) { + result = false; + } + if (item.x > x + rightPortal.x + rightPortal.width) { + result = false; + } + if (item.y < y + rightPortal.y) { + result = false; + } + if (item.y > y + rightPortal.y + rightPortal.height) { + result = false; + } + } + else { + result = false; + } + if (OverWall()) { + result = false; + } + return result; + } - public boolean UpEnterOverlap(Item item) - { - boolean result = true; - if (downPortal!=null) - { - if (item.x < x + downPortal.x) result = false; - if (item.x > x + downPortal.x + downPortal.width) result = false; - if (item.y < y + downPortal.y) result = false; - if (item.y > y + downPortal.y + downPortal.height) result = false; - } - else - result = false; - if (OverWall()) result=false; - return result; - } + public boolean UpEnterOverlap(Item item) { + boolean result = true; + if (downPortal != null) { + if (item.x < x + downPortal.x) { + result = false; + } + if (item.x > x + downPortal.x + downPortal.width) { + result = false; + } + if (item.y < y + downPortal.y) { + result = false; + } + if (item.y > y + downPortal.y + downPortal.height) { + result = false; + } + } + else { + result = false; + } + if (OverWall()) { + result = false; + } + return result; + } - public boolean isDevice() - { - return false; - } + public boolean isDevice() { + return false; + } - public Object clone() - { - Object newObject = null; - try - { - newObject = super.clone(); - } - catch (CloneNotSupportedException e) {} - // if (newObject instanceof Device) - // { - // Device newDevice = (Device) newObject; - // newDevice.ports = null; - // newDevice.GenerateIcons(); - // } - return newObject; - } + public Object clone() { + Object newObject = null; + try { + newObject = super.clone(); + } + catch (CloneNotSupportedException e) { + } + // if (newObject instanceof Device) + // { + // Device newDevice = (Device) newObject; + // newDevice.ports = null; + // newDevice.GenerateIcons(); + // } + return newObject; + } - public void Erase() - { - carrying = null; - carriedBy = null; - room = null; - currentIcon=null; - icons = null; - InternalRoom = null; - } + public void Erase() { + carrying = null; + carriedBy = null; + room = null; + currentIcon = null; + icons = null; + InternalRoom = null; + } - public boolean OverWall() - { - Dimension d = GetXY(); - int bigXL = (d.width+width/2-14)/28; - int bigXR = (d.width+width/2+14)/28; - int bigYT = (d.height+height/2-16)/32; - int bigYB = (d.height+height/2+16)/32; - if (bigXR>19) bigXR=19; - if (bigYB>11) bigYB=11; - boolean flag = false; - for (int Y=bigYT; Y<=bigYB; Y++) - for (int X=bigXL; X<=bigXR; X++) - if (!room.MaterialArray[Y][X].passable) - flag=true; - return flag; - } + public boolean OverWall() { + Dimension d = GetXY(); + int bigXL = (d.width + width / 2 - 14) / 28; + int bigXR = (d.width + width / 2 + 14) / 28; + int bigYT = (d.height + height / 2 - 16) / 32; + int bigYB = (d.height + height / 2 + 16) / 32; + if (bigXR > 19) { + bigXR = 19; + } + if (bigYB > 11) { + bigYB = 11; + } + boolean flag = false; + for (int Y = bigYT; Y <= bigYB; Y++) { + for (int X = bigXL; X <= bigXR; X++) { + if (!room.MaterialArray[Y][X].passable) { + flag = true; + } + } + } + return flag; + } } diff --git a/src/com/droidquest/items/Key.java b/src/com/droidquest/items/Key.java index c7915a7..49f1ec9 100644 --- a/src/com/droidquest/items/Key.java +++ b/src/com/droidquest/items/Key.java @@ -9,43 +9,42 @@ import javax.swing.ImageIcon; import com.droidquest.Room; -public class Key extends Item -{ - // Generic Key, defined by it's color. +public class Key extends Item { + // Generic Key, defined by it's color. - public Color color; + public Color color; - public Key(int X, int Y, Room r, Color c) - { - x=X; y=Y; room=r; color = c; - width=26; height=8; - GenerateIcons(); - } + public Key(int X, int Y, Room r, Color c) { + x = X; + y = Y; + room = r; + color = c; + width = 26; + height = 8; + GenerateIcons(); + } - public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(color); - g.fillRect(0,0,6,8); - g.fillRect(0,2,26,2); - g.fillRect(0,4,22,2); - g.fillRect(16,6,2,2); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(color); + g.fillRect(0, 0, 6, 8); + g.fillRect(0, 2, 26, 2); + g.fillRect(0, 4, 22, 2); + g.fillRect(16, 6, 2, 2); + currentIcon = icons[0].getImage(); + } - } +} diff --git a/src/com/droidquest/items/Magnet.java b/src/com/droidquest/items/Magnet.java index 20b3687..78ac290 100644 --- a/src/com/droidquest/items/Magnet.java +++ b/src/com/droidquest/items/Magnet.java @@ -9,44 +9,42 @@ import javax.swing.ImageIcon; import com.droidquest.Room; -public class Magnet extends Item -{ -public Magnet(int X, int Y, Room r) - { - x=X; y=Y; room=r; - width=28; height=20; - GenerateIcons(); - } +public class Magnet extends Item { + public Magnet(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 20; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.white); - g.fillRect(0,4,8,12); - g.fillRect(4,2,8,6); - g.fillRect(4,12,8,6); - g.fillRect(8,0,20,6); - g.fillRect(8,14,20,6); - g.setColor(Color.black); - g.fillRect(20,0,4,6); - g.fillRect(20,14,4,6); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.white); + g.fillRect(0, 4, 8, 12); + g.fillRect(4, 2, 8, 6); + g.fillRect(4, 12, 8, 6); + g.fillRect(8, 0, 20, 6); + g.fillRect(8, 14, 20, 6); + g.setColor(Color.black); + g.fillRect(20, 0, 4, 6); + g.fillRect(20, 14, 4, 6); + currentIcon = icons[0].getImage(); + } } diff --git a/src/com/droidquest/items/MasterRobot.java b/src/com/droidquest/items/MasterRobot.java index 0454dae..e421395 100644 --- a/src/com/droidquest/items/MasterRobot.java +++ b/src/com/droidquest/items/MasterRobot.java @@ -10,66 +10,61 @@ import com.droidquest.devices.Bumper; import com.droidquest.devices.Grabber; import com.droidquest.devices.Thruster; -public class MasterRobot extends GenericRobot -{ -private int scan; +public class MasterRobot extends GenericRobot { + private int scan; -public MasterRobot(int X, int Y, Room r) - { - super(X,Y,r,Color.blue); - scan=0; - Animate(); - devices[0] = new Thruster(176,16,InternalRoom,Port.ROT_UP,Color.white); - devices[1] = new Thruster(476,128,InternalRoom,Port.ROT_RIGHT,Color.white); - devices[2] = new Thruster(356,336,InternalRoom,Port.ROT_DOWN,Color.white); - devices[3] = new Thruster(32,236,InternalRoom,Port.ROT_LEFT,Color.white); - devices[4] = new Bumper(396,16,InternalRoom,Port.ROT_UP,Color.white); - devices[5] = new Bumper(480,256,InternalRoom,Port.ROT_RIGHT,Color.white); - devices[6] = new Bumper(128,330,InternalRoom,Port.ROT_DOWN,Color.white); - devices[7] = new Bumper(28,134,InternalRoom,Port.ROT_LEFT,Color.white); - devices[8] = new Antenna(64,70,InternalRoom,Color.white); - devices[9] = new Grabber(126,44,InternalRoom,Color.white); - for (int a=0; a<10; a++) - level.items.addElement(devices[a]); + public MasterRobot(int X, int Y, Room r) { + super(X, Y, r, Color.blue); + scan = 0; + Animate(); + devices[0] = new Thruster(176, 16, InternalRoom, Port.ROT_UP, Color.white); + devices[1] = new Thruster(476, 128, InternalRoom, Port.ROT_RIGHT, Color.white); + devices[2] = new Thruster(356, 336, InternalRoom, Port.ROT_DOWN, Color.white); + devices[3] = new Thruster(32, 236, InternalRoom, Port.ROT_LEFT, Color.white); + devices[4] = new Bumper(396, 16, InternalRoom, Port.ROT_UP, Color.white); + devices[5] = new Bumper(480, 256, InternalRoom, Port.ROT_RIGHT, Color.white); + devices[6] = new Bumper(128, 330, InternalRoom, Port.ROT_DOWN, Color.white); + devices[7] = new Bumper(28, 134, InternalRoom, Port.ROT_LEFT, Color.white); + devices[8] = new Antenna(64, 70, InternalRoom, Color.white); + devices[9] = new Grabber(126, 44, InternalRoom, Color.white); + for (int a = 0; a < 10; a++) { + level.items.addElement(devices[a]); + } - } + } -public void Decorate() - { - super.Decorate(); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); - return; - } - g.setColor(Color.black); - g.fillRect(orgX+16,orgY+12,26,20); - g.setColor(new Color(255,128,0)); - - switch(scan) - { - case 0: - g.fillRect(orgX+28,orgY+18,2,8); - scan=1; - break; - case 1: - g.fillRect(orgX+24,orgY+16,10,12); - g.setColor(Color.black); - g.fillRect(orgX+26,orgY+18,6,8); - scan=2; - break; - case 2: - g.fillRect(orgX+20,orgY+14,18,16); - g.setColor(Color.black); - g.fillRect(orgX+22,orgY+16,14,12); - scan=0; - break; - } - } + public void Decorate() { + super.Decorate(); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); + return; + } + g.setColor(Color.black); + g.fillRect(orgX + 16, orgY + 12, 26, 20); + g.setColor(new Color(255, 128, 0)); + + switch (scan) { + case 0: + g.fillRect(orgX + 28, orgY + 18, 2, 8); + scan = 1; + break; + case 1: + g.fillRect(orgX + 24, orgY + 16, 10, 12); + g.setColor(Color.black); + g.fillRect(orgX + 26, orgY + 18, 6, 8); + scan = 2; + break; + case 2: + g.fillRect(orgX + 20, orgY + 14, 18, 16); + g.setColor(Color.black); + g.fillRect(orgX + 22, orgY + 16, 14, 12); + scan = 0; + break; + } + } } diff --git a/src/com/droidquest/items/MazeControl.java b/src/com/droidquest/items/MazeControl.java index 862bb7f..82173c8 100644 --- a/src/com/droidquest/items/MazeControl.java +++ b/src/com/droidquest/items/MazeControl.java @@ -10,116 +10,114 @@ import javax.swing.ImageIcon; import com.droidquest.Room; import com.droidquest.decorations.TextBox; -public class MazeControl extends Item -{ -static int mazeWidth=4; -static int mazeHeight=2; -int direction; -public static final int DIR_UP = 0; -public static final int DIR_RIGHT = 1; -public static final int DIR_DOWN = 2; -public static final int DIR_LEFT = 3; +public class MazeControl extends Item { + static int mazeWidth = 4; + static int mazeHeight = 2; + private int direction; + public static final int DIR_UP = 0; + public static final int DIR_RIGHT = 1; + public static final int DIR_DOWN = 2; + public static final int DIR_LEFT = 3; -public MazeControl(int X, int Y, Room r, int dir) - { - x=X; y=Y; - room = r; - width=26; height=26; - direction = dir; - GenerateIcons(); - } + public MazeControl(int X, int Y, Room r, int dir) { + x = X; + y = Y; + room = r; + width = 26; + height = 26; + direction = dir; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - Graphics2D g2; - Color transparent = new Color(0,0,0,0); - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.white); - switch(direction) - { - case DIR_UP: - g.fillRect(12,0,2,2); - g.fillRect(10,2,6,2); - g.fillRect(8,4,10,2); - g.fillRect(6,6,14,2); - g.fillRect(4,8,18,2); - g.fillRect(2,10,22,2); - g.fillRect(0,12,26,2); - g.fillRect(10,14,6,12); - break; - case DIR_RIGHT: - g.fillRect(24,12,2,2); - g.fillRect(22,10,2,6); - g.fillRect(20,8,2,10); - g.fillRect(18,6,2,14); - g.fillRect(16,4,2,18); - g.fillRect(14,2,2,22); - g.fillRect(12,0,2,26); - g.fillRect(0,10,12,6); - break; - case DIR_DOWN: - g.fillRect(12,24,2,2); - g.fillRect(10,22,6,2); - g.fillRect(8,20,10,2); - g.fillRect(6,18,14,2); - g.fillRect(4,16,18,2); - g.fillRect(2,14,22,2); - g.fillRect(0,12,26,2); - g.fillRect(10,0,6,12); - break; - case DIR_LEFT: - g.fillRect(0,12,2,2); - g.fillRect(2,10,2,6); - g.fillRect(4,8,2,10); - g.fillRect(6,6,2,14); - g.fillRect(8,4,2,18); - g.fillRect(10,2,2,22); - g.fillRect(12,0,2,26); - g.fillRect(14,10,12,6); - break; - } - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + Graphics2D g2; + Color transparent = new Color(0, 0, 0, 0); + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.white); + switch (direction) { + case DIR_UP: + g.fillRect(12, 0, 2, 2); + g.fillRect(10, 2, 6, 2); + g.fillRect(8, 4, 10, 2); + g.fillRect(6, 6, 14, 2); + g.fillRect(4, 8, 18, 2); + g.fillRect(2, 10, 22, 2); + g.fillRect(0, 12, 26, 2); + g.fillRect(10, 14, 6, 12); + break; + case DIR_RIGHT: + g.fillRect(24, 12, 2, 2); + g.fillRect(22, 10, 2, 6); + g.fillRect(20, 8, 2, 10); + g.fillRect(18, 6, 2, 14); + g.fillRect(16, 4, 2, 18); + g.fillRect(14, 2, 2, 22); + g.fillRect(12, 0, 2, 26); + g.fillRect(0, 10, 12, 6); + break; + case DIR_DOWN: + g.fillRect(12, 24, 2, 2); + g.fillRect(10, 22, 6, 2); + g.fillRect(8, 20, 10, 2); + g.fillRect(6, 18, 14, 2); + g.fillRect(4, 16, 18, 2); + g.fillRect(2, 14, 22, 2); + g.fillRect(0, 12, 26, 2); + g.fillRect(10, 0, 6, 12); + break; + case DIR_LEFT: + g.fillRect(0, 12, 2, 2); + g.fillRect(2, 10, 2, 6); + g.fillRect(4, 8, 2, 10); + g.fillRect(6, 6, 2, 14); + g.fillRect(8, 4, 2, 18); + g.fillRect(10, 2, 2, 22); + g.fillRect(12, 0, 2, 26); + g.fillRect(14, 10, 12, 6); + break; + } + currentIcon = icons[0].getImage(); + } -public boolean CanBePickedUp(Item item) - { - switch (direction) - { - case DIR_UP: - if (mazeHeight==1) return false; - mazeHeight--; - break; - case DIR_DOWN: - mazeHeight++; - break; - case DIR_LEFT: - if (mazeWidth==1) return false; - mazeWidth--; - break; - case DIR_RIGHT: - mazeWidth++; - break; - } - TextBox tb = (TextBox) room.textBoxes.elementAt(1); - tb.textString = mazeWidth + "x" + mazeHeight; - tb.x = (560 - 12*tb.textString.length())/2; - - return false; - } + public boolean CanBePickedUp(Item item) { + switch (direction) { + case DIR_UP: + if (mazeHeight == 1) { + return false; + } + mazeHeight--; + break; + case DIR_DOWN: + mazeHeight++; + break; + case DIR_LEFT: + if (mazeWidth == 1) { + return false; + } + mazeWidth--; + break; + case DIR_RIGHT: + mazeWidth++; + break; + } + TextBox tb = room.textBoxes.elementAt(1); + tb.textString = mazeWidth + "x" + mazeHeight; + tb.x = (560 - 12 * tb.textString.length()) / 2; + + return false; + } } diff --git a/src/com/droidquest/items/MazeCreator.java b/src/com/droidquest/items/MazeCreator.java index fb9d6a2..7c933f5 100644 --- a/src/com/droidquest/items/MazeCreator.java +++ b/src/com/droidquest/items/MazeCreator.java @@ -1,100 +1,93 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; -public class MazeCreator extends Button -{ -public MazeCreator(int X, int Y, Room r) - { - super(X,Y,r,Color.blue); - } +import java.awt.*; -public boolean CanBePickedUp(Item item) - { - Room mazeEntrance=null; - for (int a=0; a28 && x+dx<(19*28)) - x+=dx; - if (y+dy>32 && y+dy<(11*32)) - y+=dy; - if (animationState==1) - { - eb.x=x; eb.y=y; - eb.room = room; - room = null; - } - if (animationState==2) - { - room = eb.room; - eb.room = null; - } - if (animationState==50) - animationState=0; - } - } + public void Animate() { + if (eb == null) { + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item instanceof EnergyButton) { + eb = (EnergyButton) item; + eb.nb = this; + } + } + } + + if (animationState < 51) { + animationState++; + int dx = level.random.nextInt(11) - 5; + int dy = level.random.nextInt(11) - 5; + if (x + dx > 28 && x + dx < (19 * 28)) { + x += dx; + } + if (y + dy > 32 && y + dy < (11 * 32)) { + y += dy; + } + if (animationState == 1) { + eb.x = x; + eb.y = y; + eb.room = room; + room = null; + } + if (animationState == 2) { + room = eb.room; + eb.room = null; + } + if (animationState == 50) { + animationState = 0; + } + } + } } diff --git a/src/com/droidquest/items/OrangeRobot.java b/src/com/droidquest/items/OrangeRobot.java index 01a6d9c..0a921aa 100644 --- a/src/com/droidquest/items/OrangeRobot.java +++ b/src/com/droidquest/items/OrangeRobot.java @@ -10,69 +10,70 @@ import com.droidquest.devices.Bumper; import com.droidquest.devices.Grabber; import com.droidquest.devices.Thruster; -public class OrangeRobot extends GenericRobot -{ -public OrangeRobot(int X, int Y, Room r) - { - super(X,Y,r,new Color(255,128,0)); - Animate(); - devices[0] = new Thruster(176,16,InternalRoom,Port.ROT_UP,Color.white); - devices[1] = new Thruster(476,128,InternalRoom,Port.ROT_RIGHT,Color.white); - devices[2] = new Thruster(356,336,InternalRoom,Port.ROT_DOWN,Color.white); - devices[3] = new Thruster(32,236,InternalRoom,Port.ROT_LEFT,Color.white); - devices[4] = new Bumper(396,16,InternalRoom,Port.ROT_UP,Color.white); - devices[5] = new Bumper(480,256,InternalRoom,Port.ROT_RIGHT,Color.white); - devices[6] = new Bumper(128,330,InternalRoom,Port.ROT_DOWN,Color.white); - devices[7] = new Bumper(28,134,InternalRoom,Port.ROT_LEFT,Color.white); - devices[8] = new Antenna(64,70,InternalRoom,Color.white); - devices[9] = new Grabber(126,44,InternalRoom,Color.white); - for (int a=0; a<10; a++) - level.items.addElement(devices[a]); +public class OrangeRobot extends GenericRobot { + public OrangeRobot(int X, int Y, Room r) { + super(X, Y, r, new Color(255, 128, 0)); + Animate(); + devices[0] = new Thruster(176, 16, InternalRoom, Port.ROT_UP, Color.white); + devices[1] = new Thruster(476, 128, InternalRoom, Port.ROT_RIGHT, Color.white); + devices[2] = new Thruster(356, 336, InternalRoom, Port.ROT_DOWN, Color.white); + devices[3] = new Thruster(32, 236, InternalRoom, Port.ROT_LEFT, Color.white); + devices[4] = new Bumper(396, 16, InternalRoom, Port.ROT_UP, Color.white); + devices[5] = new Bumper(480, 256, InternalRoom, Port.ROT_RIGHT, Color.white); + devices[6] = new Bumper(128, 330, InternalRoom, Port.ROT_DOWN, Color.white); + devices[7] = new Bumper(28, 134, InternalRoom, Port.ROT_LEFT, Color.white); + devices[8] = new Antenna(64, 70, InternalRoom, Color.white); + devices[9] = new Grabber(126, 44, InternalRoom, Color.white); + for (int a = 0; a < 10; a++) { + level.items.addElement(devices[a]); + } - } + } -public void Decorate() - { - super.Decorate(); - Graphics g; - int cx, cy, cc; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); - return; - } - - g.setColor(Color.black); - g.fillRect(22,36,42,20); - - for (int a=0; a<20; a++) - { - cx = level.random.nextInt(41)+22; - cy = level.random.nextInt(19)+36; - cc = level.random.nextInt(7); - switch (cc) - { - case 0: g.setColor(Color.white); - break; - case 1: g.setColor(Color.red); - break; - case 2: g.setColor(new Color(255,128,0)); - break; - case 3: g.setColor(Color.yellow); - break; - case 4: g.setColor(Color.green); - break; - case 5: g.setColor(Color.blue); - break; - case 6: g.setColor(Color.magenta); - break; - } - g.fillRect(cx,cy,2,2); - } - } + public void Decorate() { + super.Decorate(); + Graphics g; + int cx, cy, cc; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); + return; + } + + g.setColor(Color.black); + g.fillRect(22, 36, 42, 20); + + for (int a = 0; a < 20; a++) { + cx = level.random.nextInt(41) + 22; + cy = level.random.nextInt(19) + 36; + cc = level.random.nextInt(7); + switch (cc) { + case 0: + g.setColor(Color.white); + break; + case 1: + g.setColor(Color.red); + break; + case 2: + g.setColor(new Color(255, 128, 0)); + break; + case 3: + g.setColor(Color.yellow); + break; + case 4: + g.setColor(Color.green); + break; + case 5: + g.setColor(Color.blue); + break; + case 6: + g.setColor(Color.magenta); + break; + } + g.fillRect(cx, cy, 2, 2); + } + } } diff --git a/src/com/droidquest/items/PC16Button.java b/src/com/droidquest/items/PC16Button.java index a203ab1..0e4010a 100644 --- a/src/com/droidquest/items/PC16Button.java +++ b/src/com/droidquest/items/PC16Button.java @@ -11,52 +11,49 @@ import com.droidquest.Room; import com.droidquest.devices.Prototype16Chip; import com.droidquest.levels.Level; -public class PC16Button extends Item -{ -public PC16Button(int X, int Y, Room r) - { - x=X; y=Y; room=r; - width=28; height=26; - GenerateIcons(); - } +public class PC16Button extends Item { + public PC16Button(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 26; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.blue); - g.fillRect(8,0,12,26); - g.fillRect(4,2,20,22); - g.fillRect(0,4,28,18); - g.setColor(Color.black); - g.fillRect(8,6,12,14); - g.fillRect(4,8,20,10); - g.setColor(Color.blue); - g.fillRect(12,8,4,10); - g.fillRect(8,10,12,6); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.blue); + g.fillRect(8, 0, 12, 26); + g.fillRect(4, 2, 20, 22); + g.fillRect(0, 4, 28, 18); + g.setColor(Color.black); + g.fillRect(8, 6, 12, 14); + g.fillRect(4, 8, 20, 10); + g.setColor(Color.blue); + g.fillRect(12, 8, 4, 10); + g.fillRect(8, 10, 12, 6); + currentIcon = icons[0].getImage(); + } -public boolean CanBePickedUp(Item i) - { - Prototype16Chip newPC = new Prototype16Chip(228, 160, room); - level.items.addElement(newPC); - level.PlaySound(room,Level.CHARGESOUND); - return false; - } + public boolean CanBePickedUp(Item i) { + Prototype16Chip newPC = new Prototype16Chip(228, 160, room); + level.items.addElement(newPC); + level.PlaySound(room, Level.CHARGESOUND); + return false; + } } diff --git a/src/com/droidquest/items/PC32Button.java b/src/com/droidquest/items/PC32Button.java index 0c0001d..33abee2 100644 --- a/src/com/droidquest/items/PC32Button.java +++ b/src/com/droidquest/items/PC32Button.java @@ -11,53 +11,50 @@ import com.droidquest.Room; import com.droidquest.devices.Prototype32Chip; import com.droidquest.levels.Level; -public class PC32Button extends Item -{ -public PC32Button(int X, int Y, Room r) - { - x=X; y=Y; room=r; - width=28; height=26; - GenerateIcons(); - } +public class PC32Button extends Item { + public PC32Button(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 26; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.blue); - g.fillRect(8,0,12,26); - g.fillRect(4,2,20,22); - g.fillRect(0,4,28,18); - g.setColor(Color.black); - g.fillRect(8,6,12,14); - g.fillRect(4,8,20,10); - g.setColor(Color.blue); - g.fillRect(12,8,4,10); - g.fillRect(8,10,12,6); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.blue); + g.fillRect(8, 0, 12, 26); + g.fillRect(4, 2, 20, 22); + g.fillRect(0, 4, 28, 18); + g.setColor(Color.black); + g.fillRect(8, 6, 12, 14); + g.fillRect(4, 8, 20, 10); + g.setColor(Color.blue); + g.fillRect(12, 8, 4, 10); + g.fillRect(8, 10, 12, 6); + currentIcon = icons[0].getImage(); + } -public boolean CanBePickedUp(Item i) - { - Prototype32Chip newPC = new Prototype32Chip(228, 160, room); - level.items.addElement(newPC); - level.PlaySound(room,Level.CHARGESOUND); - return false; - } + public boolean CanBePickedUp(Item i) { + Prototype32Chip newPC = new Prototype32Chip(228, 160, room); + level.items.addElement(newPC); + level.PlaySound(room, Level.CHARGESOUND); + return false; + } } diff --git a/src/com/droidquest/items/PCButton.java b/src/com/droidquest/items/PCButton.java index 255a211..215c080 100644 --- a/src/com/droidquest/items/PCButton.java +++ b/src/com/droidquest/items/PCButton.java @@ -11,52 +11,49 @@ import com.droidquest.Room; import com.droidquest.devices.PrototypeChip; import com.droidquest.levels.Level; -public class PCButton extends Item -{ -public PCButton(int X, int Y, Room r) - { - x=X; y=Y; room=r; - width=28; height=26; - GenerateIcons(); - } +public class PCButton extends Item { + public PCButton(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 26; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.blue); - g.fillRect(8,0,12,26); - g.fillRect(4,2,20,22); - g.fillRect(0,4,28,18); - g.setColor(Color.black); - g.fillRect(8,6,12,14); - g.fillRect(4,8,20,10); - g.setColor(Color.blue); - g.fillRect(12,8,4,10); - g.fillRect(8,10,12,6); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.blue); + g.fillRect(8, 0, 12, 26); + g.fillRect(4, 2, 20, 22); + g.fillRect(0, 4, 28, 18); + g.setColor(Color.black); + g.fillRect(8, 6, 12, 14); + g.fillRect(4, 8, 20, 10); + g.setColor(Color.blue); + g.fillRect(12, 8, 4, 10); + g.fillRect(8, 10, 12, 6); + currentIcon = icons[0].getImage(); + } -public boolean CanBePickedUp(Item i) - { - PrototypeChip newPC = new PrototypeChip(228, 160, room); - level.items.addElement(newPC); - level.PlaySound(room,Level.CHARGESOUND); - return false; - } + public boolean CanBePickedUp(Item i) { + PrototypeChip newPC = new PrototypeChip(228, 160, room); + level.items.addElement(newPC); + level.PlaySound(room, Level.CHARGESOUND); + return false; + } } diff --git a/src/com/droidquest/items/Pellet.java b/src/com/droidquest/items/Pellet.java index fafca13..444475b 100644 --- a/src/com/droidquest/items/Pellet.java +++ b/src/com/droidquest/items/Pellet.java @@ -9,72 +9,67 @@ import javax.swing.ImageIcon; import com.droidquest.Room; -public class Pellet extends Item -{ -transient static int pelletCount = 0; -transient boolean counted = false; +public class Pellet extends Item { + private transient static int pelletCount = 0; + private transient boolean counted = false; -public Pellet(int X, int Y, Room r) - { - x=X; y=Y; room = r; - width = 28; height = 28; - pelletCount ++; - } + public Pellet(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 28; + pelletCount++; + } -public void GenerateIcons() - { - if (!counted) - { - int index = level.items.indexOf(this); - if (!(level.items.elementAt(index-1) instanceof Pellet)) - pelletCount=0; - counted = true; - pelletCount++; - } - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.white); - g.fillOval(0,0,width,height); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + if (!counted) { + int index = level.items.indexOf(this); + if (!(level.items.elementAt(index - 1) instanceof Pellet)) { + pelletCount = 0; + } + counted = true; + pelletCount++; + } + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.white); + g.fillOval(0, 0, width, height); + currentIcon = icons[0].getImage(); + } -public boolean CanBePickedUp(Item item) - { - if (item instanceof GenericRobot) - { - level.items.removeElement(this); - pelletCount--; - if (pelletCount==0) - { - room.SetMaterial(15,1,0); - room.SetMaterial(15,2,0); - room.SetMaterial(15,5,0); - room.SetMaterial(15,6,0); - room.SetMaterial(15,9,0); - room.SetMaterial(15,10,0); - for (int a=0; a=0 && behavior < pounce) - if (protect.length >0 && level.player.room == room) - { - for (int p=0; p= x1 - && level.player.x <= x2 - && level.player.y >= y1 - && level.player.y <= y2) - { - carryToX = x3; - carryToY = y3; - previousBehavior = behavior; - if (previousBehavior >= pounce) - previousBehavior = 0; - behavior=pounce; - } - } - } - - if (behavior >=0 && behavior < pounce) - { - if (x == goToX && y == goToY) - { - behavior++; - if (behavior==pounce) behavior=0; - goToX = pace[behavior*2]; - goToY = pace[behavior*2+1]; - } - else - { - if (x != goToX) - { - int diff = Math.abs(goToX - x); - int dir = diff / (goToX - x); - if (diff > 8) diff = 8; - MoveRight(diff * dir); - } - if (y != goToY) - { - int diff = Math.abs(goToY - y); - int dir = diff / (goToY - y); - if (diff > 8) diff = 8; - MoveDown(diff * dir); - } - } - } - else if (behavior == pounce) - { - if (level.player.room != room) - behavior = previousBehavior; - if (animation==0) - { - x=level.player.x; - y=level.player.y; - } - if (x != level.player.x) - { - int diff = Math.abs(level.player.x - x); - int dir = diff / (level.player.x - x); - if (diff > 50) diff /= 2; - MoveRight(diff * dir); - } - if (y != level.player.y) - { - int diff = Math.abs(level.player.y - y); - int dir = diff / (level.player.y - y); - if (diff > 50) diff /= 2; - MoveDown(diff * dir); - } - if (x == level.player.x && y == level.player.y) - { - PicksUp(level.player); + if (animation == 3) { + currentIcon = icons[1].getImage(); + } + else { + currentIcon = icons[animation].getImage(); + } + + } + + public void Animate() { + if (carrying == null) { + animation++; + } + if (animation == 4) { + animation = 0; + } + if (animation == 3) { + currentIcon = icons[1].getImage(); + } + else { + currentIcon = icons[animation].getImage(); + } + + if (behavior == -2) { + return; + } + + if (smartblock) { + robot = PlayerInRobot(null); + if (robot != null) { + previousBehavior = 0; + behavior = -1; // Pin Robot + } + else if (carrying != null && behavior != drag) { + Drops(); + behavior = previousBehavior; + } + } + + if (behavior == -1) { + if (carrying == null) { + x = robot.x + robot.width / 2 - width / 2; + y = robot.y + robot.height / 2 - height / 2; + PicksUp(robot); + } + } + + if (behavior >= 0 && behavior < pounce) { + if (protect.length > 0 && level.player.room == room) { + for (int p = 0; p < protect.length / 6; p++) { + int x1 = protect[p * 6]; + int y1 = protect[p * 6 + 1]; + int x2 = protect[p * 6 + 2]; + int y2 = protect[p * 6 + 3]; + int x3 = protect[p * 6 + 4]; + int y3 = protect[p * 6 + 5]; + + if (level.player.x >= x1 + && level.player.x <= x2 + && level.player.y >= y1 + && level.player.y <= y2) { + carryToX = x3; + carryToY = y3; + previousBehavior = behavior; + if (previousBehavior >= pounce) { + previousBehavior = 0; + } + behavior = pounce; + } + } + } + } + + if (behavior >= 0 && behavior < pounce) { + if (x == goToX && y == goToY) { + behavior++; + if (behavior == pounce) { + behavior = 0; + } + goToX = pace[behavior * 2]; + goToY = pace[behavior * 2 + 1]; + } + else { + if (x != goToX) { + int diff = Math.abs(goToX - x); + int dir = diff / (goToX - x); + if (diff > 8) { + diff = 8; + } + MoveRight(diff * dir); + } + if (y != goToY) { + int diff = Math.abs(goToY - y); + int dir = diff / (goToY - y); + if (diff > 8) { + diff = 8; + } + MoveDown(diff * dir); + } + } + } + else if (behavior == pounce) { + if (level.player.room != room) { + behavior = previousBehavior; + } + if (animation == 0) { + x = level.player.x; + y = level.player.y; + } + if (x != level.player.x) { + int diff = Math.abs(level.player.x - x); + int dir = diff / (level.player.x - x); + if (diff > 50) { + diff /= 2; + } + MoveRight(diff * dir); + } + if (y != level.player.y) { + int diff = Math.abs(level.player.y - y); + int dir = diff / (level.player.y - y); + if (diff > 50) { + diff /= 2; + } + MoveDown(diff * dir); + } + if (x == level.player.x && y == level.player.y) { + PicksUp(level.player); // if (level.player.carrying != null) // level.player.Drops(); - behavior=drag; - } - } - else if (behavior == drag) - { - if (x == carryToX && y == carryToY) - { - Drops(); - behavior=previousBehavior; - } - else - { - if (x != carryToX) - { - int diff = Math.abs(carryToX - x); - int dir = diff / (carryToX - x); - if (diff > 8) diff = 8; - MoveRight(diff * dir); - } - if (y != carryToY) - { - int diff = Math.abs(carryToY - y); - int dir = diff / (carryToY - y); - if (diff > 8) diff = 8; - MoveDown(diff * dir); - } - } - } - } + behavior = drag; + } + } + else if (behavior == drag) { + if (x == carryToX && y == carryToY) { + Drops(); + behavior = previousBehavior; + } + else { + if (x != carryToX) { + int diff = Math.abs(carryToX - x); + int dir = diff / (carryToX - x); + if (diff > 8) { + diff = 8; + } + MoveRight(diff * dir); + } + if (y != carryToY) { + int diff = Math.abs(carryToY - y); + int dir = diff / (carryToY - y); + if (diff > 8) { + diff = 8; + } + MoveDown(diff * dir); + } + } + } + } - public GenericRobot PlayerInRobot(GenericRobot robot) - { - if (robot==null) - { - if (level.player.room.portalItem!=null) - { - if (level.player.room.portalItem.getClass().toString().endsWith("Robot")) - return (PlayerInRobot ((GenericRobot) level.player.room.portalItem)); - else return (null); - } - else - return (null); - } - else - if (robot.room.portalItem != null) - { - if (robot.room.portalItem.getClass().toString().endsWith("Robot")) - return (PlayerInRobot ((GenericRobot) robot.room.portalItem)); - else - return null; - } - else - { - if (robot.room == room) - return robot; - else - return null; - } - } + GenericRobot PlayerInRobot(GenericRobot robot) { + if (robot == null) { + if (level.player.room.portalItem != null) { + if (level.player.room.portalItem.getClass().toString().endsWith("Robot")) { + return (PlayerInRobot((GenericRobot) level.player.room.portalItem)); + } + else { + return (null); + } + } + else { + return (null); + } + } + else if (robot.room.portalItem != null) { + if (robot.room.portalItem.getClass().toString().endsWith("Robot")) { + return (PlayerInRobot((GenericRobot) robot.room.portalItem)); + } + else { + return null; + } + } + else { + if (robot.room == room) { + return robot; + } + else { + return null; + } + } + } - public void MoveUp(int dist) - { - int newY = y-dist; - if (newY<0) - newY=0; - y=newY; - } + public void MoveUp(int dist) { + int newY = y - dist; + if (newY < 0) { + newY = 0; + } + y = newY; + } - public void MoveDown(int dist) - { - int newY = y+dist; - if (newY>383) - newY=383; - y=newY; - } + public void MoveDown(int dist) { + int newY = y + dist; + if (newY > 383) { + newY = 383; + } + y = newY; + } - public void MoveLeft(int dist) - { - int newX = x-dist; - if (newX<0) - newX=0; - x=newX; - } + public void MoveLeft(int dist) { + int newX = x - dist; + if (newX < 0) { + newX = 0; + } + x = newX; + } - public void MoveRight(int dist) - { - int newX = x+dist; - if (newX>579) - newX=579; - x=newX; - } + public void MoveRight(int dist) { + int newX = x + dist; + if (newX > 579) { + newX = 579; + } + x = newX; + } - } +} diff --git a/src/com/droidquest/items/Sentry3.java b/src/com/droidquest/items/Sentry3.java index 4fe862c..6adef2f 100644 --- a/src/com/droidquest/items/Sentry3.java +++ b/src/com/droidquest/items/Sentry3.java @@ -2,112 +2,145 @@ package com.droidquest.items; import com.droidquest.Room; -public class Sentry3 extends Sentry -{ - // This sentry guards the Sewer Grate room. It walks up and down from - // position (2*28,2*32) to (2*28,8*32). It does not notice the player - // unless the player passes below y=11*32. Then it grabs the player if - // it goes above y=8*32. The Sentry drags the player down to y=11*32. If - // the player ever leaves the room, the Sentry forgets about the player. +public class Sentry3 extends Sentry { + // This sentry guards the Sewer Grate room. It walks up and down from + // position (2*28,2*32) to (2*28,8*32). It does not notice the player + // unless the player passes below y=11*32. Then it grabs the player if + // it goes above y=8*32. The Sentry drags the player down to y=11*32. If + // the player ever leaves the room, the Sentry forgets about the player. - // Behavior values: - // 0=Move Down - // 1=Move Up - // 2=Attack - // 3=Drag - int carryToX; - boolean smart= false; // knows about the player + // Behavior values: + // 0=Move Down + // 1=Move Up + // 2=Attack + // 3=Drag + private int carryToX; + private boolean smart = false; // knows about the player - public Sentry3(int X, int Y, Room r) - { - super(X,Y,r); - } + public Sentry3(int X, int Y, Room r) { + super(X, Y, r); + } - public void Animate() - { - if (behavior<3) animation++; - if (animation==4) animation=0; - if (animation==3) - currentIcon = icons[1].getImage(); - else - currentIcon = icons[animation].getImage(); - - if (level.player.room!=room) - { - if (smart) behavior = previousBehavior; - smart=false; - } - else - if (level.player.y>320) - { - carryToX = level.player.x; - smart=true; - } - - if (behavior<2 && smart) - if (level.player.y <= 256) - { - previousBehavior = behavior; - behavior=2; - } - - switch (behavior) - { - case 0: - if (y<256) MoveDown(8); - else behavior=1; - if (x<56) MoveRight(8); - if (x>56) MoveLeft(8); - break; - case 1: - if (y>64) MoveUp(8); - else behavior=0; - if (x<56) MoveRight(8); - if (x>56) MoveLeft(8); - break; - case 2: - if (level.player.room != room) - { - behavior = previousBehavior; - break; - } - int dx=level.player.x - x; - int dy=level.player.y - y; - if (dx<-50) dx=-50; - if (dx>50) dx=50; - if (dy<-50) dy=-50; - if (dy>50) dy=50; - if (dx<0) MoveLeft(-dx); - if (dx>0) MoveRight(dx); - if (dy<0) MoveUp(-dy); - if (dy>0) MoveDown(dy); - if (dx==0 && dy==0) - { - PicksUp(level.player); - behavior=3; - } - break; - case 3: - if (y>=320) - { - Drops(); - behavior = previousBehavior; - break; - } - else - { - if (y<312) - MoveDown(8); - else if (y<320) - MoveDown(320-y); - if (xcarryToX) - MoveLeft(8); - } - break; - } - } + public void Animate() { + if (behavior < 3) { + animation++; + } + if (animation == 4) { + animation = 0; + } + if (animation == 3) { + currentIcon = icons[1].getImage(); + } + else { + currentIcon = icons[animation].getImage(); + } - } + if (level.player.room != room) { + if (smart) { + behavior = previousBehavior; + } + smart = false; + } + else if (level.player.y > 320) { + carryToX = level.player.x; + smart = true; + } + + if (behavior < 2 && smart) { + if (level.player.y <= 256) { + previousBehavior = behavior; + behavior = 2; + } + } + + switch (behavior) { + case 0: + if (y < 256) { + MoveDown(8); + } + else { + behavior = 1; + } + if (x < 56) { + MoveRight(8); + } + if (x > 56) { + MoveLeft(8); + } + break; + case 1: + if (y > 64) { + MoveUp(8); + } + else { + behavior = 0; + } + if (x < 56) { + MoveRight(8); + } + if (x > 56) { + MoveLeft(8); + } + break; + case 2: + if (level.player.room != room) { + behavior = previousBehavior; + break; + } + int dx = level.player.x - x; + int dy = level.player.y - y; + if (dx < -50) { + dx = -50; + } + if (dx > 50) { + dx = 50; + } + if (dy < -50) { + dy = -50; + } + if (dy > 50) { + dy = 50; + } + if (dx < 0) { + MoveLeft(-dx); + } + if (dx > 0) { + MoveRight(dx); + } + if (dy < 0) { + MoveUp(-dy); + } + if (dy > 0) { + MoveDown(dy); + } + if (dx == 0 && dy == 0) { + PicksUp(level.player); + behavior = 3; + } + break; + case 3: + if (y >= 320) { + Drops(); + behavior = previousBehavior; + break; + } + else { + if (y < 312) { + MoveDown(8); + } + else if (y < 320) { + MoveDown(320 - y); + } + if (x < carryToX) { + MoveRight(8); + } + if (x > carryToX) { + MoveLeft(8); + } + } + break; + } + } + +} diff --git a/src/com/droidquest/items/SentryT1.java b/src/com/droidquest/items/SentryT1.java index 858e0d6..60c50ff 100644 --- a/src/com/droidquest/items/SentryT1.java +++ b/src/com/droidquest/items/SentryT1.java @@ -9,171 +9,176 @@ import javax.swing.ImageIcon; import com.droidquest.Room; -public class SentryT1 extends Item -{ - // This sentry does nothing but pace back and forth in the first tutorial. - // It walks left and right, and switches directions when it hits a wall. +public class SentryT1 extends Item { + // This sentry does nothing but pace back and forth in the first tutorial. + // It walks left and right, and switches directions when it hits a wall. - // Behavior values: - // 0=Move Left - // 1=Move Right + // Behavior values: + // 0=Move Left + // 1=Move Right - int animation = 0; // 0-3, 1 & 3 = icons[1] - int behavior = 0; // 0+ for pacing, until pounce and drag. -1=pin. + private int animation = 0; // 0-3, 1 & 3 = icons[1] + private int behavior = 0; // 0+ for pacing, until pounce and drag. -1=pin. - public SentryT1(int X, int Y, Room r) - { - x=X; y=Y; room=r; - width=28; height=18; orgY = 30; - grabbable = false; - GenerateIcons(); - currentIcon = icons[0].getImage(); - } + public SentryT1(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 18; + orgY = 30; + grabbable = false; + GenerateIcons(); + currentIcon = icons[0].getImage(); + } - public void GenerateIcons() - { - icons = new ImageIcon[3]; - icons[0]= new ImageIcon(new BufferedImage(width,height+orgY,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(width,height+orgY,BufferedImage.TYPE_4BYTE_ABGR)); - icons[2]= new ImageIcon(new BufferedImage(width,height+orgY,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - Graphics2D g2; - Color transparent = new Color(0,0,0,0); + public void GenerateIcons() { + icons = new ImageIcon[3]; + icons[0] = new ImageIcon(new BufferedImage(width, height + orgY, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(width, height + orgY, BufferedImage.TYPE_4BYTE_ABGR)); + icons[2] = new ImageIcon(new BufferedImage(width, height + orgY, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + Graphics2D g2; + Color transparent = new Color(0, 0, 0, 0); - // 0 = Legs out - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height+orgY); - g.setColor(Color.white); - g.fillRect(8,0,12,6); - g.fillRect(12,6,4,6); - g.fillRect(8,12,12,24); - g.fillRect(4,16,20,18); - g.fillRect(0,20,28,10); - g.fillRect(4,36,8,4); - g.fillRect(4,36,4,6); - g.fillRect(0,40,4,8); - g.fillRect(16,36,8,4); - g.fillRect(20,36,4,6); - g.fillRect(24,40,4,8); - g.setColor(Color.black); - g.fillRect(4,22,4,6); - g.fillRect(20,22,4,6); - g.fillRect(8,20,4,2); - g.fillRect(16,20,4,2); - g.fillRect(8,28,4,2); - g.fillRect(16,28,4,2); - g.fillRect(12,18,4,2); - g.fillRect(12,30,4,2); - g.fillRect(12,22,4,6); - - - // 1 = legs mid - try - { - g = icons[1].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height+orgY); - g.setColor(Color.white); - g.fillRect(8,0,12,6); - g.fillRect(12,6,4,6); - g.fillRect(8,12,12,28); - g.fillRect(4,16,20,18); - g.fillRect(0,20,28,10); - g.fillRect(4,40,8,2); - g.fillRect(16,40,8,2); - g.fillRect(4,40,4,8); - g.fillRect(20,40,4,8); - g.setColor(Color.black); - g.fillRect(4,22,4,6); - g.fillRect(20,22,4,6); - g.fillRect(8,20,4,2); - g.fillRect(16,20,4,2); - g.fillRect(8,28,4,2); - g.fillRect(16,28,4,2); - g.fillRect(12,18,4,2); - g.fillRect(12,30,4,2); - g.fillRect(12,22,4,6); + // 0 = Legs out + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height + orgY); + g.setColor(Color.white); + g.fillRect(8, 0, 12, 6); + g.fillRect(12, 6, 4, 6); + g.fillRect(8, 12, 12, 24); + g.fillRect(4, 16, 20, 18); + g.fillRect(0, 20, 28, 10); + g.fillRect(4, 36, 8, 4); + g.fillRect(4, 36, 4, 6); + g.fillRect(0, 40, 4, 8); + g.fillRect(16, 36, 8, 4); + g.fillRect(20, 36, 4, 6); + g.fillRect(24, 40, 4, 8); + g.setColor(Color.black); + g.fillRect(4, 22, 4, 6); + g.fillRect(20, 22, 4, 6); + g.fillRect(8, 20, 4, 2); + g.fillRect(16, 20, 4, 2); + g.fillRect(8, 28, 4, 2); + g.fillRect(16, 28, 4, 2); + g.fillRect(12, 18, 4, 2); + g.fillRect(12, 30, 4, 2); + g.fillRect(12, 22, 4, 6); - // 2 = legs in - try - { - g = icons[2].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height+orgY); - g.setColor(Color.white); - g.fillRect(8,0,12,6); - g.fillRect(12,6,4,36); - g.fillRect(8,12,12,24); - g.fillRect(4,16,20,18); - g.fillRect(0,20,28,10); - g.fillRect(8,40,4,8); - g.fillRect(16,40,4,8); - g.setColor(Color.black); - g.fillRect(4,22,4,6); - g.fillRect(20,22,4,6); - g.fillRect(8,20,4,2); - g.fillRect(16,20,4,2); - g.fillRect(8,28,4,2); - g.fillRect(16,28,4,2); - g.fillRect(12,18,4,2); - g.fillRect(12,30,4,2); - g.fillRect(12,22,4,6); + // 1 = legs mid + try { + g = icons[1].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height + orgY); + g.setColor(Color.white); + g.fillRect(8, 0, 12, 6); + g.fillRect(12, 6, 4, 6); + g.fillRect(8, 12, 12, 28); + g.fillRect(4, 16, 20, 18); + g.fillRect(0, 20, 28, 10); + g.fillRect(4, 40, 8, 2); + g.fillRect(16, 40, 8, 2); + g.fillRect(4, 40, 4, 8); + g.fillRect(20, 40, 4, 8); + g.setColor(Color.black); + g.fillRect(4, 22, 4, 6); + g.fillRect(20, 22, 4, 6); + g.fillRect(8, 20, 4, 2); + g.fillRect(16, 20, 4, 2); + g.fillRect(8, 28, 4, 2); + g.fillRect(16, 28, 4, 2); + g.fillRect(12, 18, 4, 2); + g.fillRect(12, 30, 4, 2); + g.fillRect(12, 22, 4, 6); - if (animation==3) - currentIcon = icons[1].getImage(); - else - currentIcon = icons[animation].getImage(); - } + // 2 = legs in + try { + g = icons[2].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height + orgY); + g.setColor(Color.white); + g.fillRect(8, 0, 12, 6); + g.fillRect(12, 6, 4, 36); + g.fillRect(8, 12, 12, 24); + g.fillRect(4, 16, 20, 18); + g.fillRect(0, 20, 28, 10); + g.fillRect(8, 40, 4, 8); + g.fillRect(16, 40, 4, 8); + g.setColor(Color.black); + g.fillRect(4, 22, 4, 6); + g.fillRect(20, 22, 4, 6); + g.fillRect(8, 20, 4, 2); + g.fillRect(16, 20, 4, 2); + g.fillRect(8, 28, 4, 2); + g.fillRect(16, 28, 4, 2); + g.fillRect(12, 18, 4, 2); + g.fillRect(12, 30, 4, 2); + g.fillRect(12, 22, 4, 6); - public void Animate() - { - if (behavior<3) animation++; - if (animation==4) animation=0; - if (animation==3) - currentIcon = icons[1].getImage(); - else - currentIcon = icons[animation].getImage(); - - int oldX; - switch (behavior) - { - case 0: - oldX=x; - MoveLeft(4); - if (oldX==x) behavior=1; - break; - case 1: - oldX=x; - MoveRight(4); - if (oldX==x) behavior=0; - break; - } - } + if (animation == 3) { + currentIcon = icons[1].getImage(); + } + else { + currentIcon = icons[animation].getImage(); + } - } + } + + public void Animate() { + if (behavior < 3) { + animation++; + } + if (animation == 4) { + animation = 0; + } + if (animation == 3) { + currentIcon = icons[1].getImage(); + } + else { + currentIcon = icons[animation].getImage(); + } + + int oldX; + switch (behavior) { + case 0: + oldX = x; + MoveLeft(4); + if (oldX == x) { + behavior = 1; + } + break; + case 1: + oldX = x; + MoveRight(4); + if (oldX == x) { + behavior = 0; + } + break; + } + } + +} diff --git a/src/com/droidquest/items/SentryT2.java b/src/com/droidquest/items/SentryT2.java index b2771c1..89dfefc 100644 --- a/src/com/droidquest/items/SentryT2.java +++ b/src/com/droidquest/items/SentryT2.java @@ -2,94 +2,128 @@ package com.droidquest.items; import com.droidquest.Room; -public class SentryT2 extends Sentry -{ - // This sentry guards a room from the toolbox being carried through it. - // It walks up and down, and pounces and drags if the cursor is - // carrying the toolbox. +public class SentryT2 extends Sentry { + // This sentry guards a room from the toolbox being carried through it. + // It walks up and down, and pounces and drags if the cursor is + // carrying the toolbox. - // Behavior values: - // 0=Walk down - // 1=Walk up - // 2=Attack - // 3=Drag back + // Behavior values: + // 0=Walk down + // 1=Walk up + // 2=Attack + // 3=Drag back - public SentryT2(int X, int Y, Room r) - { - super(X,Y,r); - } + public SentryT2(int X, int Y, Room r) { + super(X, Y, r); + } - public void Animate() - { - if (behavior<3) animation++; - if (animation==4) animation=0; - if (animation==3) - currentIcon = icons[1].getImage(); - else - currentIcon = icons[animation].getImage(); - - if (level.player.room==room) - if (level.player.x>=112) - if (level.player.carrying==level.toolbox) - { - previousBehavior = behavior; - behavior=2; - } - - switch (behavior) - { - case 0: - if (y<256) MoveDown(4); - else behavior=1; - if (x<56) MoveRight(4); - if (x>56) MoveLeft(4); - break; - case 1: - if (y>64) MoveUp(4); - else behavior=0; - if (x<56) MoveRight(4); - if (x>56) MoveLeft(4); - break; - case 2: - if (level.player.room != room) - { - behavior = previousBehavior; - break; - } - int dx=level.player.x - x; - int dy=level.player.y - y; - if (dx<-50) dx=-50; - if (dx>50) dx=50; - if (dy<-50) dy=-50; - if (dy>50) dy=50; - if (dx<0) MoveLeft(-dx); - if (dx>0) MoveRight(dx); - if (dy<0) MoveUp(-dy); - if (dy>0) MoveDown(dy); - if (dx==0 && dy==0) - { - PicksUp(level.player); - behavior=3; - } - break; - case 3: - if (x<=56 && y>=20 && y<=30) - { - Drops(); - behavior = 1; - break; - } - else - { - if (x>56) - MoveLeft(4); - if (y<20) - MoveDown(4); - if (y>30) - MoveUp(4); - } - break; - } - } + public void Animate() { + if (behavior < 3) { + animation++; + } + if (animation == 4) { + animation = 0; + } + if (animation == 3) { + currentIcon = icons[1].getImage(); + } + else { + currentIcon = icons[animation].getImage(); + } - } \ No newline at end of file + if (level.player.room == room) { + if (level.player.x >= 112) { + if (level.player.carrying == level.toolbox) { + previousBehavior = behavior; + behavior = 2; + } + } + } + + switch (behavior) { + case 0: + if (y < 256) { + MoveDown(4); + } + else { + behavior = 1; + } + if (x < 56) { + MoveRight(4); + } + if (x > 56) { + MoveLeft(4); + } + break; + case 1: + if (y > 64) { + MoveUp(4); + } + else { + behavior = 0; + } + if (x < 56) { + MoveRight(4); + } + if (x > 56) { + MoveLeft(4); + } + break; + case 2: + if (level.player.room != room) { + behavior = previousBehavior; + break; + } + int dx = level.player.x - x; + int dy = level.player.y - y; + if (dx < -50) { + dx = -50; + } + if (dx > 50) { + dx = 50; + } + if (dy < -50) { + dy = -50; + } + if (dy > 50) { + dy = 50; + } + if (dx < 0) { + MoveLeft(-dx); + } + if (dx > 0) { + MoveRight(dx); + } + if (dy < 0) { + MoveUp(-dy); + } + if (dy > 0) { + MoveDown(dy); + } + if (dx == 0 && dy == 0) { + PicksUp(level.player); + behavior = 3; + } + break; + case 3: + if (x <= 56 && y >= 20 && y <= 30) { + Drops(); + behavior = 1; + break; + } + else { + if (x > 56) { + MoveLeft(4); + } + if (y < 20) { + MoveDown(4); + } + if (y > 30) { + MoveUp(4); + } + } + break; + } + } + +} \ No newline at end of file diff --git a/src/com/droidquest/items/SkyGuard.java b/src/com/droidquest/items/SkyGuard.java index 1794d39..c94b2fd 100644 --- a/src/com/droidquest/items/SkyGuard.java +++ b/src/com/droidquest/items/SkyGuard.java @@ -4,59 +4,53 @@ import javax.swing.ImageIcon; import com.droidquest.Room; -public class SkyGuard extends Item -{ -int animationState=0; -int speed; +public class SkyGuard extends Item { + private int animationState = 0; + private int speed; -public SkyGuard (int X, int Y, Room r, int s) - { - x=X; y=Y; room=r; - speed=s; - width=28; height=32; - grabbable = false; - GenerateIcons(); - } + public SkyGuard(int X, int Y, Room r, int s) { + x = X; + y = Y; + room = r; + speed = s; + width = 28; + height = 32; + grabbable = false; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[5]; - for (int a=0; a<5; a++) - icons[a] = new ImageIcon("images/skyguard"+a+".gif"); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[5]; + for (int a = 0; a < 5; a++) { + icons[a] = new ImageIcon("images/skyguard" + a + ".gif"); + } + currentIcon = icons[0].getImage(); + } -public void Animate() - { - animationState = 1-animationState; - - if (speed>0) - { - if (speed+x < 420) - { - MoveRight(speed); - currentIcon = icons[animationState].getImage(); - } - else - { - speed=-speed; - currentIcon = icons[2].getImage(); - } - } - else if (speed<0) - { - if (speed+x > 112) - { - MoveLeft(-speed); - currentIcon = icons[3+animationState].getImage(); - } - else - { - speed=-speed; - currentIcon = icons[2].getImage(); - } - } - - } + public void Animate() { + animationState = 1 - animationState; + + if (speed > 0) { + if (speed + x < 420) { + MoveRight(speed); + currentIcon = icons[animationState].getImage(); + } + else { + speed = -speed; + currentIcon = icons[2].getImage(); + } + } + else if (speed < 0) { + if (speed + x > 112) { + MoveLeft(-speed); + currentIcon = icons[3 + animationState].getImage(); + } + else { + speed = -speed; + currentIcon = icons[2].getImage(); + } + } + + } } diff --git a/src/com/droidquest/items/SkywayFlyer.java b/src/com/droidquest/items/SkywayFlyer.java index c184b78..69d0cd3 100644 --- a/src/com/droidquest/items/SkywayFlyer.java +++ b/src/com/droidquest/items/SkywayFlyer.java @@ -5,62 +5,65 @@ import javax.swing.ImageIcon; import com.droidquest.Room; import com.droidquest.levels.Level; -public class SkywayFlyer extends Item -{ -int speed; -String[] filenames; -int animationState=0; +public class SkywayFlyer extends Item { + private int speed; + private String[] filenames; + private int animationState = 0; -public SkywayFlyer(int X, int Y, Room r, String[] f, int spd) - { - x=X; y=Y; room=r; - width=24; height=32; - orgX = 2; - filenames = f; speed=spd; - grabbable = false; - } + public SkywayFlyer(int X, int Y, Room r, String[] f, int spd) { + x = X; + y = Y; + room = r; + width = 24; + height = 32; + orgX = 2; + filenames = f; + speed = spd; + grabbable = false; + } -public void GenerateIcons() - { - icons = new ImageIcon[filenames.length]; - for (int a=0; a320) - y = 32; - } + public void MoveDown(int dist) { + y = y + dist; + if (y > 320) { + y = 32; + } + } -public void Animate() - { - animationState++; - if (animationState == filenames.length) - animationState=0; - currentIcon = icons[animationState].getImage(); - - if (speed<0) - MoveUp(-speed); - else - MoveDown(speed); - - if (Overlaps(level.player)) - { - level.PlaySound(room, Level.DISCHARGESOUND); - level.player.x = 2*28; - level.player.y = 8*32; - level.player.SetRoom(room.downRoom); - } - } + public void Animate() { + animationState++; + if (animationState == filenames.length) { + animationState = 0; + } + currentIcon = icons[animationState].getImage(); + + if (speed < 0) { + MoveUp(-speed); + } + else { + MoveDown(speed); + } + + if (Overlaps(level.player)) { + level.PlaySound(room, Level.DISCHARGESOUND); + level.player.x = 2 * 28; + level.player.y = 8 * 32; + level.player.SetRoom(room.downRoom); + } + } } diff --git a/src/com/droidquest/items/SlipperyToken.java b/src/com/droidquest/items/SlipperyToken.java index a49c7db..32ae0b9 100644 --- a/src/com/droidquest/items/SlipperyToken.java +++ b/src/com/droidquest/items/SlipperyToken.java @@ -3,57 +3,46 @@ package com.droidquest.items; import com.droidquest.Room; import com.droidquest.materials.Material; -public class SlipperyToken extends Token -{ -boolean jumping = true; +public class SlipperyToken extends Token { + private boolean jumping = true; -public SlipperyToken(int X, int Y, Room r) - { - super(X,Y,r); - } + public SlipperyToken(int X, int Y, Room r) { + super(X, Y, r); + } -public boolean CanBePickedUp(Item item) - { - if (item == level.player && jumping) - return false; - else - return true; - } + public boolean CanBePickedUp(Item item) { + return !(item == level.player && jumping); + } -public void IsDropped() - { - int bigX = (x+width/2)/28; - int bigY = (y+height/2)/32; - Material mat = room.MaterialArray[bigY][bigX]; - if (mat.getClass().toString().endsWith("VendingSlot")) - { - for (int a=0; a0); - boolean bit = (program[doorState][radioState]==1); - if (radio == bit) - { - radioState++; - if (radioState == program[doorState].length) - doorState++; - } - else - radioState =1; - } - break; - - case RESET: - currentRoom = room; - break; - - case LEFT: - currentRoom = currentRoom.leftRoom; - break; - - case RIGHT: - currentRoom = currentRoom.rightRoom; - break; - - case UP: - currentRoom = currentRoom.upRoom; - break; - - case DOWN: - currentRoom = currentRoom.downRoom; - break; - } - - } + public void Animate() { + if (doorState == program.length) { + doorState = 0; + } - } + if (program[doorState][0] == BINARY) { + animationState++; + if (animationState == program[doorState].length) { + animationState = 1; + } + currentIcon = icons[program[doorState][animationState]].getImage(); + } + + switch (program[doorState][0]) { + case MODIFY: { + for (int a = 0; a < program[doorState].length / 3; a++) { + currentRoom.SetMaterial(program[doorState][a * 3 + 1], + program[doorState][a * 3 + 2], + program[doorState][a * 3 + 3]); + } + doorState++; + radioState = 1; + } + break; + + case BINARY: { + currentRoom = room; + boolean radio = (Antenna.radio > 0); + boolean bit = (program[doorState][radioState] == 1); + if (radio == bit) { + radioState++; + if (radioState == program[doorState].length) { + doorState++; + } + } + else { + radioState = 1; + } + } + break; + + case RESET: + currentRoom = room; + break; + + case LEFT: + currentRoom = currentRoom.leftRoom; + break; + + case RIGHT: + currentRoom = currentRoom.rightRoom; + break; + + case UP: + currentRoom = currentRoom.upRoom; + break; + + case DOWN: + currentRoom = currentRoom.downRoom; + break; + } + + } + +} diff --git a/src/com/droidquest/items/SpeedControl.java b/src/com/droidquest/items/SpeedControl.java index a7704e1..686995f 100644 --- a/src/com/droidquest/items/SpeedControl.java +++ b/src/com/droidquest/items/SpeedControl.java @@ -1,96 +1,86 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.chipstuff.ChipCompiler; import com.droidquest.decorations.TextBox; -import com.droidquest.materials.Material; -public +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; -class SpeedControl extends Item -{ -int direction; -public static final int DIR_UP = 0; -public static final int DIR_DOWN = 1; +public class SpeedControl extends Item { + private int direction; + public static final int DIR_UP = 0; + public static final int DIR_DOWN = 1; -public SpeedControl(int X, int Y, Room r, int dir) - { - x=X; y=Y; - room = r; - width=26; height=26; - direction = dir; - GenerateIcons(); - } + public SpeedControl(int X, int Y, Room r, int dir) { + x = X; + y = Y; + room = r; + width = 26; + height = 26; + direction = dir; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - Graphics2D g2; - Color transparent = new Color(0,0,0,0); - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.white); - switch(direction) - { - case DIR_UP: - g.fillRect(12,0,2,2); - g.fillRect(10,2,6,2); - g.fillRect(8,4,10,2); - g.fillRect(6,6,14,2); - g.fillRect(4,8,18,2); - g.fillRect(2,10,22,2); - g.fillRect(0,12,26,2); - g.fillRect(10,14,6,12); - break; - case DIR_DOWN: - g.fillRect(12,24,2,2); - g.fillRect(10,22,6,2); - g.fillRect(8,20,10,2); - g.fillRect(6,18,14,2); - g.fillRect(4,16,18,2); - g.fillRect(2,14,22,2); - g.fillRect(0,12,26,2); - g.fillRect(10,0,6,12); - break; - } - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + Graphics2D g2; + Color transparent = new Color(0, 0, 0, 0); + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.white); + switch (direction) { + case DIR_UP: + g.fillRect(12, 0, 2, 2); + g.fillRect(10, 2, 6, 2); + g.fillRect(8, 4, 10, 2); + g.fillRect(6, 6, 14, 2); + g.fillRect(4, 8, 18, 2); + g.fillRect(2, 10, 22, 2); + g.fillRect(0, 12, 26, 2); + g.fillRect(10, 14, 6, 12); + break; + case DIR_DOWN: + g.fillRect(12, 24, 2, 2); + g.fillRect(10, 22, 6, 2); + g.fillRect(8, 20, 10, 2); + g.fillRect(6, 18, 14, 2); + g.fillRect(4, 16, 18, 2); + g.fillRect(2, 14, 22, 2); + g.fillRect(0, 12, 26, 2); + g.fillRect(10, 0, 6, 12); + break; + } + currentIcon = icons[0].getImage(); + } -public boolean CanBePickedUp(Item item) - { - switch (direction) - { - case DIR_UP: - ChipCompiler.chipSpeed++; - break; - case DIR_DOWN: - if (ChipCompiler.chipSpeed==1) return false; - ChipCompiler.chipSpeed--; - break; - } - TextBox tb = (TextBox) room.textBoxes.elementAt(1); - tb.textString = ChipCompiler.chipSpeed + "x"; - return false; - } + public boolean CanBePickedUp(Item item) { + switch (direction) { + case DIR_UP: + ChipCompiler.chipSpeed++; + break; + case DIR_DOWN: + if (ChipCompiler.chipSpeed == 1) { + return false; + } + ChipCompiler.chipSpeed--; + break; + } + TextBox tb = room.textBoxes.elementAt(1); + tb.textString = ChipCompiler.chipSpeed + "x"; + return false; + } } diff --git a/src/com/droidquest/items/SpyCam.java b/src/com/droidquest/items/SpyCam.java index 1da77b5..c9134db 100644 --- a/src/com/droidquest/items/SpyCam.java +++ b/src/com/droidquest/items/SpyCam.java @@ -1,61 +1,53 @@ package com.droidquest.items; -import java.awt.Graphics; -import java.awt.event.KeyEvent; - -import javax.swing.JPanel; - import com.droidquest.Room; import com.droidquest.decorations.TextBox; -public class SpyCam extends Item -{ -public SpyCam(Room r) - { - x=0; y=0; - room = r; - width=0; height=0; - grabbable=false; - } +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; -public void Draw(Graphics g, JPanel jp) - {} +public class SpyCam extends Item { + public SpyCam(Room r) { + x = 0; + y = 0; + room = r; + width = 0; + height = 0; + grabbable = false; + } -public boolean KeyUp(KeyEvent e) - { - if (e.getKeyCode() == e.VK_RIGHT) - { - SetRoom(room.rightRoom); - return true; - } - if (e.getKeyCode() == e.VK_LEFT) - { - SetRoom(room.leftRoom); - return true; - } - if (e.getKeyCode() == e.VK_UP) - { - SetRoom(room.upRoom); - return true; - } - if (e.getKeyCode() == e.VK_DOWN) - { - SetRoom(room.downRoom); - return true; - } - if (e.getKeyCode() == e.VK_SPACE) - { - level.player=level.gameCursor; - level.currentViewer=level.player; - for (int a=5; a<60; a++) - { - Room r = (Room) level.rooms.elementAt(a); - TextBox tb = (TextBox) r.textBoxes.elementAt(0); - tb.y += 500; - } - return false; - } - return false; - } + public void Draw(Graphics g, JPanel jp) { + } + + public boolean KeyUp(KeyEvent e) { + if (e.getKeyCode() == e.VK_RIGHT) { + SetRoom(room.rightRoom); + return true; + } + if (e.getKeyCode() == e.VK_LEFT) { + SetRoom(room.leftRoom); + return true; + } + if (e.getKeyCode() == e.VK_UP) { + SetRoom(room.upRoom); + return true; + } + if (e.getKeyCode() == e.VK_DOWN) { + SetRoom(room.downRoom); + return true; + } + if (e.getKeyCode() == e.VK_SPACE) { + level.player = level.gameCursor; + level.currentViewer = level.player; + for (int a = 5; a < 60; a++) { + Room r = level.rooms.elementAt(a); + TextBox tb = r.textBoxes.elementAt(0); + tb.y += 500; + } + return false; + } + return false; + } } \ No newline at end of file diff --git a/src/com/droidquest/items/Square.java b/src/com/droidquest/items/Square.java index 3d42ffc..86ae4da 100644 --- a/src/com/droidquest/items/Square.java +++ b/src/com/droidquest/items/Square.java @@ -1,45 +1,40 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; -public class Square extends Item -{ -Color color; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; -public Square(int X, int Y, Room r, Color c) - { - x=X; y=Y; room=r; - width=28; height=28; - editable=true; - color = c; - GenerateIcons(); - } +public class Square extends Item { + private Color color; -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - g.setColor(color); - g.fillRect(0,0,28,28); - currentIcon = icons[0].getImage(); - } + public Square(int X, int Y, Room r, Color c) { + x = X; + y = Y; + room = r; + width = 28; + height = 28; + editable = true; + color = c; + GenerateIcons(); + } + + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + + g.setColor(color); + g.fillRect(0, 0, 28, 28); + currentIcon = icons[0].getImage(); + } } diff --git a/src/com/droidquest/items/StormCloud.java b/src/com/droidquest/items/StormCloud.java index 147e7a8..a001e92 100644 --- a/src/com/droidquest/items/StormCloud.java +++ b/src/com/droidquest/items/StormCloud.java @@ -1,256 +1,276 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.devices.StormShield; -public class StormCloud extends Item -{ -transient int animateState=0; -transient int xDirection; -transient int yDirection; -transient int moveTimer; -transient OrangeRobot orobot; -transient WhiteRobot wrobot; -transient BlueRobot brobot; -transient StormShield stormshield; -static int maxspeed = 30; -transient int anicount=0; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; -public StormCloud(int X, int Y, Room r) - { - x=X; y=Y; room=r; - width=28; height=32; - grabbable=false; - GenerateIcons(); - } +public class StormCloud extends Item { + private transient int animateState = 0; + private transient int xDirection; + private transient int yDirection; + private transient int moveTimer; + private transient OrangeRobot orobot; + private transient WhiteRobot wrobot; + private transient BlueRobot brobot; + private transient StormShield stormshield; + private static int maxspeed = 30; + private transient int anicount = 0; -public void GenerateIcons() - { - icons = new ImageIcon[3]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[2]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - for (int a=0; a<3; a++) - { - try - { - g = icons[a].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,4*28,3*32); - - g.setColor(Color.white); - g.fillRect(16,0,4,2); - g.fillRect(4,2,4,2); - g.fillRect(12,4,4,2); - g.fillRect(20,4,4,2); - g.fillRect(4,8,4,2); - g.fillRect(12,8,4,2); - g.fillRect(24,8,4,2); - g.fillRect(0,10,4,2); - g.fillRect(8,10,4,2); - g.fillRect(16,10,4,2); - g.fillRect(24,12,4,2); - g.fillRect(8,14,4,2); - g.fillRect(16,14,4,2); - g.fillRect(0,18,4,2); - g.fillRect(12,18,4,2); - g.fillRect(24,18,4,2); - g.fillRect(16,20,4,2); - g.fillRect(4,22,4,2); - g.fillRect(20,22,4,2); - g.fillRect(8,24,4,2); - g.fillRect(16,24,4,2); - } - currentIcon = icons[0].getImage(); - do - xDirection = level.random.nextInt(maxspeed*2 + 1)-maxspeed; - while (xDirection == 0); - do - yDirection = level.random.nextInt(maxspeed*2 + 1)-maxspeed; - while (yDirection == 0); - moveTimer = level.random.nextInt(50)+1; - } + public StormCloud(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 32; + grabbable = false; + GenerateIcons(); + } -public void Animate() - { - animateState++; - if (animateState==3) animateState=0; - currentIcon = icons[animateState].getImage(); - - if (anicount<3) - { - Graphics g; - anicount++; - try - { - icons[animateState]= new ImageIcon(new BufferedImage(4*28,3*32,BufferedImage.TYPE_4BYTE_ABGR)); - g = icons[animateState].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,4*28,3*32); - for (int b=0; b<50; b++) - { - switch (level.random.nextInt(7)) - { - case 0: g2.setColor(Color.white); break; - case 1: g2.setColor(Color.red); break; - case 2: g2.setColor(Color.orange); break; - case 3: g2.setColor(Color.yellow); break; - case 4: g2.setColor(Color.green); break; - case 5: g2.setColor(Color.blue); break; - case 6: g2.setColor(Color.magenta); break; - } - int x1, y1, d; - int d2 = (3*32/2) * (3*32/2); - do - { - x1 = level.random.nextInt(3*32) + 4*28/2 - 3*32/2; - y1 = level.random.nextInt(3*32); - int xd= (x1 - 4*28/2) ; - int yd= (y1 - 3*32/2); - d = xd*xd + yd*yd; - } - while (d>d2); - g2.fillRect(x1,y1,2,2); - } - } - - moveTimer--; - if (moveTimer==0) - { - do - xDirection = level.random.nextInt(maxspeed*2 + 1)-maxspeed; - while (xDirection == 0); - do - yDirection = level.random.nextInt(maxspeed*2 + 1)-maxspeed; - while (yDirection == 0); - moveTimer = level.random.nextInt(50)+1; - } - if (brobot==null) - { - for (int a=0; a0) MoveRight(xDirection); - if (xDirection<0) MoveLeft(-xDirection); - if (yDirection>0) MoveDown(yDirection); - if (yDirection<0) MoveUp(-yDirection); - - if (brobot!=null) - if (Overlaps(brobot)) - { - boolean drain = true; - if (stormshield.room == brobot.InternalRoom) - if (stormshield.ports[0].value==true) - drain=false; - if (drain) - brobot.charge -= 5000; - if (brobot.charge<0) - brobot.charge = 0; - } - - if (orobot!=null) - if (Overlaps(orobot)) - { - boolean drain = true; - if (stormshield.room == orobot.InternalRoom) - if (stormshield.ports[0].value==true) - drain=false; - if (drain) - orobot.charge -= 5000; - if (orobot.charge<0) - orobot.charge = 0; - } - - if (wrobot!=null) - if (Overlaps(wrobot)) - { - boolean drain = true; - if (stormshield.room == wrobot.InternalRoom) - if (stormshield.ports[0].value==true) - drain=false; - if (drain) - wrobot.charge -= 5000; - if (wrobot.charge<0) - wrobot.charge = 0; - } - - } + public void GenerateIcons() { + icons = new ImageIcon[3]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[2] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + for (int a = 0; a < 3; a++) { + try { + g = icons[a].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, 4 * 28, 3 * 32); -public void MoveRight(int dist) - { - int newX = x + dist; - if (newX > 559 - 4*28/2) - { - xDirection = -(level.random.nextInt(maxspeed)+1); - newX = x + xDirection; - } - x=newX; - } + g.setColor(Color.white); + g.fillRect(16, 0, 4, 2); + g.fillRect(4, 2, 4, 2); + g.fillRect(12, 4, 4, 2); + g.fillRect(20, 4, 4, 2); + g.fillRect(4, 8, 4, 2); + g.fillRect(12, 8, 4, 2); + g.fillRect(24, 8, 4, 2); + g.fillRect(0, 10, 4, 2); + g.fillRect(8, 10, 4, 2); + g.fillRect(16, 10, 4, 2); + g.fillRect(24, 12, 4, 2); + g.fillRect(8, 14, 4, 2); + g.fillRect(16, 14, 4, 2); + g.fillRect(0, 18, 4, 2); + g.fillRect(12, 18, 4, 2); + g.fillRect(24, 18, 4, 2); + g.fillRect(16, 20, 4, 2); + g.fillRect(4, 22, 4, 2); + g.fillRect(20, 22, 4, 2); + g.fillRect(8, 24, 4, 2); + g.fillRect(16, 24, 4, 2); + } + currentIcon = icons[0].getImage(); + do { + xDirection = level.random.nextInt(maxspeed * 2 + 1) - maxspeed; + } + while (xDirection == 0); + do { + yDirection = level.random.nextInt(maxspeed * 2 + 1) - maxspeed; + } + while (yDirection == 0); + moveTimer = level.random.nextInt(50) + 1; + } -public void MoveLeft(int dist) - { - int newX = x - dist; - if (newX < 0) - { - xDirection = level.random.nextInt(maxspeed)+1; - newX = x + xDirection; - } - x=newX; - } + public void Animate() { + animateState++; + if (animateState == 3) { + animateState = 0; + } + currentIcon = icons[animateState].getImage(); -public void MoveUp(int dist) - { - y -= dist; - if (y < 0) - { - room = room.upRoom; - y += 384; - } - } + if (anicount < 3) { + Graphics g; + anicount++; + try { + icons[animateState] = new ImageIcon(new BufferedImage(4 * 28, 3 * 32, BufferedImage.TYPE_4BYTE_ABGR)); + g = icons[animateState].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, 4 * 28, 3 * 32); + for (int b = 0; b < 50; b++) { + switch (level.random.nextInt(7)) { + case 0: + g2.setColor(Color.white); + break; + case 1: + g2.setColor(Color.red); + break; + case 2: + g2.setColor(Color.orange); + break; + case 3: + g2.setColor(Color.yellow); + break; + case 4: + g2.setColor(Color.green); + break; + case 5: + g2.setColor(Color.blue); + break; + case 6: + g2.setColor(Color.magenta); + break; + } + int x1, y1, d; + int d2 = (3 * 32 / 2) * (3 * 32 / 2); + do { + x1 = level.random.nextInt(3 * 32) + 4 * 28 / 2 - 3 * 32 / 2; + y1 = level.random.nextInt(3 * 32); + int xd = (x1 - 4 * 28 / 2); + int yd = (y1 - 3 * 32 / 2); + d = xd * xd + yd * yd; + } + while (d > d2); + g2.fillRect(x1, y1, 2, 2); + } + } -public void MoveDown(int dist) - { - y += dist; - if (y > 383) - { - room = room.downRoom; - y -= 384; - } - } + moveTimer--; + if (moveTimer == 0) { + do { + xDirection = level.random.nextInt(maxspeed * 2 + 1) - maxspeed; + } + while (xDirection == 0); + do { + yDirection = level.random.nextInt(maxspeed * 2 + 1) - maxspeed; + } + while (yDirection == 0); + moveTimer = level.random.nextInt(50) + 1; + } + if (brobot == null) { + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item.getClass().toString().endsWith("BlueRobot")) { + brobot = (BlueRobot) item; + } + if (item.getClass().toString().endsWith("OrangeRobot")) { + orobot = (OrangeRobot) item; + } + if (item.getClass().toString().endsWith("WhiteRobot")) { + wrobot = (WhiteRobot) item; + } + if (item.getClass().toString().endsWith("StormShield")) { + stormshield = (StormShield) item; + } + } + } + + if (xDirection > 0) { + MoveRight(xDirection); + } + if (xDirection < 0) { + MoveLeft(-xDirection); + } + if (yDirection > 0) { + MoveDown(yDirection); + } + if (yDirection < 0) { + MoveUp(-yDirection); + } + + if (brobot != null) { + if (Overlaps(brobot)) { + boolean drain = true; + if (stormshield.room == brobot.InternalRoom) { + if (stormshield.ports[0].value) { + drain = false; + } + } + if (drain) { + brobot.charge -= 5000; + } + if (brobot.charge < 0) { + brobot.charge = 0; + } + } + } + + if (orobot != null) { + if (Overlaps(orobot)) { + boolean drain = true; + if (stormshield.room == orobot.InternalRoom) { + if (stormshield.ports[0].value) { + drain = false; + } + } + if (drain) { + orobot.charge -= 5000; + } + if (orobot.charge < 0) { + orobot.charge = 0; + } + } + } + + if (wrobot != null) { + if (Overlaps(wrobot)) { + boolean drain = true; + if (stormshield.room == wrobot.InternalRoom) { + if (stormshield.ports[0].value) { + drain = false; + } + } + if (drain) { + wrobot.charge -= 5000; + } + if (wrobot.charge < 0) { + wrobot.charge = 0; + } + } + } + + } + + public void MoveRight(int dist) { + int newX = x + dist; + if (newX > 559 - 4 * 28 / 2) { + xDirection = -(level.random.nextInt(maxspeed) + 1); + newX = x + xDirection; + } + x = newX; + } + + public void MoveLeft(int dist) { + int newX = x - dist; + if (newX < 0) { + xDirection = level.random.nextInt(maxspeed) + 1; + newX = x + xDirection; + } + x = newX; + } + + public void MoveUp(int dist) { + y -= dist; + if (y < 0) { + room = room.upRoom; + y += 384; + } + } + + public void MoveDown(int dist) { + y += dist; + if (y > 383) { + room = room.downRoom; + y -= 384; + } + } } diff --git a/src/com/droidquest/items/Suitcase.java b/src/com/droidquest/items/Suitcase.java index 0be64be..e40cb1d 100644 --- a/src/com/droidquest/items/Suitcase.java +++ b/src/com/droidquest/items/Suitcase.java @@ -1,80 +1,77 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.materials.Material; -public class Suitcase extends Item -{ -public Suitcase(int X, int Y, Room r) - { - x=X; y=Y; room=r; - width = 24; height=18; - width = 36; height=42; - orgX = -6; orgY = -12; - - InternalRoom = new Room(); - int[][] table1 = { - {0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - InternalRoom.RoomArray = table1; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; - InternalRoom.portalItem = this; - level.rooms.addElement(InternalRoom); - Material mat1 = Material.FindSimiliar(new Material(Color.blue, false, true)); - int mat1Index = level.materials.indexOf(mat1); - - for (int rY=0; rY<12; rY++) - for (int rX=0; rX<20; rX++) - { - if (InternalRoom.RoomArray[rY][rX]==1) - InternalRoom.RoomArray[rY][rX] = mat1Index; - } - - GenerateIcons(); - } +public class Suitcase extends Item { + public Suitcase(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 24; + height = 18; + width = 36; + height = 42; + orgX = -6; + orgY = -12; -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.blue); - g.fillRect(0,4,24,14); - g.fillRect(7,0,10,2); - g.fillRect(7,0,2,4); - g.fillRect(15,0,2,4); - currentIcon = icons[0].getImage(); - } + InternalRoom = new Room(); + InternalRoom.RoomArray = new int[][]{ + {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + + InternalRoom.portalItem = this; + level.rooms.addElement(InternalRoom); + Material mat1 = Material.FindSimiliar(new Material(Color.blue, false, true)); + int mat1Index = level.materials.indexOf(mat1); + + for (int rY = 0; rY < 12; rY++) { + for (int rX = 0; rX < 20; rX++) { + if (InternalRoom.RoomArray[rY][rX] == 1) { + InternalRoom.RoomArray[rY][rX] = mat1Index; + } + } + } + + GenerateIcons(); + } + + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.blue); + g.fillRect(0, 4, 24, 14); + g.fillRect(7, 0, 10, 2); + g.fillRect(7, 0, 2, 4); + g.fillRect(15, 0, 2, 4); + currentIcon = icons[0].getImage(); + } } \ No newline at end of file diff --git a/src/com/droidquest/items/Sweeper.java b/src/com/droidquest/items/Sweeper.java index d5eda7f..841d856 100644 --- a/src/com/droidquest/items/Sweeper.java +++ b/src/com/droidquest/items/Sweeper.java @@ -1,218 +1,204 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; -public class Sweeper extends Item -{ -int animationState; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; + +public class Sweeper extends Item { + private int animationState; // 1=Moving Left // 2=Stopped and facing camera // 3=Moving Right // 4=Stopped and facing camera -public Sweeper(int X, int Y, Room r) - { - x=X; y=Y; - room=r; - width=48; height=32; - grabbable = false; - GenerateIcons(); - currentIcon = icons[0].getImage(); - animationState=1; - } + public Sweeper(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 48; + height = 32; + grabbable = false; + GenerateIcons(); + currentIcon = icons[0].getImage(); + animationState = 1; + } -public void GenerateIcons() - { - icons = new ImageIcon[3]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[2]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - Graphics2D g2; - Color transparent = new Color(0,0,0,0); - - // sweeper1.gif = Moving Right - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.white); - g.fillRect(12,0,12,2); - g.fillRect(8,2,20,10); - g.fillRect(8,12,24,2); - g.fillRect(4,14,28,8); - g.fillRect(4,22,36,6); - g.fillRect(0,28,40,4); - g.fillRect(28,4,8,2); - g.fillRect(36,2,4,6); - g.fillRect(32,14,12,2); - g.fillRect(40,12,8,2); - g.fillRect(40,16,8,2); - g.setColor(Color.black); - g.fillRect(12,8,4,4); - g.fillRect(20,8,4,4); - g.fillRect(8,16,4,2); - g.fillRect(8,20,4,2); - g.fillRect(8,26,4,2); - g.fillRect(16,18,4,2); - g.fillRect(16,22,4,2); - g.fillRect(20,26,4,2); - g.fillRect(24,16,4,2); - g.fillRect(24,20,4,2); - g.fillRect(28,24,4,2); - g.fillRect(32,28,4,2); - - // sweeper2.gif = Looking Straight - try - { - g = icons[1].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.white); - g.fillRect(18,0,12,2); - g.fillRect(14,2,20,10); - g.fillRect(10,12,28,20); - g.fillRect(6,28,36,4); - g.setColor(Color.black); - g.fillRect(22,2,4,6); - g.fillRect(18,4,12,2); - g.fillRect(18,8,4,4); - g.fillRect(26,8,4,4); - g.fillRect(14,12,4,6); - g.fillRect(30,12,4,6); - g.fillRect(14,20,4,2); - g.fillRect(14,24,4,2); - g.fillRect(14,28,4,2); - g.fillRect(22,16,4,2); - g.fillRect(22,20,4,2); - g.fillRect(22,24,4,2); - g.fillRect(22,28,4,2); - g.fillRect(30,20,4,2); - g.fillRect(30,24,4,2); - g.fillRect(30,28,4,2); - - // sweeper3.gif = Moving Left - try - { - g = icons[2].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g2 = (Graphics2D) g; - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.white); - g.fillRect(24,0,12,2); - g.fillRect(20,2,20,10); - g.fillRect(16,12,24,2); - g.fillRect(16,14,28,8); - g.fillRect(12,22,36,6); - g.fillRect(8,28,40,4); - g.fillRect(12,4,8,2); - g.fillRect(8,2,4,6); - g.fillRect(4,14,12,2); - g.fillRect(0,12,8,2); - g.fillRect(0,16,8,2); - g.setColor(Color.black); - g.fillRect(24,8,4,4); - g.fillRect(32,8,4,4); - g.fillRect(36,16,4,2); - g.fillRect(36,20,4,2); - g.fillRect(36,26,4,2); - g.fillRect(28,18,4,2); - g.fillRect(28,22,4,2); - g.fillRect(24,26,4,2); - g.fillRect(20,16,4,2); - g.fillRect(20,20,4,2); - g.fillRect(16,24,4,2); - g.fillRect(12,28,4,2); - - switch (animationState) - { - case 1: - currentIcon = icons[0].getImage(); - break; - case 3: - currentIcon = icons[2].getImage(); - break; - case 2: - case 4: - currentIcon = icons[1].getImage(); - break; - } - } + public void GenerateIcons() { + icons = new ImageIcon[3]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[2] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + Graphics2D g2; + Color transparent = new Color(0, 0, 0, 0); -public void Animate() - { - for (int a = 0; a< level.items.size(); a++) - { - Item testItem = (Item) level.items.elementAt(a); - if (testItem.carriedBy == null) - if (Overlaps(testItem)) - { - testItem.x = 280; - testItem.y = 192; - testItem.SetRoom((Room) level.rooms.elementAt(1)); - } - } - - switch (animationState) - { - case 1: - if (room==(Room) level.rooms.elementAt(14) && x>=120) - { - animationState = 2; - currentIcon = icons[1].getImage(); - } - else - MoveRight(8); - break; + // sweeper1.gif = Moving Right + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.white); + g.fillRect(12, 0, 12, 2); + g.fillRect(8, 2, 20, 10); + g.fillRect(8, 12, 24, 2); + g.fillRect(4, 14, 28, 8); + g.fillRect(4, 22, 36, 6); + g.fillRect(0, 28, 40, 4); + g.fillRect(28, 4, 8, 2); + g.fillRect(36, 2, 4, 6); + g.fillRect(32, 14, 12, 2); + g.fillRect(40, 12, 8, 2); + g.fillRect(40, 16, 8, 2); + g.setColor(Color.black); + g.fillRect(12, 8, 4, 4); + g.fillRect(20, 8, 4, 4); + g.fillRect(8, 16, 4, 2); + g.fillRect(8, 20, 4, 2); + g.fillRect(8, 26, 4, 2); + g.fillRect(16, 18, 4, 2); + g.fillRect(16, 22, 4, 2); + g.fillRect(20, 26, 4, 2); + g.fillRect(24, 16, 4, 2); + g.fillRect(24, 20, 4, 2); + g.fillRect(28, 24, 4, 2); + g.fillRect(32, 28, 4, 2); - case 2: - animationState = 3; - currentIcon = icons[2].getImage(); - break; + // sweeper2.gif = Looking Straight + try { + g = icons[1].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.white); + g.fillRect(18, 0, 12, 2); + g.fillRect(14, 2, 20, 10); + g.fillRect(10, 12, 28, 20); + g.fillRect(6, 28, 36, 4); + g.setColor(Color.black); + g.fillRect(22, 2, 4, 6); + g.fillRect(18, 4, 12, 2); + g.fillRect(18, 8, 4, 4); + g.fillRect(26, 8, 4, 4); + g.fillRect(14, 12, 4, 6); + g.fillRect(30, 12, 4, 6); + g.fillRect(14, 20, 4, 2); + g.fillRect(14, 24, 4, 2); + g.fillRect(14, 28, 4, 2); + g.fillRect(22, 16, 4, 2); + g.fillRect(22, 20, 4, 2); + g.fillRect(22, 24, 4, 2); + g.fillRect(22, 28, 4, 2); + g.fillRect(30, 20, 4, 2); + g.fillRect(30, 24, 4, 2); + g.fillRect(30, 28, 4, 2); - case 3: - if (room==(Room) level.rooms.elementAt(2) && x<=504) - { - animationState = 4; - currentIcon = icons[2].getImage(); - } - else - MoveLeft(8); - break; + // sweeper3.gif = Moving Left + try { + g = icons[2].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g2 = (Graphics2D) g; + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.white); + g.fillRect(24, 0, 12, 2); + g.fillRect(20, 2, 20, 10); + g.fillRect(16, 12, 24, 2); + g.fillRect(16, 14, 28, 8); + g.fillRect(12, 22, 36, 6); + g.fillRect(8, 28, 40, 4); + g.fillRect(12, 4, 8, 2); + g.fillRect(8, 2, 4, 6); + g.fillRect(4, 14, 12, 2); + g.fillRect(0, 12, 8, 2); + g.fillRect(0, 16, 8, 2); + g.setColor(Color.black); + g.fillRect(24, 8, 4, 4); + g.fillRect(32, 8, 4, 4); + g.fillRect(36, 16, 4, 2); + g.fillRect(36, 20, 4, 2); + g.fillRect(36, 26, 4, 2); + g.fillRect(28, 18, 4, 2); + g.fillRect(28, 22, 4, 2); + g.fillRect(24, 26, 4, 2); + g.fillRect(20, 16, 4, 2); + g.fillRect(20, 20, 4, 2); + g.fillRect(16, 24, 4, 2); + g.fillRect(12, 28, 4, 2); - case 4: - animationState = 1; - currentIcon = icons[0].getImage(); - } - } + switch (animationState) { + case 1: + currentIcon = icons[0].getImage(); + break; + case 3: + currentIcon = icons[2].getImage(); + break; + case 2: + case 4: + currentIcon = icons[1].getImage(); + break; + } + } + + public void Animate() { + for (int a = 0; a < level.items.size(); a++) { + Item testItem = level.items.elementAt(a); + if (testItem.carriedBy == null) { + if (Overlaps(testItem)) { + testItem.x = 280; + testItem.y = 192; + testItem.SetRoom(level.rooms.elementAt(1)); + } + } + } + + switch (animationState) { + case 1: + if (room == level.rooms.elementAt(14) && x >= 120) { + animationState = 2; + currentIcon = icons[1].getImage(); + } + else { + MoveRight(8); + } + break; + + case 2: + animationState = 3; + currentIcon = icons[2].getImage(); + break; + + case 3: + if (room == level.rooms.elementAt(2) && x <= 504) { + animationState = 4; + currentIcon = icons[2].getImage(); + } + else { + MoveLeft(8); + } + break; + + case 4: + animationState = 1; + currentIcon = icons[0].getImage(); + } + } } diff --git a/src/com/droidquest/items/Switch4A.java b/src/com/droidquest/items/Switch4A.java index e7e7a4b..686c35d 100644 --- a/src/com/droidquest/items/Switch4A.java +++ b/src/com/droidquest/items/Switch4A.java @@ -3,162 +3,166 @@ package com.droidquest.items; import com.droidquest.Room; import com.droidquest.materials.Switch; -public class Switch4A extends Switch -{ -int count = 0; -int doorState=0; -transient Room room= null; +public class Switch4A extends Switch { + int count = 0; + private int doorState = 0; + transient Room room = null; -public Switch4A() - { - super(Switch.ROT_UP); - GenerateIcons(); - } + public Switch4A() { + super(Switch.ROT_UP); + GenerateIcons(); + } -public void TouchedByItem(Item item) - { - if (!value) - { - value=true; - count++; - room = item.room; - } - } + public void TouchedByItem(Item item) { + if (!value) { + value = true; + count++; + room = item.room; + } + } -public void Animate() - { - super.Animate(); - - if (doorState==0 && count==4) - doorState=1; - - switch (doorState) - { - case 1: - room.SetMaterial(8,3,0); - room.SetMaterial(9,3,0); - room.SetMaterial(10,3,0); - room.SetMaterial(11,3,0); - room.SetMaterial(8,8,0); - room.SetMaterial(9,8,0); - room.SetMaterial(10,8,0); - room.SetMaterial(11,8,0); - room.SetMaterial(12,4,0); - room.SetMaterial(12,5,0); - room.SetMaterial(12,6,0); - room.SetMaterial(12,7,0); - room.SetMaterial(13,4,4); - room.SetMaterial(13,7,4); - room.SetMaterial(7,4,0); - room.SetMaterial(7,5,0); - room.SetMaterial(7,6,0); - room.SetMaterial(7,7,0); - room.SetMaterial(6,4,4); - room.SetMaterial(6,7,4); - doorState++; - break; - case 2: - room.SetMaterial(8,2,0); - room.SetMaterial(9,2,0); - room.SetMaterial(10,2,0); - room.SetMaterial(11,2,0); - room.SetMaterial(12,2,0); - room.SetMaterial(7,9,0); - room.SetMaterial(8,9,0); - room.SetMaterial(9,9,0); - room.SetMaterial(10,9,0); - room.SetMaterial(11,9,0); - room.SetMaterial(13,4,0); - room.SetMaterial(13,5,0); - room.SetMaterial(13,6,0); - room.SetMaterial(13,7,0); - room.SetMaterial(14,4,4); - room.SetMaterial(14,7,4); - room.SetMaterial(6,4,0); - room.SetMaterial(6,5,0); - room.SetMaterial(6,6,0); - room.SetMaterial(6,7,0); - room.SetMaterial(5,4,4); - room.SetMaterial(5,7,4); - doorState++; - break; - case 3: - room.SetMaterial(8,1,0); - room.SetMaterial(9,1,0); - room.SetMaterial(10,1,0); - room.SetMaterial(11,1,0); - room.SetMaterial(8,10,0); - room.SetMaterial(9,10,0); - room.SetMaterial(10,10,0); - room.SetMaterial(11,10,0); - room.SetMaterial(14,4,0); - room.SetMaterial(14,5,0); - room.SetMaterial(14,6,0); - room.SetMaterial(14,7,0); - room.SetMaterial(15,4,4); - room.SetMaterial(15,7,4); - room.SetMaterial(5,4,0); - room.SetMaterial(5,5,0); - room.SetMaterial(5,6,0); - room.SetMaterial(5,7,0); - room.SetMaterial(4,4,4); - room.SetMaterial(4,7,4); - doorState++; - break; - case 4: - Room temproom = room.rightRoom; // KeyTunnel Left - temproom.SetMaterial(2,3,0); - for (int a=0; a<8; a++) - { - temproom.SetMaterial(8,a+1,0); - temproom.SetMaterial(12,a+1,0); - temproom.SetMaterial(16,a+1,0); - } - temproom = temproom.rightRoom; // KeyTunnel Right - for (int a=0; a<8; a++) - { - temproom.SetMaterial(3,a+1,0); - temproom.SetMaterial(7,a+1,0); - temproom.SetMaterial(11,a+1,0); - } - temproom = room.leftRoom; // MineField top right - for (int Y=0; Y<12; Y++) - for (int X=0; X<20; X++) - if (temproom.RoomArray[Y][X]==8) - temproom.SetMaterial(X,Y,11); - temproom = temproom.leftRoom; // MineField top left - for (int Y=0; Y<12; Y++) - for (int X=0; X<20; X++) - { - if (temproom.RoomArray[Y][X]==8) - temproom.SetMaterial(X,Y,11); - if (temproom.RoomArray[Y][X]==16) - temproom.SetMaterial(X,Y,0); - } - temproom = temproom.downRoom; // MineField botom left - for (int Y=0; Y<12; Y++) - for (int X=0; X<20; X++) - if (temproom.RoomArray[Y][X]==8) - temproom.SetMaterial(X,Y,11); - temproom = temproom.rightRoom; // MineField bottom right - for (int Y=0; Y<12; Y++) - for (int X=0; X<20; X++) - if (temproom.RoomArray[Y][X]==8) - temproom.SetMaterial(X,Y,11); - temproom = room.upRoom; - temproom.SetMaterial(19,5,0); - temproom.SetMaterial(19,6,0); - temproom.SetMaterial(19,7,0); - temproom = temproom.rightRoom; - temproom = temproom.upRoom; - temproom = temproom.leftRoom; - temproom = temproom.leftRoom; - temproom.SetMaterial(19,5,0); - temproom.SetMaterial(19,6,0); - doorState++; - break; - - } - } + public void Animate() { + super.Animate(); + + if (doorState == 0 && count == 4) { + doorState = 1; + } + + switch (doorState) { + case 1: + room.SetMaterial(8, 3, 0); + room.SetMaterial(9, 3, 0); + room.SetMaterial(10, 3, 0); + room.SetMaterial(11, 3, 0); + room.SetMaterial(8, 8, 0); + room.SetMaterial(9, 8, 0); + room.SetMaterial(10, 8, 0); + room.SetMaterial(11, 8, 0); + room.SetMaterial(12, 4, 0); + room.SetMaterial(12, 5, 0); + room.SetMaterial(12, 6, 0); + room.SetMaterial(12, 7, 0); + room.SetMaterial(13, 4, 4); + room.SetMaterial(13, 7, 4); + room.SetMaterial(7, 4, 0); + room.SetMaterial(7, 5, 0); + room.SetMaterial(7, 6, 0); + room.SetMaterial(7, 7, 0); + room.SetMaterial(6, 4, 4); + room.SetMaterial(6, 7, 4); + doorState++; + break; + case 2: + room.SetMaterial(8, 2, 0); + room.SetMaterial(9, 2, 0); + room.SetMaterial(10, 2, 0); + room.SetMaterial(11, 2, 0); + room.SetMaterial(12, 2, 0); + room.SetMaterial(7, 9, 0); + room.SetMaterial(8, 9, 0); + room.SetMaterial(9, 9, 0); + room.SetMaterial(10, 9, 0); + room.SetMaterial(11, 9, 0); + room.SetMaterial(13, 4, 0); + room.SetMaterial(13, 5, 0); + room.SetMaterial(13, 6, 0); + room.SetMaterial(13, 7, 0); + room.SetMaterial(14, 4, 4); + room.SetMaterial(14, 7, 4); + room.SetMaterial(6, 4, 0); + room.SetMaterial(6, 5, 0); + room.SetMaterial(6, 6, 0); + room.SetMaterial(6, 7, 0); + room.SetMaterial(5, 4, 4); + room.SetMaterial(5, 7, 4); + doorState++; + break; + case 3: + room.SetMaterial(8, 1, 0); + room.SetMaterial(9, 1, 0); + room.SetMaterial(10, 1, 0); + room.SetMaterial(11, 1, 0); + room.SetMaterial(8, 10, 0); + room.SetMaterial(9, 10, 0); + room.SetMaterial(10, 10, 0); + room.SetMaterial(11, 10, 0); + room.SetMaterial(14, 4, 0); + room.SetMaterial(14, 5, 0); + room.SetMaterial(14, 6, 0); + room.SetMaterial(14, 7, 0); + room.SetMaterial(15, 4, 4); + room.SetMaterial(15, 7, 4); + room.SetMaterial(5, 4, 0); + room.SetMaterial(5, 5, 0); + room.SetMaterial(5, 6, 0); + room.SetMaterial(5, 7, 0); + room.SetMaterial(4, 4, 4); + room.SetMaterial(4, 7, 4); + doorState++; + break; + case 4: + Room temproom = room.rightRoom; // KeyTunnel Left + temproom.SetMaterial(2, 3, 0); + for (int a = 0; a < 8; a++) { + temproom.SetMaterial(8, a + 1, 0); + temproom.SetMaterial(12, a + 1, 0); + temproom.SetMaterial(16, a + 1, 0); + } + temproom = temproom.rightRoom; // KeyTunnel Right + for (int a = 0; a < 8; a++) { + temproom.SetMaterial(3, a + 1, 0); + temproom.SetMaterial(7, a + 1, 0); + temproom.SetMaterial(11, a + 1, 0); + } + temproom = room.leftRoom; // MineField top right + for (int Y = 0; Y < 12; Y++) { + for (int X = 0; X < 20; X++) { + if (temproom.RoomArray[Y][X] == 8) { + temproom.SetMaterial(X, Y, 11); + } + } + } + temproom = temproom.leftRoom; // MineField top left + for (int Y = 0; Y < 12; Y++) { + for (int X = 0; X < 20; X++) { + if (temproom.RoomArray[Y][X] == 8) { + temproom.SetMaterial(X, Y, 11); + } + if (temproom.RoomArray[Y][X] == 16) { + temproom.SetMaterial(X, Y, 0); + } + } + } + temproom = temproom.downRoom; // MineField bottom left + for (int Y = 0; Y < 12; Y++) { + for (int X = 0; X < 20; X++) { + if (temproom.RoomArray[Y][X] == 8) { + temproom.SetMaterial(X, Y, 11); + } + } + } + temproom = temproom.rightRoom; // MineField bottom right + for (int Y = 0; Y < 12; Y++) { + for (int X = 0; X < 20; X++) { + if (temproom.RoomArray[Y][X] == 8) { + temproom.SetMaterial(X, Y, 11); + } + } + } + temproom = room.upRoom; + temproom.SetMaterial(19, 5, 0); + temproom.SetMaterial(19, 6, 0); + temproom.SetMaterial(19, 7, 0); + temproom = temproom.rightRoom; + temproom = temproom.upRoom; + temproom = temproom.leftRoom; + temproom = temproom.leftRoom; + temproom.SetMaterial(19, 5, 0); + temproom.SetMaterial(19, 6, 0); + doorState++; + break; + + } + } } diff --git a/src/com/droidquest/items/Switch4B.java b/src/com/droidquest/items/Switch4B.java index 9b6f546..5b9e2e0 100644 --- a/src/com/droidquest/items/Switch4B.java +++ b/src/com/droidquest/items/Switch4B.java @@ -3,32 +3,27 @@ package com.droidquest.items; import com.droidquest.materials.Material; import com.droidquest.materials.Switch; -public class Switch4B extends Switch -{ -transient Switch4A sw = null; +public class Switch4B extends Switch { + private transient Switch4A sw = null; -public Switch4B() - { - super(Switch.ROT_RIGHT); - } + public Switch4B() { + super(Switch.ROT_RIGHT); + } -public void TouchedByItem(Item item) - { - if (sw==null) - { - for (int a=0; a320) y=320; - } - else - { - // Open ToolBox - width=166; height=94; - open=true; - currentIcon = icons[1].getImage(); - y-=72; - if (y<32) y=32; - if (x>338) x=338; - } - } + NOTGate ng = new NOTGate(0, 0, null); + ng.Function(); + ng.Decorate(); + g2.drawImage(ng.icons[0].getImage(), 132, 4, level); -public boolean CanBePickedUp(Item item) - { - if (item != level.gameCursor) return false; - if (open) - { - int ix = item.x - x + item.width/2; - int iy = item.y - y + item.height/2; - if (ix < 26 && iy > 72) - return true; - - if (ix > 30 && ix < (30+28) && iy > 4 && iy < (4+50) ) - { - ANDGate ag = new ANDGate(x+30,y+4,item.room); - level.items.addElement(ag); - item.PicksUp(ag); - return false; - } - - if (ix > 64 && ix < (64+28) && iy > 4 && iy < (4+50) ) - { - ORGate og = new ORGate(x+64,y+4,item.room); - level.items.addElement(og); - item.PicksUp(og); - return false; - } - - if (ix > 98 && ix < (98+28) && iy > 4 && iy < (4+50) ) - { - XORGate xg = new XORGate(x+98,y+4,item.room); - level.items.addElement(xg); - item.PicksUp(xg); - return false; - } - - if (ix > 132 && ix < (132+28) && iy > 4 && iy < (4+50) ) - { - NOTGate ng = new NOTGate(x+132,y+4,item.room); - level.items.addElement(ng); - ng.ports[1].value=true; - item.PicksUp(ng); - return false; - } - - if (ix > 30 && ix < (30+48) && iy > 58 && iy < (58+32) ) - { - FlipFlop ff = new FlipFlop(x+30,y+58,item.room); - level.items.addElement(ff); - ff.ports[3].value=true; - item.PicksUp(ff); - return false; - } - - if (ix > 74 && ix < (74+22) && iy > 58 && iy < (58+32) ) - { - Node n1 = new Node(x+74,y+58,item.room, Node.TYPE_STRAIGHT); - level.items.addElement(n1); - item.PicksUp(n1); - return false; - } - - if (ix > 98 && ix < (98+28) && iy > 58 && iy < (58+32) ) - { - Node n2 = new Node(x+98,y+58,item.room, Node.TYPE_RIGHT); - level.items.addElement(n2); - item.PicksUp(n2); - return false; - } - - if (ix > 128 && ix < (128+28) && iy > 58 && iy < (58+32) ) - { - Node n3 = new Node(x+128,y+58,item.room, Node.TYPE_THREE); - level.items.addElement(n3); - item.PicksUp(n3); - return false; - } - } - else - return true; - return false; - } + + FlipFlop ff = new FlipFlop(0, 0, null); + ff.Function(); + ff.Decorate(); + g2.drawImage(ff.icons[0].getImage(), 30, 58, level); + + Node n1 = new Node(0, 0, null, Node.TYPE_STRAIGHT); + n1.Function(); + n1.Decorate(); + g2.drawImage(n1.icons[0].getImage(), 74, 58, level); + + Node n2 = new Node(0, 0, null, Node.TYPE_RIGHT); + n2.Function(); + n2.Decorate(); + g2.drawImage(n2.icons[0].getImage(), 98, 58, level); + + Node n3 = new Node(0, 0, null, Node.TYPE_THREE); + n3.Function(); + n3.Decorate(); + g2.drawImage(n3.icons[0].getImage(), 128, 58, level); + + if (open) { + currentIcon = icons[1].getImage(); + } + else { + currentIcon = icons[0].getImage(); + } + } + + public void Toggle() { + if (open) { + // Close ToolBox + width = 26; + height = 22; + open = false; + currentIcon = icons[0].getImage(); + y += 72; + if (y > 320) { + y = 320; + } + } + else { + // Open ToolBox + width = 166; + height = 94; + open = true; + currentIcon = icons[1].getImage(); + y -= 72; + if (y < 32) { + y = 32; + } + if (x > 338) { + x = 338; + } + } + } + + public boolean CanBePickedUp(Item item) { + if (item != level.gameCursor) { + return false; + } + if (open) { + int ix = item.x - x + item.width / 2; + int iy = item.y - y + item.height / 2; + if (ix < 26 && iy > 72) { + return true; + } + + if (ix > 30 && ix < (30 + 28) && iy > 4 && iy < (4 + 50)) { + ANDGate ag = new ANDGate(x + 30, y + 4, item.room); + level.items.addElement(ag); + item.PicksUp(ag); + return false; + } + + if (ix > 64 && ix < (64 + 28) && iy > 4 && iy < (4 + 50)) { + ORGate og = new ORGate(x + 64, y + 4, item.room); + level.items.addElement(og); + item.PicksUp(og); + return false; + } + + if (ix > 98 && ix < (98 + 28) && iy > 4 && iy < (4 + 50)) { + XORGate xg = new XORGate(x + 98, y + 4, item.room); + level.items.addElement(xg); + item.PicksUp(xg); + return false; + } + + if (ix > 132 && ix < (132 + 28) && iy > 4 && iy < (4 + 50)) { + NOTGate ng = new NOTGate(x + 132, y + 4, item.room); + level.items.addElement(ng); + ng.ports[1].value = true; + item.PicksUp(ng); + return false; + } + + if (ix > 30 && ix < (30 + 48) && iy > 58 && iy < (58 + 32)) { + FlipFlop ff = new FlipFlop(x + 30, y + 58, item.room); + level.items.addElement(ff); + ff.ports[3].value = true; + item.PicksUp(ff); + return false; + } + + if (ix > 74 && ix < (74 + 22) && iy > 58 && iy < (58 + 32)) { + Node n1 = new Node(x + 74, y + 58, item.room, Node.TYPE_STRAIGHT); + level.items.addElement(n1); + item.PicksUp(n1); + return false; + } + + if (ix > 98 && ix < (98 + 28) && iy > 58 && iy < (58 + 32)) { + Node n2 = new Node(x + 98, y + 58, item.room, Node.TYPE_RIGHT); + level.items.addElement(n2); + item.PicksUp(n2); + return false; + } + + if (ix > 128 && ix < (128 + 28) && iy > 58 && iy < (58 + 32)) { + Node n3 = new Node(x + 128, y + 58, item.room, Node.TYPE_THREE); + level.items.addElement(n3); + item.PicksUp(n3); + return false; + } + } + else { + return true; + } + return false; + } } diff --git a/src/com/droidquest/items/Train.java b/src/com/droidquest/items/Train.java index f072c9d..a8c9d35 100644 --- a/src/com/droidquest/items/Train.java +++ b/src/com/droidquest/items/Train.java @@ -1,103 +1,94 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.event.KeyEvent; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.materials.Material; -public class Train extends Item -{ -public Train() - { - x=0; y=0; room =null; - width=56; height=32; - GenerateIcons(); - } +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.image.BufferedImage; -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.white); - g.fillRect(0,2,40,20); - g.fillRect(4,0,32,2); - g.fillRect(40,4,4,16); - g.fillRect(44,6,4,12); - g.fillRect(48,8,4,8); - g.fillRect(52,10,4,4); - g.fillRect(0,26,16,4); - g.fillRect(4,24,8,8); - g.fillRect(24,26,16,4); - g.fillRect(28,24,8,8); - g.setColor(Color.black); - g.fillRect(8,4,12,8); - g.fillRect(4,14,36,2); - g.fillRect(16,18,16,2); - g.fillRect(28,4,4,8); - g.fillRect(32,6,4,6); - g.fillRect(36,8,4,4); - currentIcon = icons[0].getImage(); - } +public class Train extends Item { + public Train() { + x = 0; + y = 0; + room = null; + width = 56; + height = 32; + GenerateIcons(); + } -public boolean CanBePickedUp(Item item) - { - if (item == level.player) - { - PicksUp(level.player); - level.player = this; - Material mat = (Material) level.materials.elementAt(8); - mat.passable=true; - } - return false; - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.white); + g.fillRect(0, 2, 40, 20); + g.fillRect(4, 0, 32, 2); + g.fillRect(40, 4, 4, 16); + g.fillRect(44, 6, 4, 12); + g.fillRect(48, 8, 4, 8); + g.fillRect(52, 10, 4, 4); + g.fillRect(0, 26, 16, 4); + g.fillRect(4, 24, 8, 8); + g.fillRect(24, 26, 16, 4); + g.fillRect(28, 24, 8, 8); + g.setColor(Color.black); + g.fillRect(8, 4, 12, 8); + g.fillRect(4, 14, 36, 2); + g.fillRect(16, 18, 16, 2); + g.fillRect(28, 4, 4, 8); + g.fillRect(32, 6, 4, 6); + g.fillRect(36, 8, 4, 4); + currentIcon = icons[0].getImage(); + } -public boolean KeyUp(KeyEvent e) - { - if (e.getKeyCode() == e.VK_SPACE) - { - if (level.rooms.indexOf(room)==14) - { - room.SetMaterial(8,0,0); - room.SetMaterial(9,0,0); - room.SetMaterial(10,0,0); - room.SetMaterial(11,0,0); - room.SetMaterial(18,8,0); - room.SetMaterial(18,9,0); - } - level.player=carrying; - Drops(); - room=null; - Material mat = (Material) level.materials.elementAt(8); - mat.passable=false; - } - return false; - } + public boolean CanBePickedUp(Item item) { + if (item == level.player) { + PicksUp(level.player); + level.player = this; + Material mat = level.materials.elementAt(8); + mat.passable = true; + } + return false; + } -public void Animate() - { - if (room != null) - if (carrying != null) - MoveRight(8); - } + public boolean KeyUp(KeyEvent e) { + if (e.getKeyCode() == e.VK_SPACE) { + if (level.rooms.indexOf(room) == 14) { + room.SetMaterial(8, 0, 0); + room.SetMaterial(9, 0, 0); + room.SetMaterial(10, 0, 0); + room.SetMaterial(11, 0, 0); + room.SetMaterial(18, 8, 0); + room.SetMaterial(18, 9, 0); + } + level.player = carrying; + Drops(); + room = null; + Material mat = level.materials.elementAt(8); + mat.passable = false; + } + return false; + } + + public void Animate() { + if (room != null) { + if (carrying != null) { + MoveRight(8); + } + } + } } diff --git a/src/com/droidquest/items/TrashCollector.java b/src/com/droidquest/items/TrashCollector.java index 6fae7d8..8e175f6 100644 --- a/src/com/droidquest/items/TrashCollector.java +++ b/src/com/droidquest/items/TrashCollector.java @@ -4,11 +4,10 @@ import javax.swing.ImageIcon; import com.droidquest.Room; -public class TrashCollector extends Item -{ -int animationState=0; -int behavior=0; -// 0 = Patrol Left to Room 31 +public class TrashCollector extends Item { + private int animationState = 0; + private int behavior = 0; + // 0 = Patrol Left to Room 31 // 1 = Patrol Up to Room 5 // 2 = Patrol Right to Room 11 // 3 = Patrol Down to Room 17 @@ -16,377 +15,374 @@ int behavior=0; // 5 = Go up to Room 58 // 6 = Go down to Room 19 // 7 = Prowl (approach until get item) -int previousBehavior; -int gotoX; -int gotoY; -Room gotoRoom; -Item target=null; + private int previousBehavior; + private int gotoX; + private int gotoY; + private Room gotoRoom; + private Item target = null; -public TrashCollector(int X, int Y, Room r) - { - x=X; y=Y; - room = r; - width=28; height=32; - grabbable = false; - GenerateIcons(); - } + public TrashCollector(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 32; + grabbable = false; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[2]; - icons[0] = new ImageIcon("images/trashcollector0.gif"); - icons[1] = new ImageIcon("images/trashcollector1.gif"); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[2]; + icons[0] = new ImageIcon("images/trashcollector0.gif"); + icons[1] = new ImageIcon("images/trashcollector1.gif"); + currentIcon = icons[0].getImage(); + } -public void Animate() - { - animationState = 1-animationState; - currentIcon = icons[animationState].getImage(); - - if (gotoRoom==null) // Sets destination room - { - gotoX=266; gotoY=176; - switch(behavior) - { - case 0: - gotoRoom = (Room) level.rooms.elementAt(31); - break; - case 1: - gotoRoom = (Room) level.rooms.elementAt(5); - break; - case 2: - gotoRoom = (Room) level.rooms.elementAt(11); - break; - case 3: - gotoRoom = (Room) level.rooms.elementAt(17); - break; - case 4: - gotoRoom = (Room) level.rooms.elementAt(19); - break; - case 5: - gotoRoom = (Room) level.rooms.elementAt(58); - break; - case 6: - gotoRoom = (Room) level.rooms.elementAt(19); - break; - } - } - - if (behavior<5) // Check for items in hallway - { - for (int a=0; a 4) diff=4; - MoveDown(diff*dir); - } - } - else - { - if (x==gotoX && y==gotoY) - { - gotoRoom=null; - behavior=1; - } - if (x != gotoX) - { - int diff = Math.abs(gotoX - x); - int dir = diff / (gotoX - x); - if (diff > 4) diff = 4; - MoveRight(diff * dir); - } - if (y != gotoY) - { - int diff = Math.abs(gotoY - y); - int dir = diff / (gotoY - y); - if (diff > 4) diff = 4; - MoveDown(diff * dir); - } - } - break; - case 1: // Move Up to Room 5 - if (room != gotoRoom) - { - MoveUp(4); - if (x!=266) - { - int diff = Math.abs(266-y); - int dir = diff / (266-y); - if (diff > 4) diff=4; - MoveRight(diff*dir); - } - } - else - { - if (x==gotoX && y==gotoY) - { - gotoRoom=null; - behavior=2; - } - if (x != gotoX) - { - int diff = Math.abs(gotoX - x); - int dir = diff / (gotoX - x); - if (diff > 4) diff = 4; - MoveRight(diff * dir); - } - if (y != gotoY) - { - int diff = Math.abs(gotoY - y); - int dir = diff / (gotoY - y); - if (diff > 4) diff = 4; - MoveDown(diff * dir); - } - } - break; - case 2: // Move Right to Room 11 - if (room != gotoRoom) - { - MoveRight(4); - if (y!=176) - { - int diff = Math.abs(176-y); - int dir = diff / (176-y); - if (diff > 4) diff=4; - MoveDown(diff*dir); - } - } - else - { - if (x==gotoX && y==gotoY) - { - gotoRoom = null; - behavior=3; - } - if (x != gotoX) - { - int diff = Math.abs(gotoX - x); - int dir = diff / (gotoX - x); - if (diff > 4) diff = 4; - MoveRight(diff * dir); - } - if (y != gotoY) - { - int diff = Math.abs(gotoY - y); - int dir = diff / (gotoY - y); - if (diff > 4) diff = 4; - MoveDown(diff * dir); - } - } - break; - case 3: // Move Down to Room 17 - if (room != gotoRoom) - { - MoveDown(4); - if (x!=266) - { - int diff = Math.abs(266-y); - int dir = diff / (266-y); - if (diff > 4) diff=4; - MoveRight(diff*dir); - } - } - else - { - if (x==gotoX && y==gotoY) - { - gotoRoom = null; - behavior=4; - } - if (x != gotoX) - { - int diff = Math.abs(gotoX - x); - int dir = diff / (gotoX - x); - if (diff > 4) diff = 4; - MoveRight(diff * dir); - } - if (y != gotoY) - { - int diff = Math.abs(gotoY - y); - int dir = diff / (gotoY - y); - if (diff > 4) diff = 4; - MoveDown(diff * dir); - } - } - break; - case 4: // Move Left to Room 19 - if (room != gotoRoom) - { - MoveLeft(4); - if (y!=176) - { - int diff = Math.abs(176-y); - int dir = diff / (176-y); - if (diff > 4) diff=4; - MoveDown(diff*dir); - } - } - else - { - if (x==gotoX && y==gotoY) - { - int holdings=0; - Room purge = (Room) level.rooms.elementAt(60); - for (int a=0; a 4) diff = 4; - MoveRight(diff * dir); - } - if (y != gotoY) - { - int diff = Math.abs(gotoY - y); - int dir = diff / (gotoY - y); - if (diff > 4) diff = 4; - MoveDown(diff * dir); - } - } - break; - case 5: // Move Up to Room 58 - if (room != gotoRoom) - { - MoveUp(4); - if (x!=266) - { - int diff = Math.abs(266-y); - int dir = diff / (266-y); - if (diff > 4) diff=4; - MoveRight(diff*dir); - } - } - else - { - if (x==gotoX && y==gotoY) - { - Room purge = (Room) level.rooms.elementAt(60); - for (int a=0; a 4) diff = 4; - MoveRight(diff * dir); - } - if (y != gotoY) - { - int diff = Math.abs(gotoY - y); - int dir = diff / (gotoY - y); - if (diff > 4) diff = 4; - MoveDown(diff * dir); - } - } - break; - case 6: // Move Down to Room 19 - if (room != gotoRoom) - { - MoveDown(4); - if (x!=266) - { - int diff = Math.abs(266-y); - int dir = diff / (266-y); - if (diff > 4) diff=4; - MoveRight(diff*dir); - } - } - else - { - if (x==gotoX && y==gotoY) - { - gotoRoom = null; - behavior=0; - } - if (x != gotoX) - { - int diff = Math.abs(gotoX - x); - int dir = diff / (gotoX - x); - if (diff > 4) diff = 4; - MoveRight(diff * dir); - } - if (y != gotoY) - { - int diff = Math.abs(gotoY - y); - int dir = diff / (gotoY - y); - if (diff > 4) diff = 4; - MoveDown(diff * dir); - } - } - break; - case 7: // Approach item - if (target.room == room && target.carriedBy == null) - { - if (Overlaps(target)) - { - target.room = (Room) level.rooms.elementAt(60); - behavior = previousBehavior; - } - else - { - if (x != target.x) - { - int diff = Math.abs(target.x - x); - int dir = diff / (target.x - x); - if (diff > 8) diff = 8; - MoveRight(diff * dir); - } - if (y != target.y) - { - int diff = Math.abs(target.y - y); - int dir = diff / (target.y - y); - if (diff > 8) diff = 8; - MoveDown(diff * dir); - } - } - } - else - { - behavior = previousBehavior; - } - break; - } - } + public void Animate() { + animationState = 1 - animationState; + currentIcon = icons[animationState].getImage(); + + if (gotoRoom == null) // Sets destination room + { + gotoX = 266; + gotoY = 176; + switch (behavior) { + case 0: + gotoRoom = level.rooms.elementAt(31); + break; + case 1: + gotoRoom = level.rooms.elementAt(5); + break; + case 2: + gotoRoom = level.rooms.elementAt(11); + break; + case 3: + gotoRoom = level.rooms.elementAt(17); + break; + case 4: + gotoRoom = level.rooms.elementAt(19); + break; + case 5: + gotoRoom = level.rooms.elementAt(58); + break; + case 6: + gotoRoom = level.rooms.elementAt(19); + break; + } + } + + if (behavior < 5) // Check for items in hallway + { + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item != this && item != level.player) { + if (item.room == room && item.carriedBy == null) { + previousBehavior = behavior; + behavior = 7; + target = item; + a = level.items.size(); + } + } + } + } + + switch (behavior) { + case 0: // Move Left to Room 31 + if (room != gotoRoom) { + MoveLeft(4); + if (y != 176) { + int diff = Math.abs(176 - y); + int dir = diff / (176 - y); + if (diff > 4) { + diff = 4; + } + MoveDown(diff * dir); + } + } + else { + if (x == gotoX && y == gotoY) { + gotoRoom = null; + behavior = 1; + } + if (x != gotoX) { + int diff = Math.abs(gotoX - x); + int dir = diff / (gotoX - x); + if (diff > 4) { + diff = 4; + } + MoveRight(diff * dir); + } + if (y != gotoY) { + int diff = Math.abs(gotoY - y); + int dir = diff / (gotoY - y); + if (diff > 4) { + diff = 4; + } + MoveDown(diff * dir); + } + } + break; + case 1: // Move Up to Room 5 + if (room != gotoRoom) { + MoveUp(4); + if (x != 266) { + int diff = Math.abs(266 - y); + int dir = diff / (266 - y); + if (diff > 4) { + diff = 4; + } + MoveRight(diff * dir); + } + } + else { + if (x == gotoX && y == gotoY) { + gotoRoom = null; + behavior = 2; + } + if (x != gotoX) { + int diff = Math.abs(gotoX - x); + int dir = diff / (gotoX - x); + if (diff > 4) { + diff = 4; + } + MoveRight(diff * dir); + } + if (y != gotoY) { + int diff = Math.abs(gotoY - y); + int dir = diff / (gotoY - y); + if (diff > 4) { + diff = 4; + } + MoveDown(diff * dir); + } + } + break; + case 2: // Move Right to Room 11 + if (room != gotoRoom) { + MoveRight(4); + if (y != 176) { + int diff = Math.abs(176 - y); + int dir = diff / (176 - y); + if (diff > 4) { + diff = 4; + } + MoveDown(diff * dir); + } + } + else { + if (x == gotoX && y == gotoY) { + gotoRoom = null; + behavior = 3; + } + if (x != gotoX) { + int diff = Math.abs(gotoX - x); + int dir = diff / (gotoX - x); + if (diff > 4) { + diff = 4; + } + MoveRight(diff * dir); + } + if (y != gotoY) { + int diff = Math.abs(gotoY - y); + int dir = diff / (gotoY - y); + if (diff > 4) { + diff = 4; + } + MoveDown(diff * dir); + } + } + break; + case 3: // Move Down to Room 17 + if (room != gotoRoom) { + MoveDown(4); + if (x != 266) { + int diff = Math.abs(266 - y); + int dir = diff / (266 - y); + if (diff > 4) { + diff = 4; + } + MoveRight(diff * dir); + } + } + else { + if (x == gotoX && y == gotoY) { + gotoRoom = null; + behavior = 4; + } + if (x != gotoX) { + int diff = Math.abs(gotoX - x); + int dir = diff / (gotoX - x); + if (diff > 4) { + diff = 4; + } + MoveRight(diff * dir); + } + if (y != gotoY) { + int diff = Math.abs(gotoY - y); + int dir = diff / (gotoY - y); + if (diff > 4) { + diff = 4; + } + MoveDown(diff * dir); + } + } + break; + case 4: // Move Left to Room 19 + if (room != gotoRoom) { + MoveLeft(4); + if (y != 176) { + int diff = Math.abs(176 - y); + int dir = diff / (176 - y); + if (diff > 4) { + diff = 4; + } + MoveDown(diff * dir); + } + } + else { + if (x == gotoX && y == gotoY) { + int holdings = 0; + Room purge = level.rooms.elementAt(60); + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item.room == purge) { + holdings++; + } + } + if (holdings == 0) { + behavior = 0; + } + else { + behavior = 5; + } + gotoRoom = null; + } + if (x != gotoX) { + int diff = Math.abs(gotoX - x); + int dir = diff / (gotoX - x); + if (diff > 4) { + diff = 4; + } + MoveRight(diff * dir); + } + if (y != gotoY) { + int diff = Math.abs(gotoY - y); + int dir = diff / (gotoY - y); + if (diff > 4) { + diff = 4; + } + MoveDown(diff * dir); + } + } + break; + case 5: // Move Up to Room 58 + if (room != gotoRoom) { + MoveUp(4); + if (x != 266) { + int diff = Math.abs(266 - y); + int dir = diff / (266 - y); + if (diff > 4) { + diff = 4; + } + MoveRight(diff * dir); + } + } + else { + if (x == gotoX && y == gotoY) { + Room purge = level.rooms.elementAt(60); + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item.room == purge) { + item.room = room; + } + } + gotoRoom = null; + behavior = 6; + } + if (x != gotoX) { + int diff = Math.abs(gotoX - x); + int dir = diff / (gotoX - x); + if (diff > 4) { + diff = 4; + } + MoveRight(diff * dir); + } + if (y != gotoY) { + int diff = Math.abs(gotoY - y); + int dir = diff / (gotoY - y); + if (diff > 4) { + diff = 4; + } + MoveDown(diff * dir); + } + } + break; + case 6: // Move Down to Room 19 + if (room != gotoRoom) { + MoveDown(4); + if (x != 266) { + int diff = Math.abs(266 - y); + int dir = diff / (266 - y); + if (diff > 4) { + diff = 4; + } + MoveRight(diff * dir); + } + } + else { + if (x == gotoX && y == gotoY) { + gotoRoom = null; + behavior = 0; + } + if (x != gotoX) { + int diff = Math.abs(gotoX - x); + int dir = diff / (gotoX - x); + if (diff > 4) { + diff = 4; + } + MoveRight(diff * dir); + } + if (y != gotoY) { + int diff = Math.abs(gotoY - y); + int dir = diff / (gotoY - y); + if (diff > 4) { + diff = 4; + } + MoveDown(diff * dir); + } + } + break; + case 7: // Approach item + if (target.room == room && target.carriedBy == null) { + if (Overlaps(target)) { + target.room = level.rooms.elementAt(60); + behavior = previousBehavior; + } + else { + if (x != target.x) { + int diff = Math.abs(target.x - x); + int dir = diff / (target.x - x); + if (diff > 8) { + diff = 8; + } + MoveRight(diff * dir); + } + if (y != target.y) { + int diff = Math.abs(target.y - y); + int dir = diff / (target.y - y); + if (diff > 8) { + diff = 8; + } + MoveDown(diff * dir); + } + } + } + else { + behavior = previousBehavior; + } + break; + } + } } diff --git a/src/com/droidquest/items/Triangle.java b/src/com/droidquest/items/Triangle.java index 5cd62f6..a25d224 100644 --- a/src/com/droidquest/items/Triangle.java +++ b/src/com/droidquest/items/Triangle.java @@ -9,43 +9,41 @@ import javax.swing.ImageIcon; import com.droidquest.Room; -public class Triangle extends Item -{ -Color color; +public class Triangle extends Item { + private Color color; -public Triangle(int X, int Y, Room r, Color c) - { - x=X; y=Y; room=r; - width=28; height=28; - color = c; - editable=true; - GenerateIcons(); - } + public Triangle(int X, int Y, Room r, Color c) { + x = X; + y = Y; + room = r; + width = 28; + height = 28; + color = c; + editable = true; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(color); - int[] xp = {27, 0,27}; - int[] yp = { 0,14,27}; - g.fillPolygon(xp,yp,3); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(color); + int[] xp = {27, 0, 27}; + int[] yp = {0, 14, 27}; + g.fillPolygon(xp, yp, 3); + currentIcon = icons[0].getImage(); + } } diff --git a/src/com/droidquest/items/Turbine.java b/src/com/droidquest/items/Turbine.java index 2c273fd..1310fa5 100644 --- a/src/com/droidquest/items/Turbine.java +++ b/src/com/droidquest/items/Turbine.java @@ -10,112 +10,111 @@ import javax.swing.ImageIcon; import com.droidquest.Room; import com.droidquest.decorations.Spark; -public class Turbine extends Item -{ - // Turbines are wind-powered locks. They watch the level.sparks vector - // for sparks that intersect them. When Sparks intersect the turbines - // they animate and change materials in the cells array. When the sparks - // stop, the animaiton stops and the cells are slowly replaced. The - // direction of the Sparks don't matter in this case. - // - // The cells array is a straght array with each cell defined with 4 numbers; - // X,Y, Open Material, Closed Material. - // +public class Turbine extends Item { + // Turbines are wind-powered locks. They watch the level.sparks vector + // for sparks that intersect them. When Sparks intersect the turbines + // they animate and change materials in the cells array. When the sparks + // stop, the animation stops and the cells are slowly replaced. The + // direction of the Sparks don't matter in this case. + // + // The cells array is a straight array with each cell defined with 4 numbers; + // X,Y, Open Material, Closed Material. + // - int[] cells; - int animationState; - int cellCounter=0; + private int[] cells; + private int animationState; + private int cellCounter = 0; - public Turbine(int X, int Y, Room r, int[] c) - { - x=X; y=Y; room=r; - cells = c; - width=28; height=64; - grabbable = false; - GenerateIcons(); - } + public Turbine(int X, int Y, Room r, int[] c) { + x = X; + y = Y; + room = r; + cells = c; + width = 28; + height = 64; + grabbable = false; + GenerateIcons(); + } - public void GenerateIcons() - { - icons = new ImageIcon[4]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[2]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[3]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - for (int a=0; a<4; a++) - { - try - { - g = icons[a].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.yellow); - g.fillRect(0,28,28,8); - switch(a) - { - case 0: - g.fillOval(4,4,20,24); - g.fillOval(4,36,20,24); - break; - case 1: - g.fillOval(4,12,20,16); - g.fillOval(4,36,20,16); - break; - case 2: - g.fillOval(4,20,20,8); - g.fillOval(4,36,20,8); - break; - case 3: - g.fillOval(4,12,20,16); - g.fillOval(4,36,20,16); - break; - } - } - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[4]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[2] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[3] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + for (int a = 0; a < 4; a++) { + try { + g = icons[a].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.yellow); + g.fillRect(0, 28, 28, 8); + switch (a) { + case 0: + g.fillOval(4, 4, 20, 24); + g.fillOval(4, 36, 20, 24); + break; + case 1: + g.fillOval(4, 12, 20, 16); + g.fillOval(4, 36, 20, 16); + break; + case 2: + g.fillOval(4, 20, 20, 8); + g.fillOval(4, 36, 20, 8); + break; + case 3: + g.fillOval(4, 12, 20, 16); + g.fillOval(4, 36, 20, 16); + break; + } + } + currentIcon = icons[0].getImage(); + } - public void Animate() - { - boolean flag = false; - for(int a=0; a= y && spark.y <= y+height) - if (spark.x >= x && spark.x <= x+width) - flag= true; - } - if (flag) - { - animationState = (animationState+1)%4; - currentIcon = icons[animationState].getImage(); - if (cellCounter < cells.length*2) - cellCounter++; - int cell = cellCounter / 8; - if (cell < cells.length/4) - room.SetMaterial(cells[4 * cell], - cells[4 * cell + 1], - cells[4 * cell + 2]); - } - else - { - if (cellCounter>0) - cellCounter--; - int cell = cellCounter / 8; - if (cell < cells.length/4) - room.SetMaterial(cells[4 * cell], - cells[4 * cell + 1], - cells[4 * cell + 3]); - } - } + public void Animate() { + boolean flag = false; + for (int a = 0; a < level.sparks.size(); a++) { + Spark spark = (Spark) level.sparks.elementAt(a); + if (spark.room == room) { + if (spark.y >= y && spark.y <= y + height) { + if (spark.x >= x && spark.x <= x + width) { + flag = true; + } + } + } + } + if (flag) { + animationState = (animationState + 1) % 4; + currentIcon = icons[animationState].getImage(); + if (cellCounter < cells.length * 2) { + cellCounter++; + } + int cell = cellCounter / 8; + if (cell < cells.length / 4) { + room.SetMaterial(cells[4 * cell], + cells[4 * cell + 1], + cells[4 * cell + 2]); + } + } + else { + if (cellCounter > 0) { + cellCounter--; + } + int cell = cellCounter / 8; + if (cell < cells.length / 4) { + room.SetMaterial(cells[4 * cell], + cells[4 * cell + 1], + cells[4 * cell + 3]); + } + } + } - } \ No newline at end of file +} \ No newline at end of file diff --git a/src/com/droidquest/items/UnBurner.java b/src/com/droidquest/items/UnBurner.java index b9a0f41..4f1c0d9 100644 --- a/src/com/droidquest/items/UnBurner.java +++ b/src/com/droidquest/items/UnBurner.java @@ -1,123 +1,119 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.devices.PrototypeChip; import com.droidquest.devices.SmallChip; import com.droidquest.levels.Level; -public class UnBurner extends Item -{ -int burning; -int animation; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; -public UnBurner(int X, int Y, Room r) - { - x=X; y=Y; room=r; - width=28; height=30; - GenerateIcons(); - } +public class UnBurner extends Item { + private int burning; + private int animation; -public void GenerateIcons() - { - icons = new ImageIcon[2]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - Graphics2D g2; - Color transparent = new Color(0,0,0,0); - - // 0 = Off - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g.setColor(Color.white); - g.fillRect(0,0,28,30); - g.setColor(Color.black); - g.fillRect(8,8,12,14); - g.fillRect(4,10,20,10); - g.setColor(Color.white); - g.fillRect(12,10,4,10); - g.fillRect(8,12,12,6); + public UnBurner(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 30; + GenerateIcons(); + } - // 1 = On - try - { - g = icons[1].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g.setColor(new Color(255,128,0)); - g.fillRect(0,0,28,30); - g.setColor(Color.black); - g.fillRect(8,8,12,14); - g.fillRect(4,10,20,10); - g.setColor(new Color(255,128,0)); - g.fillRect(12,10,4,10); - g.fillRect(8,12,12,6); + public void GenerateIcons() { + icons = new ImageIcon[2]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; - currentIcon = icons[0].getImage(); - - } -public boolean CanBePickedUp(Item i) - { - // Find the SmallChip and Erase it - Item sc=null; - for (int a=0; a0) - { - animation = 1- animation; - currentIcon = icons[animation].getImage(); - burning--; - } - else - currentIcon = icons[0].getImage(); - } + // 1 = On + try { + g = icons[1].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g.setColor(new Color(255, 128, 0)); + g.fillRect(0, 0, 28, 30); + g.setColor(Color.black); + g.fillRect(8, 8, 12, 14); + g.fillRect(4, 10, 20, 10); + g.setColor(new Color(255, 128, 0)); + g.fillRect(12, 10, 4, 10); + g.fillRect(8, 12, 12, 6); + + currentIcon = icons[0].getImage(); + + } + + public boolean CanBePickedUp(Item i) { + // Find the SmallChip and Erase it + Item sc = null; + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item.getClass().toString().endsWith("SmallChip")) { + if (((SmallChip) item).inBurner) { + sc = item; + } + } + } + if (sc == null) { + return false; + } + + // Find the PrototypeChip + Item pc = null; + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item.getClass().toString().endsWith("PrototypeChip")) { + if (((PrototypeChip) item).inBurner) { + pc = item; + } + } + } + if (pc == null) { + return false; + } + + // Start the ChipDecompiler thread + ChipDecompiler cd = new ChipDecompiler((PrototypeChip) pc, (SmallChip) sc); + + level.PlaySound(room, Level.BURNSOUND); + burning = 10; + + return false; + } + + public void Animate() { + if (burning > 0) { + animation = 1 - animation; + currentIcon = icons[animation].getImage(); + burning--; + } + else { + currentIcon = icons[0].getImage(); + } + } } diff --git a/src/com/droidquest/items/VendingHandle.java b/src/com/droidquest/items/VendingHandle.java index 8b6da01..edc1c13 100644 --- a/src/com/droidquest/items/VendingHandle.java +++ b/src/com/droidquest/items/VendingHandle.java @@ -10,182 +10,179 @@ import javax.swing.ImageIcon; import com.droidquest.Room; -public class VendingHandle extends Item -{ - // Handle used to pull sliding wall on Vending Machine +public class VendingHandle extends Item { + // Handle used to pull sliding wall on Vending Machine - int startX; - int startY; - boolean paid = false; + private int startX; + private int startY; + boolean paid = false; - public VendingHandle(int X, int Y, Room r) - { - x=X; y=Y; room=r; - startX = X; - startY = Y; - width=28; height=12; - GenerateIcons(); - } + public VendingHandle(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + startX = X; + startY = Y; + width = 28; + height = 12; + GenerateIcons(); + } - public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.white); - g.fillRect(0,4,16,4); - g.fillRect(16,2,12,8); - g.fillRect(20,0,4,12); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.white); + g.fillRect(0, 4, 16, 4); + g.fillRect(16, 2, 12, 8); + g.fillRect(20, 0, 4, 12); + currentIcon = icons[0].getImage(); + } - public boolean CanBePickedUp(Item item) - { - if (item == level.player) return false; - return true; - } + public boolean CanBePickedUp(Item item) { + return item != level.player; + } - public void IsDropped() - { - x = startX; - y = startY; - room.SetMaterial(1,4,14); - room.SetMaterial(2,4,14); - room.SetMaterial(3,4,14); - room.SetMaterial(4,4,14); - room.SetMaterial(5,4,14); - room.SetMaterial(6,4,14); - room.SetMaterial(7,4,14); - room.SetMaterial(8,4,14); - room.SetMaterial(9,4,14); - room.SetMaterial(10,4,7); - room.SetMaterial(11,4,0); - room.SetMaterial(12,4,0); - room.SetMaterial(13,4,0); - room.SetMaterial(14,4,0); - paid = false; - } + public void IsDropped() { + x = startX; + y = startY; + room.SetMaterial(1, 4, 14); + room.SetMaterial(2, 4, 14); + room.SetMaterial(3, 4, 14); + room.SetMaterial(4, 4, 14); + room.SetMaterial(5, 4, 14); + room.SetMaterial(6, 4, 14); + room.SetMaterial(7, 4, 14); + room.SetMaterial(8, 4, 14); + room.SetMaterial(9, 4, 14); + room.SetMaterial(10, 4, 7); + room.SetMaterial(11, 4, 0); + room.SetMaterial(12, 4, 0); + room.SetMaterial(13, 4, 0); + room.SetMaterial(14, 4, 0); + paid = false; + } - public void Animate() - { - if (carriedBy != null) - { - int maxPull; - if (paid) - maxPull = 4*28; - else - maxPull = 0; - Dimension d = GetXY(); - int tempX = d.width; - int tempY = d.height; - if (tempY != startY) - carriedBy.MoveDown(startY-tempY); - if (tempX < startX) - carriedBy.MoveRight(startX-tempX); - if (tempX > (startX + maxPull)) - carriedBy.MoveLeft(tempX - (startX+maxPull)); - - d = GetXY(); - tempX = d.width; - int blocks = (tempX-startX)/28; - switch (blocks) - { - case 0: - room.SetMaterial(1,4,14); - room.SetMaterial(2,4,14); - room.SetMaterial(3,4,14); - room.SetMaterial(4,4,14); - room.SetMaterial(5,4,14); - room.SetMaterial(6,4,14); - room.SetMaterial(7,4,14); - room.SetMaterial(8,4,14); - room.SetMaterial(9,4,14); - room.SetMaterial(10,4,7); - room.SetMaterial(11,4,0); - room.SetMaterial(12,4,0); - room.SetMaterial(13,4,0); - room.SetMaterial(14,4,0); - break; - case 1: - room.SetMaterial(1,4,0); - room.SetMaterial(2,4,14); - room.SetMaterial(3,4,14); - room.SetMaterial(4,4,14); - room.SetMaterial(5,4,14); - room.SetMaterial(6,4,14); - room.SetMaterial(7,4,14); - room.SetMaterial(8,4,14); - room.SetMaterial(9,4,14); - room.SetMaterial(10,4,14); - room.SetMaterial(11,4,7); - room.SetMaterial(12,4,0); - room.SetMaterial(13,4,0); - room.SetMaterial(14,4,0); - break; - case 2: - room.SetMaterial(1,4,0); - room.SetMaterial(2,4,0); - room.SetMaterial(3,4,14); - room.SetMaterial(4,4,14); - room.SetMaterial(5,4,14); - room.SetMaterial(6,4,14); - room.SetMaterial(7,4,14); - room.SetMaterial(8,4,14); - room.SetMaterial(9,4,14); - room.SetMaterial(10,4,14); - room.SetMaterial(11,4,14); - room.SetMaterial(12,4,7); - room.SetMaterial(13,4,0); - room.SetMaterial(14,4,0); - break; - case 3: - room.SetMaterial(1,4,0); - room.SetMaterial(2,4,0); - room.SetMaterial(3,4,0); - room.SetMaterial(4,4,14); - room.SetMaterial(5,4,14); - room.SetMaterial(6,4,14); - room.SetMaterial(7,4,14); - room.SetMaterial(8,4,14); - room.SetMaterial(9,4,14); - room.SetMaterial(10,4,14); - room.SetMaterial(11,4,14); - room.SetMaterial(12,4,14); - room.SetMaterial(13,4,7); - room.SetMaterial(14,4,0); - break; - case 4: - room.SetMaterial(1,4,0); - room.SetMaterial(2,4,0); - room.SetMaterial(3,4,0); - room.SetMaterial(4,4,0); - room.SetMaterial(5,4,14); - room.SetMaterial(6,4,14); - room.SetMaterial(7,4,14); - room.SetMaterial(8,4,14); - room.SetMaterial(9,4,14); - room.SetMaterial(10,4,14); - room.SetMaterial(11,4,14); - room.SetMaterial(12,4,14); - room.SetMaterial(13,4,14); - room.SetMaterial(14,4,7); - break; - } - - } - } + public void Animate() { + if (carriedBy != null) { + int maxPull; + if (paid) { + maxPull = 4 * 28; + } + else { + maxPull = 0; + } + Dimension d = GetXY(); + int tempX = d.width; + int tempY = d.height; + if (tempY != startY) { + carriedBy.MoveDown(startY - tempY); + } + if (tempX < startX) { + carriedBy.MoveRight(startX - tempX); + } + if (tempX > (startX + maxPull)) { + carriedBy.MoveLeft(tempX - (startX + maxPull)); + } - } + d = GetXY(); + tempX = d.width; + int blocks = (tempX - startX) / 28; + switch (blocks) { + case 0: + room.SetMaterial(1, 4, 14); + room.SetMaterial(2, 4, 14); + room.SetMaterial(3, 4, 14); + room.SetMaterial(4, 4, 14); + room.SetMaterial(5, 4, 14); + room.SetMaterial(6, 4, 14); + room.SetMaterial(7, 4, 14); + room.SetMaterial(8, 4, 14); + room.SetMaterial(9, 4, 14); + room.SetMaterial(10, 4, 7); + room.SetMaterial(11, 4, 0); + room.SetMaterial(12, 4, 0); + room.SetMaterial(13, 4, 0); + room.SetMaterial(14, 4, 0); + break; + case 1: + room.SetMaterial(1, 4, 0); + room.SetMaterial(2, 4, 14); + room.SetMaterial(3, 4, 14); + room.SetMaterial(4, 4, 14); + room.SetMaterial(5, 4, 14); + room.SetMaterial(6, 4, 14); + room.SetMaterial(7, 4, 14); + room.SetMaterial(8, 4, 14); + room.SetMaterial(9, 4, 14); + room.SetMaterial(10, 4, 14); + room.SetMaterial(11, 4, 7); + room.SetMaterial(12, 4, 0); + room.SetMaterial(13, 4, 0); + room.SetMaterial(14, 4, 0); + break; + case 2: + room.SetMaterial(1, 4, 0); + room.SetMaterial(2, 4, 0); + room.SetMaterial(3, 4, 14); + room.SetMaterial(4, 4, 14); + room.SetMaterial(5, 4, 14); + room.SetMaterial(6, 4, 14); + room.SetMaterial(7, 4, 14); + room.SetMaterial(8, 4, 14); + room.SetMaterial(9, 4, 14); + room.SetMaterial(10, 4, 14); + room.SetMaterial(11, 4, 14); + room.SetMaterial(12, 4, 7); + room.SetMaterial(13, 4, 0); + room.SetMaterial(14, 4, 0); + break; + case 3: + room.SetMaterial(1, 4, 0); + room.SetMaterial(2, 4, 0); + room.SetMaterial(3, 4, 0); + room.SetMaterial(4, 4, 14); + room.SetMaterial(5, 4, 14); + room.SetMaterial(6, 4, 14); + room.SetMaterial(7, 4, 14); + room.SetMaterial(8, 4, 14); + room.SetMaterial(9, 4, 14); + room.SetMaterial(10, 4, 14); + room.SetMaterial(11, 4, 14); + room.SetMaterial(12, 4, 14); + room.SetMaterial(13, 4, 7); + room.SetMaterial(14, 4, 0); + break; + case 4: + room.SetMaterial(1, 4, 0); + room.SetMaterial(2, 4, 0); + room.SetMaterial(3, 4, 0); + room.SetMaterial(4, 4, 0); + room.SetMaterial(5, 4, 14); + room.SetMaterial(6, 4, 14); + room.SetMaterial(7, 4, 14); + room.SetMaterial(8, 4, 14); + room.SetMaterial(9, 4, 14); + room.SetMaterial(10, 4, 14); + room.SetMaterial(11, 4, 14); + room.SetMaterial(12, 4, 14); + room.SetMaterial(13, 4, 14); + room.SetMaterial(14, 4, 7); + break; + } + + } + } + +} diff --git a/src/com/droidquest/items/WallHandle.java b/src/com/droidquest/items/WallHandle.java index ad91f03..00d756f 100644 --- a/src/com/droidquest/items/WallHandle.java +++ b/src/com/droidquest/items/WallHandle.java @@ -10,148 +10,143 @@ import javax.swing.ImageIcon; import com.droidquest.Room; -public class WallHandle extends Item -{ - // Handle used to pull sliding walls in Purple Lock +public class WallHandle extends Item { + // Handle used to pull sliding walls in Purple Lock - int startX; - int startY; + private int startX; + private int startY; - public WallHandle(int X, int Y, Room r) - { - x=X; y=Y; room=r; - startX = X; - startY = Y; - width=28; height=12; - GenerateIcons(); - } + public WallHandle(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + startX = X; + startY = Y; + width = 28; + height = 12; + GenerateIcons(); + } - public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.white); - g.fillRect(0,4,16,4); - g.fillRect(16,2,12,8); - g.fillRect(20,0,4,12); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.white); + g.fillRect(0, 4, 16, 4); + g.fillRect(16, 2, 12, 8); + g.fillRect(20, 0, 4, 12); + currentIcon = icons[0].getImage(); + } - public boolean CanBePickedUp(Item item) - { - if (item == level.player) return false; - return true; - } + public boolean CanBePickedUp(Item item) { + return item != level.player; + } - public void IsDropped() - { - x = startX; - y = startY; - int bigY = startY/32; - room.SetMaterial(6,bigY,2); - room.SetMaterial(7,bigY,2); - room.SetMaterial(8,bigY,2); - room.SetMaterial(9,bigY,2); - room.SetMaterial(10,bigY,2); - room.SetMaterial(11,bigY,0); - room.SetMaterial(12,bigY,0); - room.SetMaterial(13,bigY,0); - room.SetMaterial(14,bigY,0); - } + public void IsDropped() { + x = startX; + y = startY; + int bigY = startY / 32; + room.SetMaterial(6, bigY, 2); + room.SetMaterial(7, bigY, 2); + room.SetMaterial(8, bigY, 2); + room.SetMaterial(9, bigY, 2); + room.SetMaterial(10, bigY, 2); + room.SetMaterial(11, bigY, 0); + room.SetMaterial(12, bigY, 0); + room.SetMaterial(13, bigY, 0); + room.SetMaterial(14, bigY, 0); + } - public void Animate() - { - if (carriedBy != null) - { - int maxPull= 4*28; - Dimension d = GetXY(); - int tempX = d.width; - int tempY = d.height; - if (tempY != startY) - carriedBy.MoveDown(startY-tempY); - if (tempX < startX) - carriedBy.MoveRight(startX-tempX); - if (tempX > (startX + maxPull)) - carriedBy.MoveLeft(tempX - (startX+maxPull)); - - d = GetXY(); - tempX = d.width; - int blocks = (tempX-startX)/28; - int bigY = startY/32; - switch (blocks) - { - case 0: - room.SetMaterial(6,bigY,2); - room.SetMaterial(7,bigY,2); - room.SetMaterial(8,bigY,2); - room.SetMaterial(9,bigY,2); - room.SetMaterial(10,bigY,2); - room.SetMaterial(11,bigY,0); - room.SetMaterial(12,bigY,0); - room.SetMaterial(13,bigY,0); - room.SetMaterial(14,bigY,0); - break; - case 1: - room.SetMaterial(6,bigY,0); - room.SetMaterial(7,bigY,2); - room.SetMaterial(8,bigY,2); - room.SetMaterial(9,bigY,2); - room.SetMaterial(10,bigY,2); - room.SetMaterial(11,bigY,2); - room.SetMaterial(12,bigY,0); - room.SetMaterial(13,bigY,0); - room.SetMaterial(14,bigY,0); - break; - case 2: - room.SetMaterial(6,bigY,0); - room.SetMaterial(7,bigY,0); - room.SetMaterial(8,bigY,2); - room.SetMaterial(9,bigY,2); - room.SetMaterial(10,bigY,2); - room.SetMaterial(11,bigY,2); - room.SetMaterial(12,bigY,2); - room.SetMaterial(13,bigY,0); - room.SetMaterial(14,bigY,0); - break; - case 3: - room.SetMaterial(6,bigY,0); - room.SetMaterial(7,bigY,0); - room.SetMaterial(8,bigY,0); - room.SetMaterial(9,bigY,2); - room.SetMaterial(10,bigY,2); - room.SetMaterial(11,bigY,2); - room.SetMaterial(12,bigY,2); - room.SetMaterial(13,bigY,2); - room.SetMaterial(14,bigY,0); - break; - case 4: - room.SetMaterial(6,bigY,0); - room.SetMaterial(7,bigY,0); - room.SetMaterial(8,bigY,0); - room.SetMaterial(9,bigY,0); - room.SetMaterial(10,bigY,2); - room.SetMaterial(11,bigY,2); - room.SetMaterial(12,bigY,2); - room.SetMaterial(13,bigY,2); - room.SetMaterial(14,bigY,2); - break; - } - - } - } + public void Animate() { + if (carriedBy != null) { + int maxPull = 4 * 28; + Dimension d = GetXY(); + int tempX = d.width; + int tempY = d.height; + if (tempY != startY) { + carriedBy.MoveDown(startY - tempY); + } + if (tempX < startX) { + carriedBy.MoveRight(startX - tempX); + } + if (tempX > (startX + maxPull)) { + carriedBy.MoveLeft(tempX - (startX + maxPull)); + } - } \ No newline at end of file + d = GetXY(); + tempX = d.width; + int blocks = (tempX - startX) / 28; + int bigY = startY / 32; + switch (blocks) { + case 0: + room.SetMaterial(6, bigY, 2); + room.SetMaterial(7, bigY, 2); + room.SetMaterial(8, bigY, 2); + room.SetMaterial(9, bigY, 2); + room.SetMaterial(10, bigY, 2); + room.SetMaterial(11, bigY, 0); + room.SetMaterial(12, bigY, 0); + room.SetMaterial(13, bigY, 0); + room.SetMaterial(14, bigY, 0); + break; + case 1: + room.SetMaterial(6, bigY, 0); + room.SetMaterial(7, bigY, 2); + room.SetMaterial(8, bigY, 2); + room.SetMaterial(9, bigY, 2); + room.SetMaterial(10, bigY, 2); + room.SetMaterial(11, bigY, 2); + room.SetMaterial(12, bigY, 0); + room.SetMaterial(13, bigY, 0); + room.SetMaterial(14, bigY, 0); + break; + case 2: + room.SetMaterial(6, bigY, 0); + room.SetMaterial(7, bigY, 0); + room.SetMaterial(8, bigY, 2); + room.SetMaterial(9, bigY, 2); + room.SetMaterial(10, bigY, 2); + room.SetMaterial(11, bigY, 2); + room.SetMaterial(12, bigY, 2); + room.SetMaterial(13, bigY, 0); + room.SetMaterial(14, bigY, 0); + break; + case 3: + room.SetMaterial(6, bigY, 0); + room.SetMaterial(7, bigY, 0); + room.SetMaterial(8, bigY, 0); + room.SetMaterial(9, bigY, 2); + room.SetMaterial(10, bigY, 2); + room.SetMaterial(11, bigY, 2); + room.SetMaterial(12, bigY, 2); + room.SetMaterial(13, bigY, 2); + room.SetMaterial(14, bigY, 0); + break; + case 4: + room.SetMaterial(6, bigY, 0); + room.SetMaterial(7, bigY, 0); + room.SetMaterial(8, bigY, 0); + room.SetMaterial(9, bigY, 0); + room.SetMaterial(10, bigY, 2); + room.SetMaterial(11, bigY, 2); + room.SetMaterial(12, bigY, 2); + room.SetMaterial(13, bigY, 2); + room.SetMaterial(14, bigY, 2); + break; + } + + } + } + +} \ No newline at end of file diff --git a/src/com/droidquest/items/Wave.java b/src/com/droidquest/items/Wave.java index 3278fb8..a46a52e 100644 --- a/src/com/droidquest/items/Wave.java +++ b/src/com/droidquest/items/Wave.java @@ -2,27 +2,24 @@ package com.droidquest.items; import com.droidquest.Room; -public class Wave extends HiddenCamera -{ -int animationState; -int animationDir = 1; +public class Wave extends HiddenCamera { + private int animationState; + private int animationDir = 1; -public Wave(Room r) - { - super(r); - } + public Wave(Room r) { + super(r); + } -public void Animate() - { - animationState+=animationDir; - if (animationState==0 || animationState == 56) - animationDir=-animationDir; - if (animationState % 8 == 0) - { - int Y = (animationState/8) + 1; - room.SetMaterialFill(3,1,14,10,8); - room.SetMaterialFill(3,Y,14,Y+2,0); - } - } + public void Animate() { + animationState += animationDir; + if (animationState == 0 || animationState == 56) { + animationDir = -animationDir; + } + if (animationState % 8 == 0) { + int Y = (animationState / 8) + 1; + room.SetMaterialFill(3, 1, 14, 10, 8); + room.SetMaterialFill(3, Y, 14, Y + 2, 0); + } + } } \ No newline at end of file diff --git a/src/com/droidquest/items/WhiteRobot.java b/src/com/droidquest/items/WhiteRobot.java index fa83c52..12b9819 100644 --- a/src/com/droidquest/items/WhiteRobot.java +++ b/src/com/droidquest/items/WhiteRobot.java @@ -1,8 +1,5 @@ package com.droidquest.items; -import java.awt.Color; -import java.awt.Graphics; - import com.droidquest.Room; import com.droidquest.chipstuff.Port; import com.droidquest.devices.Antenna; @@ -10,64 +7,63 @@ import com.droidquest.devices.Bumper; import com.droidquest.devices.Grabber; import com.droidquest.devices.Thruster; -public class WhiteRobot extends GenericRobot -{ -int checker; +import java.awt.*; -public WhiteRobot(int X, int Y, Room r) - { - super(X,Y,r,Color.white); - checker=0; - Animate(); - devices[0] = new Thruster(176,16,InternalRoom,Port.ROT_UP,Color.blue); - devices[1] = new Thruster(476,128,InternalRoom,Port.ROT_RIGHT,Color.blue); - devices[2] = new Thruster(356,336,InternalRoom,Port.ROT_DOWN,Color.blue); - devices[3] = new Thruster(32,236,InternalRoom,Port.ROT_LEFT,Color.blue); - devices[4] = new Bumper(396,16,InternalRoom,Port.ROT_UP,Color.blue); - devices[5] = new Bumper(480,256,InternalRoom,Port.ROT_RIGHT,Color.blue); - devices[6] = new Bumper(128,330,InternalRoom,Port.ROT_DOWN,Color.blue); - devices[7] = new Bumper(28,134,InternalRoom,Port.ROT_LEFT,Color.blue); - devices[8] = new Antenna(64,70,InternalRoom,Color.blue); - devices[9] = new Grabber(126,44,InternalRoom,Color.blue); - for (int a=0; a<10; a++) - level.items.addElement(devices[a]); +public class WhiteRobot extends GenericRobot { + private int checker; - } + public WhiteRobot(int X, int Y, Room r) { + super(X, Y, r, Color.white); + checker = 0; + Animate(); + devices[0] = new Thruster(176, 16, InternalRoom, Port.ROT_UP, Color.blue); + devices[1] = new Thruster(476, 128, InternalRoom, Port.ROT_RIGHT, Color.blue); + devices[2] = new Thruster(356, 336, InternalRoom, Port.ROT_DOWN, Color.blue); + devices[3] = new Thruster(32, 236, InternalRoom, Port.ROT_LEFT, Color.blue); + devices[4] = new Bumper(396, 16, InternalRoom, Port.ROT_UP, Color.blue); + devices[5] = new Bumper(480, 256, InternalRoom, Port.ROT_RIGHT, Color.blue); + devices[6] = new Bumper(128, 330, InternalRoom, Port.ROT_DOWN, Color.blue); + devices[7] = new Bumper(28, 134, InternalRoom, Port.ROT_LEFT, Color.blue); + devices[8] = new Antenna(64, 70, InternalRoom, Color.blue); + devices[9] = new Grabber(126, 44, InternalRoom, Color.blue); + for (int a = 0; a < 10; a++) { + level.items.addElement(devices[a]); + } -public void Decorate() - { - super.Decorate(); - checker = 1 - checker; - Graphics g; - int cx, cy; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); - return; - } - - g.setColor(Color.black); - for (cy=0; cy<5; cy++) - for (cx=0; cx<3; cx++) - { - if ((cx+cy+checker)%2==1) - g.fillRect(cx*8+31 , cy*4+36 , 8, 4); - } - - // Generate Random positions for Orange & Blue Block - cx = level.random.nextInt(3); - cy = level.random.nextInt(5); - g.setColor(new Color(255,128,0)); - g.fillRect(cx*8+31,cy*4+36,8,4); - cx = level.random.nextInt(3); - cy = level.random.nextInt(5); - g.setColor(Color.blue); - g.fillRect(cx*8+31,cy*4+36,8,4); - - } + } + + public void Decorate() { + super.Decorate(); + checker = 1 - checker; + Graphics g; + int cx, cy; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); + return; + } + + g.setColor(Color.black); + for (cy = 0; cy < 5; cy++) { + for (cx = 0; cx < 3; cx++) { + if ((cx + cy + checker) % 2 == 1) { + g.fillRect(cx * 8 + 31, cy * 4 + 36, 8, 4); + } + } + } + + // Generate Random positions for Orange & Blue Block + cx = level.random.nextInt(3); + cy = level.random.nextInt(5); + g.setColor(new Color(255, 128, 0)); + g.fillRect(cx * 8 + 31, cy * 4 + 36, 8, 4); + cx = level.random.nextInt(3); + cy = level.random.nextInt(5); + g.setColor(Color.blue); + g.fillRect(cx * 8 + 31, cy * 4 + 36, 8, 4); + + } } diff --git a/src/com/droidquest/items/WireTester.java b/src/com/droidquest/items/WireTester.java index 744d8a9..a67fd66 100644 --- a/src/com/droidquest/items/WireTester.java +++ b/src/com/droidquest/items/WireTester.java @@ -14,95 +14,92 @@ import com.droidquest.Room; import com.droidquest.chipstuff.Port; import com.droidquest.devices.PortDevice; -public class WireTester extends Item -{ -transient PortDevice myPortDevice; +public class WireTester extends Item { + private transient PortDevice myPortDevice; -public WireTester(int X, int Y, Room r, PortDevice pd) - { - x=X; y=Y; room=r; - width=28; height=26; - myPortDevice=pd; - GenerateIcons(); - } + public WireTester(int X, int Y, Room r, PortDevice pd) { + x = X; + y = Y; + room = r; + width = 28; + height = 26; + myPortDevice = pd; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[2]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - icons[1]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - for (int a=0; a<2; a++) - { - Color color; - if (a==0) - color = Color.white; - else - color = new Color(255,128,0); - Graphics g; - try - { - g = icons[a].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(color); - g.fillRect(8,0,12,26); - g.fillRect(4,2,20,22); - g.fillRect(0,4,28,18); - g.setColor(Color.black); - g.fillRect(8,6,12,14); - g.fillRect(4,8,20,10); - g.setColor(color); - g.fillRect(12,8,4,10); - g.fillRect(8,10,12,6); - } - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[2]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + icons[1] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + for (int a = 0; a < 2; a++) { + Color color; + if (a == 0) { + color = Color.white; + } + else { + color = new Color(255, 128, 0); + } + Graphics g; + try { + g = icons[a].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(color); + g.fillRect(8, 0, 12, 26); + g.fillRect(4, 2, 20, 22); + g.fillRect(0, 4, 28, 18); + g.setColor(Color.black); + g.fillRect(8, 6, 12, 14); + g.fillRect(4, 8, 20, 10); + g.setColor(color); + g.fillRect(12, 8, 4, 10); + g.fillRect(8, 10, 12, 6); + } + currentIcon = icons[0].getImage(); + } -public void writeRef(ObjectOutputStream s) throws IOException - { - super.writeRef(s); - s.writeInt(level.items.indexOf(myPortDevice)); - } + public void writeRef(ObjectOutputStream s) throws IOException { + super.writeRef(s); + s.writeInt(level.items.indexOf(myPortDevice)); + } -public void readRef(ObjectInputStream s) throws IOException - { - super.readRef(s); - myPortDevice = (PortDevice) level.FindItem(s.readInt()); - } + public void readRef(ObjectInputStream s) throws IOException { + super.readRef(s); + myPortDevice = (PortDevice) level.FindItem(s.readInt()); + } -public boolean CanBePickedUp(Item i) - { - if (myPortDevice.ports[0].type==Port.TYPE_OUTPUT) - myPortDevice.ports[0].value = !myPortDevice.ports[0].value; - return false; - } + public boolean CanBePickedUp(Item i) { + if (myPortDevice.ports[0].type == Port.TYPE_OUTPUT) { + myPortDevice.ports[0].value = !myPortDevice.ports[0].value; + } + return false; + } -public void Decorate() - { - if (myPortDevice!=null) - { - if (myPortDevice.ports[0].value) - currentIcon = icons[1].getImage(); - else - currentIcon = icons[0].getImage(); - } - else - currentIcon = icons[0].getImage(); - } + public void Decorate() { + if (myPortDevice != null) { + if (myPortDevice.ports[0].value) { + currentIcon = icons[1].getImage(); + } + else { + currentIcon = icons[0].getImage(); + } + } + else { + currentIcon = icons[0].getImage(); + } + } -public void Erase() - { - super.Erase(); - myPortDevice = null; - } + public void Erase() { + super.Erase(); + myPortDevice = null; + } } diff --git a/src/com/droidquest/items/XitTicket.java b/src/com/droidquest/items/XitTicket.java index dd1a8e4..e4b9245 100644 --- a/src/com/droidquest/items/XitTicket.java +++ b/src/com/droidquest/items/XitTicket.java @@ -11,70 +11,66 @@ import com.droidquest.Room; import com.droidquest.materials.Material; import com.droidquest.materials.XitSlot; -public class XitTicket extends Item -{ -public XitTicket(int X, int Y, Room r) - { - x=X; y=Y; room=r; - width=28; height=30; - editable=true; - GenerateIcons(); - } +public class XitTicket extends Item { + public XitTicket(int X, int Y, Room r) { + x = X; + y = Y; + room = r; + width = 28; + height = 30; + editable = true; + GenerateIcons(); + } -public void GenerateIcons() - { - icons = new ImageIcon[1]; - icons[0]= new ImageIcon(new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = icons[0].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color transparent = new Color(0,0,0,0); - g2.setBackground(transparent); - g2.clearRect(0,0,width,height); - g.setColor(Color.white); - g.fillRect(8,0,4,6); - g.fillRect(0,2,8,2); - g.fillRect(0,8,12,2); - g.fillRect(0,12,12,2); - g.fillRect(4,14,4,2); - g.fillRect(0,16,4,2); - g.fillRect(8,16,4,2); - g.fillRect(0,20,12,2); - g.fillRect(8,24,4,6); - g.fillRect(0,26,8,2); - g.fillRect(16,4,4,2); - g.fillRect(24,4,4,2); - g.fillRect(20,6,4,2); - g.fillRect(16,8,4,2); - g.fillRect(24,8,4,2); - g.fillRect(16,16,12,2); - g.fillRect(24,20,4,6); - g.fillRect(16,22,8,2); - currentIcon = icons[0].getImage(); - } + public void GenerateIcons() { + icons = new ImageIcon[1]; + icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = icons[0].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color transparent = new Color(0, 0, 0, 0); + g2.setBackground(transparent); + g2.clearRect(0, 0, width, height); + g.setColor(Color.white); + g.fillRect(8, 0, 4, 6); + g.fillRect(0, 2, 8, 2); + g.fillRect(0, 8, 12, 2); + g.fillRect(0, 12, 12, 2); + g.fillRect(4, 14, 4, 2); + g.fillRect(0, 16, 4, 2); + g.fillRect(8, 16, 4, 2); + g.fillRect(0, 20, 12, 2); + g.fillRect(8, 24, 4, 6); + g.fillRect(0, 26, 8, 2); + g.fillRect(16, 4, 4, 2); + g.fillRect(24, 4, 4, 2); + g.fillRect(20, 6, 4, 2); + g.fillRect(16, 8, 4, 2); + g.fillRect(24, 8, 4, 2); + g.fillRect(16, 16, 12, 2); + g.fillRect(24, 20, 4, 6); + g.fillRect(16, 22, 8, 2); + currentIcon = icons[0].getImage(); + } -public void IsDropped() - { - int bigX = (x+width/2)/28; - int bigY = (y+height/2)/32; - Material mat = room.MaterialArray[bigY][bigX]; - if (mat.getClass().toString().endsWith("XitSlot")) - { - XitSlot xitslot = (XitSlot) mat; - xitslot.room = room; - xitslot.doorState=1; - room.SetMaterial(18,1,18); - room = null; - } - } + public void IsDropped() { + int bigX = (x + width / 2) / 28; + int bigY = (y + height / 2) / 32; + Material mat = room.MaterialArray[bigY][bigX]; + if (mat.getClass().toString().endsWith("XitSlot")) { + XitSlot xitslot = (XitSlot) mat; + xitslot.room = room; + xitslot.doorState = 1; + room.SetMaterial(18, 1, 18); + room = null; + } + } } diff --git a/src/com/droidquest/levels/Level.java b/src/com/droidquest/levels/Level.java index 3418935..e955535 100644 --- a/src/com/droidquest/levels/Level.java +++ b/src/com/droidquest/levels/Level.java @@ -1,997 +1,951 @@ package com.droidquest.levels; -import java.awt.Image; -import java.awt.image.ImageObserver; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Random; -import java.util.Vector; - import com.droidquest.Room; import com.droidquest.RoomDisplay; -import com.droidquest.devices.SmallChip; import com.droidquest.SoundClip; import com.droidquest.Wire; import com.droidquest.chipstuff.Port; -import com.droidquest.materials.Portal; +import com.droidquest.decorations.Spark; import com.droidquest.devices.Device; +import com.droidquest.devices.SmallChip; import com.droidquest.items.Initializer; import com.droidquest.items.Item; import com.droidquest.items.ToolBox; import com.droidquest.materials.Material; - -public class Level implements ImageObserver, Serializable { - public Item player; - public Item gameCursor; - public Item solderingPen; - public Item remote; - public Item toolbox; - public Item currentViewer; - public Item helpCam; - public Item paintbrush; - public transient Portal portal; - public boolean electricity; - - public Vector rooms = new Vector(); - public Vector materials = new Vector(); - public Vector items = new Vector(); - public Vector sparks = new Vector(); - - public transient RoomDisplay roomdisplay; - public transient Vector invRooms = new Vector(); - public transient Vector invRoomIndexes = new Vector(); - public transient Vector invMaterials = new Vector(); - public transient Vector invMaterialIndexes = new Vector(); - public transient Vector invItems = new Vector(); - public transient Vector invItemIndexes = new Vector(); - - public transient HashMap sounds = new HashMap(); - - public transient Random random = new Random(); - public transient static String ATTACHSOUND = "attach.WAV"; - public transient static String DETATCHSOUND = "detatch.WAV"; - public transient static String PICKUPSOUND = "pickup2.WAV"; - public transient static String DROPSOUND = "drop2.WAV"; - public transient static String BEEPSOUND = "beep2.WAV"; - public transient static String BUMPSOUND = "bump2.WAV"; - public transient static String CHARGESOUND = "charge.WAV"; - public transient static String DISCHARGESOUND = "discharge.WAV"; - public transient static String BURNSOUND = "burn.WAV"; - public transient static String ENDMUSICSOUND = "liberty.mid"; - public transient static String STARTMUSICSOUND = "sp001.wav"; - public transient static String TELEPORTSOUND = "teleport.WAV"; - public transient static String TRANSPORTSOUND = "transport.WAV"; - String[] soundFiles = { - ATTACHSOUND, DETATCHSOUND, PICKUPSOUND, DROPSOUND, - BEEPSOUND, BUMPSOUND, CHARGESOUND, DISCHARGESOUND, - BURNSOUND, ENDMUSICSOUND, STARTMUSICSOUND, - TELEPORTSOUND, TRANSPORTSOUND - }; - public transient boolean cheatmode = true; - - public Level() - { - Item.level = this; - Room.level = this; - Material.level = this; - InitSounds(); - } - - public Level(RoomDisplay rd) - { - roomdisplay = rd; - Item.level = this; - Room.level = this; - Material.level = this; - random.setSeed(System.currentTimeMillis()); - InitSounds(); - } - - public void LinkRoomsLeftRight(int L, int R) - { - ((Room) rooms.elementAt(L)).rightRoom = (Room) rooms.elementAt(R); - ((Room) rooms.elementAt(R)).leftRoom = (Room) rooms.elementAt(L); - } - - public void LinkRoomsUpDown(int U, int D) - { - ((Room) rooms.elementAt(U)).downRoom = (Room) rooms.elementAt(D); - ((Room) rooms.elementAt(D)).upRoom = (Room) rooms.elementAt(U); - } - - public void LinkRoomsHorizontally(int[] roomlist) - { - for (int a=0; a19 || y<0 || y>11) - { - Material mat = (Material) materials.elementAt(0); - if (x<0) - if (r.leftRoom != null) - mat = (Material) materials.elementAt(r.leftRoom.RoomArray[y][x+20]); - if (x>19) - if (r.rightRoom != null) - mat = (Material) materials.elementAt(r.rightRoom.RoomArray[y][x-20]); - if (y<0) - if (r.upRoom != null) - mat = (Material) materials.elementAt(r.upRoom.RoomArray[y+12][x]); - if (y>11) - if (r.downRoom != null) - mat = (Material) materials.elementAt(r.downRoom.RoomArray[y-12][x]); - return mat; - } - else - return (Material) materials.elementAt(r.RoomArray[y][x]); - } - - public Item FindNearestItem(Item a) - { - Item nearest=null; - int dx=100; - int dy=100; - int cxa=a.x+a.getWidth()/2; - int cya=a.y+a.getHeight()/2; - for (int i=0; i < items.size(); i++) - { - Item b = ((Item) items.elementAt(i)); - if (a.Overlaps(b)) - { - int cxb=b.x+b.getWidth()/2; - int cyb=b.y+b.getHeight()/2; - int dx2=Math.abs(cxb-cxa); - int dy2=Math.abs(cyb-cya); - if ((dx2+dy2)<(dx+dy)) - { - nearest=b; - dx=dx2; - dy=dy2; - } - } - } - return nearest; - } - - public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) - { - // This does nothing, but allows Images to be drawn freely onto - // other images. The only reason I have this function is so I have - // an object that implements ImageObserver, which for some stupid - // reason is a requirement for several Graphics methods. - return false; - } - - public void writeObject(ObjectOutputStream s) throws IOException - { - // Save Basic Room Data - int a; - s.writeInt(rooms.size()); - for (a=0; a=items.size()) return null; - return (Item) items.elementAt(itemIndex); - } - - public Room FindRoom(int roomIndex) - { - if (roomIndex==-1) return null; - if (roomIndex>=rooms.size()) return null; - return (Room) rooms.elementAt(roomIndex); - } - - public void Empty() - { - // This goes through the entire level structure and removes all - // references to everything. - - int a,b; - - Room.level=null; - Item.level=null; - - // Remove all Items - for (a=0;a b) - room.RoomArray[Y][X]-=1; - } - } - b--; - } - } - - for (int a=orgNumItems; a rooms = new Vector(); + public Vector materials = new Vector(); + public Vector items = new Vector(); + public Vector sparks = new Vector(); + + public transient RoomDisplay roomdisplay; + private transient Vector invRooms = new Vector(); + private transient Vector invRoomIndexes = new Vector(); + private transient Vector invMaterials = new Vector(); + private transient Vector invMaterialIndexes = new Vector(); + private transient Vector invItems = new Vector(); + private transient Vector invItemIndexes = new Vector(); + + public transient HashMap sounds = new HashMap(); + + public transient Random random = new Random(); + public transient static String ATTACHSOUND = "attach.WAV"; + public transient static String DETATCHSOUND = "detatch.WAV"; + public transient static String PICKUPSOUND = "pickup2.WAV"; + public transient static String DROPSOUND = "drop2.WAV"; + public transient static String BEEPSOUND = "beep2.WAV"; + public transient static String BUMPSOUND = "bump2.WAV"; + public transient static String CHARGESOUND = "charge.WAV"; + public transient static String DISCHARGESOUND = "discharge.WAV"; + public transient static String BURNSOUND = "burn.WAV"; + public transient static String ENDMUSICSOUND = "liberty.mid"; + public transient static String STARTMUSICSOUND = "sp001.wav"; + public transient static String TELEPORTSOUND = "teleport.WAV"; + public transient static String TRANSPORTSOUND = "transport.WAV"; + private String[] soundFiles = { + ATTACHSOUND, DETATCHSOUND, PICKUPSOUND, DROPSOUND, + BEEPSOUND, BUMPSOUND, CHARGESOUND, DISCHARGESOUND, + BURNSOUND, ENDMUSICSOUND, STARTMUSICSOUND, + TELEPORTSOUND, TRANSPORTSOUND + }; + public transient boolean cheatmode = true; + + Level() { + Item.level = this; + Room.level = this; + Material.level = this; + InitSounds(); + } + + public Level(RoomDisplay rd) { + roomdisplay = rd; + Item.level = this; + Room.level = this; + Material.level = this; + random.setSeed(System.currentTimeMillis()); + InitSounds(); + } + + public void LinkRoomsLeftRight(int L, int R) { + rooms.elementAt(L).rightRoom = rooms.elementAt(R); + rooms.elementAt(R).leftRoom = rooms.elementAt(L); + } + + public void LinkRoomsUpDown(int U, int D) { + rooms.elementAt(U).downRoom = rooms.elementAt(D); + rooms.elementAt(D).upRoom = rooms.elementAt(U); + } + + void LinkRoomsHorizontally(int[] roomlist) { + for (int a = 0; a < roomlist.length - 1; a++) { + LinkRoomsLeftRight(roomlist[a], roomlist[a + 1]); + } + } + + void LinkRoomsVertically(int[] roomlist) { + for (int a = 0; a < roomlist.length - 1; a++) { + LinkRoomsUpDown(roomlist[a], roomlist[a + 1]); + } + } + + void LinkRoomsGrid(int[][] roomgrid) { + // Requires a rectangular grid... each array is the same length + int height = roomgrid.length; + int width = roomgrid[0].length; + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + if (x < width - 1) { + LinkRoomsLeftRight(roomgrid[y][x], roomgrid[y][x + 1]); + } + if (y < height - 1) { + LinkRoomsUpDown(roomgrid[y][x], roomgrid[y + 1][x]); + } + } + } + } + + public Material materialAt(int x, int y, Room r) { + if (x < 0 || x > 19 || y < 0 || y > 11) { + Material mat = materials.elementAt(0); + if (x < 0) { + if (r.leftRoom != null) { + mat = materials.elementAt(r.leftRoom.RoomArray[y][x + 20]); + } + } + if (x > 19) { + if (r.rightRoom != null) { + mat = materials.elementAt(r.rightRoom.RoomArray[y][x - 20]); + } + } + if (y < 0) { + if (r.upRoom != null) { + mat = materials.elementAt(r.upRoom.RoomArray[y + 12][x]); + } + } + if (y > 11) { + if (r.downRoom != null) { + mat = materials.elementAt(r.downRoom.RoomArray[y - 12][x]); + } + } + return mat; + } + else { + return materials.elementAt(r.RoomArray[y][x]); + } + } + + public Item FindNearestItem(Item a) { + Item nearest = null; + int dx = 100; + int dy = 100; + int cxa = a.x + a.getWidth() / 2; + int cya = a.y + a.getHeight() / 2; + for (int i = 0; i < items.size(); i++) { + Item b = items.elementAt(i); + if (a.Overlaps(b)) { + int cxb = b.x + b.getWidth() / 2; + int cyb = b.y + b.getHeight() / 2; + int dx2 = Math.abs(cxb - cxa); + int dy2 = Math.abs(cyb - cya); + if ((dx2 + dy2) < (dx + dy)) { + nearest = b; + dx = dx2; + dy = dy2; + } + } + } + return nearest; + } + + public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { + // This does nothing, but allows Images to be drawn freely onto + // other images. The only reason I have this function is so I have + // an object that implements ImageObserver, which for some stupid + // reason is a requirement for several Graphics methods. + return false; + } + + public void writeObject(ObjectOutputStream s) throws IOException { + // Save Basic Room Data + int a; + s.writeInt(rooms.size()); + for (a = 0; a < rooms.size(); a++) { + s.writeObject(rooms.elementAt(a)); + } + + // Save Materials Data + s.writeInt(materials.size()); + for (a = 0; a < materials.size(); a++) { + s.writeObject(materials.elementAt(a)); + } + + // Save Basic Items data + s.writeInt(items.size()); + for (a = 0; a < items.size(); a++) { + s.writeObject(items.elementAt(a)); + } + + // Save Electricity + s.writeBoolean(electricity); + + // Save Player, GameCursor, CurrentViewer + s.writeInt(items.indexOf(player)); + s.writeInt(items.indexOf(gameCursor)); + s.writeInt(items.indexOf(currentViewer)); + s.writeInt(items.indexOf(solderingPen)); + s.writeInt(items.indexOf(remote)); + s.writeInt(items.indexOf(toolbox)); + s.writeInt(items.indexOf(helpCam)); + s.writeInt(items.indexOf(paintbrush)); + + // Save Room References (UDLRrooms, PortalItem, Wires) + for (a = 0; a < rooms.size(); a++) { + rooms.elementAt(a).writeRef(s); + } + + // Save Item References + for (a = 0; a < items.size(); a++) { + items.elementAt(a).writeRef(s); + } + + } + + public void readObject(ObjectInputStream s) throws IOException { + int a; + int numRooms = s.readInt(); + rooms = new Vector(); + for (a = 0; a < numRooms; a++) { + try { + Room r = (Room) s.readObject(); + rooms.addElement(r); + } + catch (ClassNotFoundException e) { + } + } + + int numMaterials = s.readInt(); + materials = new Vector(); + for (a = 0; a < numMaterials; a++) { + try { + Material m = (Material) s.readObject(); + materials.addElement(m); + } + catch (ClassNotFoundException e) { + } + } + + int numItems = s.readInt(); + items = new Vector(); + for (a = 0; a < numItems; a++) { + try { + Item i = (Item) s.readObject(); + items.addElement(i); + } + catch (ClassNotFoundException e) { + } + } + + electricity = s.readBoolean(); + player = FindItem(s.readInt()); + gameCursor = FindItem(s.readInt()); + currentViewer = FindItem(s.readInt()); + solderingPen = FindItem(s.readInt()); + remote = FindItem(s.readInt()); + toolbox = FindItem(s.readInt()); + helpCam = FindItem(s.readInt()); + paintbrush = FindItem(s.readInt()); + + // Read Room References (UDLRrooms, PortalItem, Wires) + for (a = 0; a < numRooms; a++) { + rooms.elementAt(a).readRef(s); + } + + // Read Item References + for (a = 0; a < numItems; a++) { + items.elementAt(a).readRef(s); + } + + // Generate Material Icons + for (a = 0; a < numMaterials; a++) { + materials.elementAt(a).GenerateIcons(); + } + + } + + public Item FindItem(String classname) { + for (Item item : items) { + if (item != null && item.getClass().toString().endsWith(classname)) { + return item; + } + } + return null; + } + + public Item FindItem(int itemIndex) { + if (itemIndex == -1) { + return null; + } + if (itemIndex >= items.size()) { + return null; + } + return items.elementAt(itemIndex); + } + + public Room FindRoom(int roomIndex) { + if (roomIndex == -1) { + return null; + } + if (roomIndex >= rooms.size()) { + return null; + } + return rooms.elementAt(roomIndex); + } + + public void Empty() { + // This goes through the entire level structure and removes all + // references to everything. + + int a; + + Room.level = null; + Item.level = null; + + // Remove all Items + for (a = 0; a < items.size(); a++) { + Item item = items.elementAt(a); + item.Erase(); + } + items.clear(); + items = null; + + // Remove all Materials + materials.clear(); + materials = null; + + // Remove all Rooms + for (a = 0; a < rooms.size(); a++) { + Room room = rooms.elementAt(a); + room.Erase(); + } + rooms.clear(); + rooms = null; + + // Remove all Local References + player = null; + gameCursor = null; + solderingPen = null; + remote = null; + toolbox = null; + currentViewer = null; + helpCam = null; + + System.gc(); // Run Garbage Collection + } + + public void WriteInventory() { + if (player.carrying == null) { + return; + } + AddItemToInventory(player.carrying); + LinkInventory(); + SaveInventory(); + } + + void AddItemToInventory(Item item) { + // Save Item + + if (item instanceof ToolBox) { + return; + } + + Item clonedItem = (Item) item.clone(); + invItems.addElement(clonedItem); + invItemIndexes.addElement(items.indexOf(item)); + + System.out.println((invItems.size() - 1) + ": " + + "Saving " + item.getClass() + ", index=" + items.indexOf(item)); + + if (item.carriedBy == player) { + clonedItem.carriedBy = null; + clonedItem.room = null; + } + + if (item.carriedBy == player.carrying) { + clonedItem.room = null; + } + + // Save carried Item + if (item.carrying != null && item.room == player.room) { + AddItemToInventory(item.carrying); + } + + if (item.InternalRoom != null) { + // Store Copy of Room + Room clonedRoom = (Room) item.InternalRoom.clone(); + invRooms.addElement(clonedRoom); + invRoomIndexes.addElement(rooms.indexOf(item.InternalRoom)); + System.out.println("Saving Room to Inventory."); + + // Store all Materials in the Internal Room + int matcount = 0; + for (int Y = 0; Y < 12; Y++) { + for (int X = 0; X < 20; X++) { + int matIndex = item.InternalRoom.RoomArray[Y][X]; + Material originalMaterial = materials.elementAt(matIndex); + Material clonedMaterial = (Material) originalMaterial.clone(); + boolean found = false; + for (int a = 0; a < invMaterials.size(); a++) { + Material testMaterial = invMaterials.elementAt(a); + if (testMaterial.equals(clonedMaterial)) { + found = true; + } + } + if (!found) { + invMaterials.addElement(clonedMaterial); + invMaterialIndexes.addElement(matIndex); + matcount++; + } + } + } + System.out.println("Saved " + matcount + "Materials to Inventory."); + + // Store all Items in the Internal Room + if (item.InternalRoom != null) { + for (int a = 0; a < items.size(); a++) { + Item internalItem = items.elementAt(a); + if (internalItem.room == item.InternalRoom) { + AddItemToInventory(internalItem); + } + } + } + } + } + + void LinkInventory() { + for (int a = 0; a < invItems.size(); a++) { + Item item = invItems.elementAt(a); + if (item.carrying != null) { + Integer realItemIndex = items.indexOf(item.carrying); + int b = 0; + while (invItemIndexes.elementAt(b).intValue() + != realItemIndex.intValue()) { + b++; + } + item.carrying = invItems.elementAt(b); + System.out.println(item.getClass() + + " carrying " + + item.carrying.getClass()); + } + if (item.carriedBy != null) { + Integer realItemIndex = items.indexOf(item.carriedBy); + int b = 0; + while (invItemIndexes.elementAt(b).intValue() + != realItemIndex.intValue()) { + b++; + } + item.carriedBy = invItems.elementAt(b); + System.out.println(item.getClass() + + " carriedBy " + + item.carriedBy.getClass()); + } + if (item.room != null) { + Integer realRoomIndex = rooms.indexOf(item.room); + int b = 0; + while (invRoomIndexes.elementAt(b).intValue() + != realRoomIndex.intValue()) { + b++; + } + item.room = invRooms.elementAt(b); + System.out.println(item.getClass() + + " is in room #" + b); + } + if (item.InternalRoom != null) { + Integer realInternalRoomIndex = rooms.indexOf(item.InternalRoom); + int b = 0; + while (invRoomIndexes.elementAt(b).intValue() + != realInternalRoomIndex.intValue()) { + b++; + } + item.InternalRoom = invRooms.elementAt(b); + // item.InternalRoom.portalItem = item; + System.out.println(item.getClass() + + " has internal room #" + b); + } + } + + for (int a = 0; a < invRooms.size(); a++) { + Room room = invRooms.elementAt(a); + if (room.upRoom != null) { + Integer realRoomIndex = rooms.indexOf(room.upRoom); + int b = 0; + while (invRoomIndexes.elementAt(b).intValue() + != realRoomIndex.intValue()) { + b++; + } + room.upRoom = invRooms.elementAt(b); + } + if (room.downRoom != null) { + Integer realRoomIndex = rooms.indexOf(room.downRoom); + int b = 0; + while (invRoomIndexes.elementAt(b).intValue() + != realRoomIndex.intValue()) { + b++; + } + room.downRoom = invRooms.elementAt(b); + } + if (room.leftRoom != null) { + Integer realRoomIndex = rooms.indexOf(room.leftRoom); + int b = 0; + while (invRoomIndexes.elementAt(b).intValue() + != realRoomIndex.intValue()) { + b++; + } + room.leftRoom = invRooms.elementAt(b); + } + if (room.rightRoom != null) { + Integer realRoomIndex = rooms.indexOf(room.rightRoom); + int b = 0; + while (invRoomIndexes.elementAt(b).intValue() + != realRoomIndex.intValue()) { + b++; + } + room.rightRoom = invRooms.elementAt(b); + } + if (room.portalItem != null) { + Integer realItemIndex = items.indexOf(room.portalItem); + int b = 0; + while (invItemIndexes.elementAt(b).intValue() + != realItemIndex.intValue()) { + b++; + } + room.portalItem = invItems.elementAt(b); + System.out.println("Room #" + a + " is inside " + + room.portalItem.getClass()); + } + + for (int X = 0; X < 20; X++) { + for (int Y = 0; Y < 12; Y++) { + Integer realMatIndex = room.RoomArray[Y][X]; + room.RoomArray[Y][X] = invMaterialIndexes.indexOf(realMatIndex); + } + } + + for (int w = 0; w < room.wires.size(); w++) { + Wire wire = room.wires.elementAt(w); + + Integer realItemIndex = items.indexOf(wire.fromPort.myDevice); + int b = 0; + while (invItemIndexes.elementAt(b).intValue() + != realItemIndex.intValue()) { + b++; + } + Item invItem = invItems.elementAt(b); + Device invDevice = (Device) invItem; + b = 0; + while (((Device) (wire.fromPort.myDevice)).ports[b] != wire.fromPort) { + b++; + } + wire.fromPort = invDevice.ports[b]; + wire.fromPort.myWire = wire; + wire.fromPort.myDevice = invDevice; + + realItemIndex = items.indexOf(wire.toPort.myDevice); + b = 0; + while (invItemIndexes.elementAt(b).intValue() + != realItemIndex.intValue()) { + b++; + } + invItem = invItems.elementAt(b); + invDevice = (Device) invItem; + b = 0; + while (((Device) (wire.toPort.myDevice)).ports[b] != wire.toPort) { + b++; + } + wire.toPort = invDevice.ports[b]; + wire.toPort.myWire = wire; + wire.toPort.myDevice = invDevice; + + if (wire.fromPort.type == Port.TYPE_INPUT) { + wire.inPort = wire.fromPort; + wire.outPort = wire.toPort; + } + else { + wire.inPort = wire.toPort; + wire.outPort = wire.fromPort; + } + } + } + } + + void SaveInventory() { + if (invItems.size() == 0) { + return; + } + + String filename = "temp.inv"; + System.out.println("Saving Inventory "); + try { + FileOutputStream out = new FileOutputStream(filename); + ObjectOutputStream s = new ObjectOutputStream(out); + + s.writeInt(invRooms.size()); + for (int a = 0; a < invRooms.size(); a++) { + s.writeObject(invRooms.elementAt(a)); + } + + s.writeInt(invMaterials.size()); + for (int a = 0; a < invMaterials.size(); a++) { + s.writeObject(invMaterials.elementAt(a)); + } + + s.writeInt(invItems.size()); + for (int a = 0; a < invItems.size(); a++) { + s.writeObject(invItems.elementAt(a)); + } + + // Save Room References (UDLRrooms, PortalItem, Wires) + for (int a = 0; a < invRooms.size(); a++) { + Room room = invRooms.elementAt(a); + s.writeInt(invRooms.indexOf(room.upRoom)); + s.writeInt(invRooms.indexOf(room.downRoom)); + s.writeInt(invRooms.indexOf(room.rightRoom)); + s.writeInt(invRooms.indexOf(room.leftRoom)); + s.writeInt(invItems.indexOf(room.portalItem)); + + s.writeInt(room.wires.size()); + for (int b = 0; b < room.wires.size(); b++) { + Wire wire = room.wires.elementAt(b); + int p; + s.writeInt(invItems.indexOf(wire.fromPort.myDevice)); // Index of fromport device + p = 0; + while (((Device) wire.fromPort.myDevice).ports[p] != wire.fromPort) { + p++; + } + s.writeInt(p); // Index of fromport (as device.ports[?] + + s.writeInt(invItems.indexOf(wire.toPort.myDevice)); // Index of toport device + p = 0; + while (((Device) wire.toPort.myDevice).ports[p] != wire.toPort) { + p++; + } + s.writeInt(p); // Index of toport (as device.ports[?] + + s.writeInt(invItems.indexOf(wire.inPort.myDevice)); // Index of inport device + p = 0; + while (((Device) wire.inPort.myDevice).ports[p] != wire.inPort) { + p++; + } + s.writeInt(p); // Index of inport (as device.ports[?] + + s.writeInt(invItems.indexOf(wire.outPort.myDevice)); // Index of outport device + p = 0; + while (((Device) wire.outPort.myDevice).ports[p] != wire.outPort) { + p++; + } + s.writeInt(p); // Index of outport (as device.ports[?] + } + } + + // Save Item References + for (int a = 0; a < invItems.size(); a++) { + Item item = invItems.elementAt(a); + s.writeInt(invItems.indexOf(item.carrying)); + s.writeInt(invItems.indexOf(item.carriedBy)); + s.writeInt(invRooms.indexOf(item.room)); + s.writeInt(invRooms.indexOf(item.InternalRoom)); + if (item.getClass().toString().endsWith("SmallChip")) { + SmallChip sc = (SmallChip) item; + String chipfilename = "tmp" + a + ".chip"; + sc.SaveChip(chipfilename); + } + } + + s.flush(); + s.close(); + out.close(); + } + catch (FileNotFoundException e) { + System.out.println("File Not Found"); + } + catch (IOException e) { + System.out.println("IO Exception"); + System.out.println(e.getMessage()); + } + + } + + public void LoadInventory() { + roomdisplay.timer.stop(); + String filename = "temp.inv"; + System.out.println("Loading Inventory "); + int orgNumRooms = rooms.size(); + int orgNumMaterials = materials.size(); + int orgNumItems = items.size(); + + try { + FileInputStream in = new FileInputStream(filename); + ObjectInputStream s = new ObjectInputStream(in); + + int numRooms = s.readInt(); + System.out.println("Loading " + numRooms + " Rooms from Inventory"); + for (int a = 0; a < numRooms; a++) { + try { + Room room = (Room) s.readObject(); + rooms.addElement(room); + } + catch (ClassNotFoundException e) { + } + } + + int numMaterials = s.readInt(); + System.out.println("Loading " + numMaterials + " Materials from Inventory"); + for (int a = 0; a < numMaterials; a++) { + try { + Material material = (Material) s.readObject(); + materials.addElement(material); + material.GenerateIcons(); + } + catch (ClassNotFoundException e) { + } + } + + int numItems = s.readInt(); + for (int a = 0; a < numItems; a++) { + try { + Item item = (Item) s.readObject(); + items.addElement(item); + System.out.println("Loading " + item.getClass() + " from Inventory"); + } + catch (ClassNotFoundException e) { + } + } + + for (int a = 0; a < numRooms; a++) { + Room room = rooms.elementAt(orgNumRooms + a); + int upRoomIndex = s.readInt(); + int downRoomIndex = s.readInt(); + int rightRoomIndex = s.readInt(); + int leftRoomIndex = s.readInt(); + int portalItemIndex = s.readInt(); + if (upRoomIndex != -1) { + room.upRoom = rooms.elementAt(upRoomIndex + orgNumRooms); + } + if (downRoomIndex != -1) { + room.downRoom = rooms.elementAt(downRoomIndex + orgNumRooms); + } + if (rightRoomIndex != -1) { + room.rightRoom = rooms.elementAt(rightRoomIndex + orgNumRooms); + } + if (leftRoomIndex != -1) { + room.leftRoom = rooms.elementAt(leftRoomIndex + orgNumRooms); + } + if (portalItemIndex != 1) { + room.portalItem = items.elementAt(portalItemIndex + orgNumItems); + System.out.println("Room #" + a + " has portalItem:" + room.portalItem.getClass()); + } + + int numWires = s.readInt(); + System.out.println("Linking " + numWires + " wires"); + + for (int b = 0; b < numWires; b++) { + Wire wire = room.wires.elementAt(b); + + Item tmpItem = items.elementAt(s.readInt() + orgNumItems); + Device tmpDevice = (Device) tmpItem; + wire.fromPort = tmpDevice.ports[s.readInt()]; + wire.fromPort.myWire = wire; + + tmpItem = items.elementAt(s.readInt() + orgNumItems); + tmpDevice = (Device) tmpItem; + wire.toPort = tmpDevice.ports[s.readInt()]; + wire.toPort.myWire = wire; + + tmpItem = items.elementAt(s.readInt() + orgNumItems); + tmpDevice = (Device) tmpItem; + wire.inPort = tmpDevice.ports[s.readInt()]; + + tmpItem = items.elementAt(s.readInt() + orgNumItems); + tmpDevice = (Device) tmpItem; + wire.outPort = tmpDevice.ports[s.readInt()]; + + } + + // Modify the Material Indexes + for (int X = 0; X < 20; X++) { + for (int Y = 0; Y < 12; Y++) { + room.RoomArray[Y][X] += orgNumMaterials; + } + } + + room.GenerateArray(); + } + + for (int a = 0; a < numItems; a++) { + Item item = items.elementAt(orgNumItems + a); + int carryingIndex = s.readInt(); + int carriedByIndex = s.readInt(); + int roomIndex = s.readInt(); + int internalRoomIndex = s.readInt(); + if (carryingIndex != -1) { + item.carrying = items.elementAt(carryingIndex + orgNumItems); + System.out.println(item.getClass() + " carries " + item.carrying.getClass()); + } + if (carriedByIndex != -1) { + item.carriedBy = items.elementAt(carriedByIndex + orgNumItems); + System.out.println(item.getClass() + " carriedBy " + item.carriedBy.getClass()); + } + if (roomIndex != -1) { + item.room = rooms.elementAt(roomIndex + orgNumRooms); + System.out.println(item.getClass() + " is in room #" + roomIndex); + } + else { + if (gameCursor != null) { + item.room = gameCursor.room; + } + else { + System.out.println("gameCursor = null"); + } + } + if (internalRoomIndex != -1) { + item.InternalRoom = rooms.elementAt(internalRoomIndex + orgNumRooms); + System.out.println(item.getClass() + " has InternalRoom #" + internalRoomIndex); + item.InternalRoom.portalItem = item; + } + if (item.isDevice()) { + Device device = (Device) item; + for (int b = 0; b < device.ports.length; b++) { + device.ports[b].myDevice = device; + } + } + } + + Item item = items.elementAt(orgNumItems); + gameCursor.carrying = item; + item.carriedBy = gameCursor; + + s.close(); + in.close(); + File f = new File(filename); + f.delete(); + } + catch (FileNotFoundException e) { + System.out.println("File Not Found"); + roomdisplay.timer.start(); + return; + } + catch (IOException e) { + System.out.println("IO Exception"); + System.out.println(e.getMessage()); + e.printStackTrace(); + return; + } + roomdisplay.timer.start(); + + // Remove all unnecessary Materials + for (int a = 0; a < materials.size() - 1; a++) { + for (int b = a + 1; b < materials.size(); b++) { + Material mat1 = materials.elementAt(a); + Material mat2 = materials.elementAt(b); + if (mat1.equals(mat2)) { + materials.remove(mat2); + for (int c = 0; c < rooms.size(); c++) { + Room room = rooms.elementAt(c); + for (int Y = 0; Y < 12; Y++) { + for (int X = 0; X < 20; X++) { + if (room.RoomArray[Y][X] == b) { + room.RoomArray[Y][X] = a; + } + if (room.RoomArray[Y][X] > b) { + room.RoomArray[Y][X] -= 1; + } + } + } + } + b--; + } + } + } + + for (int a = orgNumItems; a < items.size(); a++) { + Item item = items.elementAt(a); + item.GenerateIcons(); + if (item.getClass().toString().endsWith("SmallChip")) { + SmallChip sc = (SmallChip) item; + String chipfilename = "tmp" + (a - orgNumItems) + ".chip"; + sc.LoadChip(chipfilename); + File f = new File(chipfilename); + f.delete(); + } + } + + + } + + void InitSounds() { + for (String soundFile : soundFiles) { + sounds.put(soundFile, new SoundClip(soundFile)); + } + } + + public void PlaySound(Room room, String soundname) { + if (!roomdisplay.useSounds) { + return; + } + + boolean flag = true; + if (currentViewer != null) { + if (room != currentViewer.room) { + flag = false; + } + } + + if (flag) { + System.out.println("Playing sound " + soundname); + SoundClip soundClip = sounds.get(soundname); + if (soundClip != null) { + soundClip.audioClip.play(); + } + System.out.println("Done"); + } + } + + public void Init() { + // Generate all Room Material Arrays + for (int a = 0; a < rooms.size(); a++) { + Room room = rooms.elementAt(a); + room.GenerateArray(); + } + + // Randomize the level + Initializer initializer; + + for (Item item : items) { + if (item.getClass().toString().endsWith("Init")) { + initializer = (Initializer) item; + initializer.Init(); + } + } + } } diff --git a/src/com/droidquest/levels/MainMenu.java b/src/com/droidquest/levels/MainMenu.java index 23dcffd..ca0dcab 100644 --- a/src/com/droidquest/levels/MainMenu.java +++ b/src/com/droidquest/levels/MainMenu.java @@ -1,8 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; -import java.io.File; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.avatars.GameCursor; @@ -13,329 +10,306 @@ import com.droidquest.items.Crystal; import com.droidquest.materials.Material; import com.droidquest.materials.Portal; -public class MainMenu extends Level -{ -public MainMenu(RoomDisplay rd) - { - super(rd); - - // Material 0, Blank - materials.addElement(new Material(true, false)); - // Material 1, White Wall - materials.addElement(new Material(new Color(255,255,255),false, true)); - // Material 2, Green Wall - materials.addElement(new Material(new Color(0,255,0),false, true)); - // Material 3, Red Wall - materials.addElement(new Material(new Color(255,0,0),false, true)); - // Material 4, Blue Wall - materials.addElement(new Material(new Color(0,0,255),false, true)); - // Material 5, Portal to RO game - materials.addElement(new Portal("RO1.lvl",false, true)); - // Material 6, Portal to RO Lab - materials.addElement(new Portal("ROLab.lvl",false, true)); - // Material 7, Portal to RO tutorial A - materials.addElement(new Portal("ROTutA.lvl",false, true)); - // Material 8, Portal to RO tutorial B - materials.addElement(new Portal("ROTutB.lvl",false, true)); - // Material 9, Portal to RO tutorial C - materials.addElement(new Portal("ROTutC.lvl",false, true)); - // Material 10, Portal to RO tutorial D - materials.addElement(new Portal("ROTutD.lvl",false, true)); - // Material 11, Portal to RO tutorial E - materials.addElement(new Portal("ROTutE.lvl",false, true)); - // Material 12, Portal to RO tutorial F - materials.addElement(new Portal("ROTutF.lvl",false, true)); - // Material 13, Portal to RO Tutorial 3 - materials.addElement(new Portal("ROTut3.lvl",false, true)); - - // Material 14, Portal to EndGame 1 - materials.addElement(new Portal("ROEndGame.lvl", true, true)); - // Material 15, Portal to RO Level 6 - materials.addElement(new Portal("RO6.lvl",true, true)); - - // Material 7, Portal to RO Tutorial 1 -// materials.addElement(new Portal("ROTut1.lvl",false, true)); - // Material 8, Portal to RO Tutorial 2 -// materials.addElement(new Portal("ROTut2.lvl",false, true)); - // Material 9, Portal to RO Tutorial 3 -// materials.addElement(new Portal("ROTut3.lvl",false, true)); - // Material 10, Portal to RO Level 2 -// materials.addElement(new Portal("RO2.lvl",true, true)); - // Material 11, Portal to RO Level 3 -// materials.addElement(new Portal("RO3.lvl",true, true)); - // Material 12, Portal to RO Level 4 -// materials.addElement(new Portal("RO4.lvl",true, true)); - // Material 13, Portal to RO Level 5 -// materials.addElement(new Portal("RO5.lvl",true, true)); - // Material 14, Portal to RO Level EndGame -// materials.addElement(new Portal("ROEndGame.lvl",true, true)); - - // Room 0, Help Screen - // Room 1, Credits - // Room 2, Credits part 2 - // Room 3, Credits part 3 - // Room 4, Title, Entry Point - // Room 5, Saved Games List - // Room 6, New Games List - - for (int a=0; a<10; a++) - rooms.addElement(new Room()); - - { // Room 0: Help Screen - Room room = (Room) rooms.elementAt(0); - room.AddTextBox("Droid Quest Temporary Cheats", 4*28,2*32, 500); - room.AddTextBox("Q = Quicken the Animation Timer", 2*28,4*32, 500); - room.AddTextBox("W = Slow the Animation Timer", 2*28,5*32, 500); - room.AddTextBox("M = Memory Report", 2*28,6*32, 500); - room.AddTextBox("(To go to Main Menu, press Return.)", 70, 11*32, 500); - - } - { // Room 1: Credits - Room room = (Room) rooms.elementAt(1); - room.AddTextBox("Credits:", 7*28, 2*32, 500); - room.AddTextBox("Original Robot Odyssey by Mike Wallace and Leslie Grimm, (C) The Learning Company", - 2*28,3*32, 500); - room.AddTextBox("Original Atari Adventure by Warren Robinett, (C) Atari International", - 2*28,6*32, 500); - room.AddTextBox("DroidQuest (C) 2000 Thomas Foote", 2*28,8*32, 500); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - } - { // Room 2: Credits 2 - Room room = (Room) rooms.elementAt(2); - room.AddTextBox("Special thanks to...", 2*28,2*32, 500); - room.AddTextBox("Eric Welsh Eric Jacobs Vladimir Dimitrov Nathan Woods John Isidoro Derek Pechel Jeffery Hanke Matheww Russo Jim Veneskey Erik Santiso Michael Mol",2*28,4*32,220); - room.AddTextBox("Che Fox illuvius lexspoon shuffles Locklainn samdroid", 12*28,4*32, 200); - int[][] table = { - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - LinkRoomsUpDown(1,2); - } - { // Room 3: Credits 3 - Room room = (Room) rooms.elementAt(3); - room.AddTextBox("Christopher Walkup, age 6 Billy Leete, age 5", 2*28, 4*32, 350); - int[][] table = { - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - LinkRoomsUpDown(2,3); - } - { // Room 4: Title - Room room = (Room) rooms.elementAt(4); - room.AddGraphix("DQlogo.gif",2*28,1*32); - room.AddTextBox("Credits", 2*28,6*32+8, 500); - room.AddArrow(0,6*32,Arrow.DIR_LEFT, 28, Color.white); - room.AddTextBox("Saved Games", 9*28,10*32, 80); - room.AddTextBox("Games", 450,6*32+8, 500); - room.AddArrow(559,6*32,Arrow.DIR_RIGHT, 28, Color.white); - room.AddTextBox("{000,000,000} Version 2.7", 0,16,500); - if (cheatmode) - room.AddTextBox("{BIG} CHEAT ENABLED!", 91, 8*32, 500); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table; - LinkRoomsLeftRight(1,4); - } - { // Room 5: Save games - Room room = (Room) rooms.elementAt(5); - int[][] table = { - {3,3,3,3,3,3,3,3,0,0,0,0,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - LinkRoomsUpDown(4,5); - } - { // Room 6: Robot Odyssey - Room room = (Room) rooms.elementAt(6); - room.AddTextBox("{BIG} ROBOT ODYSSEY I", 2*28,2*32, 600); - room.AddTextBox("The Original Game", 2*28,3*32, 500); - room.AddTextBox("Robotropolis", 8*28,6*32, 500); - room.AddTextBox("Innovation Lab", 8*28,8*32, 500); - room.AddTextBox("Tutorials", 8*28, 11*32, 300); - room.AddArrow(10*28, 383, Arrow.DIR_DOWN, 32, Color.white); - int[][] table = { - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,4,4,4,4,4,4,4,0,0,0,0,4,4,4,4,4,4,4,4} - }; - room.RoomArray = table; - LinkRoomsLeftRight(4,6); - } - { // Room 7: RO Tutorials - Room room = (Room) rooms.elementAt(7); - int[][] table = { - {4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4} - }; - room.RoomArray = table; - room.AddTextBox("Robot Anatomy", 3*28, 4*32, 500); - room.AddTextBox("Robot Wiring", 3*28, 6*32, 500); - room.AddTextBox("Sensors", 3*28, 8*32, 500); - room.AddTextBox("Toolkit", 3*28, 10*32, 500); - LinkRoomsUpDown(6,7); - } - { // Room 8: RO Tutorials - Room room = (Room) rooms.elementAt(8); - int[][] table = { - {4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} - }; - room.RoomArray = table; - room.AddTextBox("Robot Circuits", 3*28, 4*32, 500); - room.AddTextBox("Robot Teamwork", 3*28, 6*32, 500); - room.AddTextBox("Chip Design", 3*28, 8*32, 500); - LinkRoomsUpDown(7,8); - } - { // Room 9: Secret Room - Room room = (Room) rooms.elementAt(9); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterial(2,2,14); - room.SetMaterial(2,4,15); - LinkRoomsUpDown(9,4); - items.addElement(new BlueRobot(2*28, 6*32,room)); - items.addElement(new Crystal(5*28, 6*32,room,100000)); - } +import java.awt.*; +import java.io.File; - - gameCursor = new GameCursor(9*28,6*32,(Room) rooms.elementAt(4)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - items.addElement(gameCursor); - items.addElement(helpCam); - player = gameCursor; - currentViewer = player; - - File f = new File("ROlevels/"); - if (!f.exists()) - f.mkdir(); - String[] files = f.list(); - int pageIndex=5; - for (int a=0; a4 && a%5==0) - { - // Add a new room - Room oldRoom = (Room) rooms.elementAt(pageIndex); - oldRoom.RoomArray[11][8]=0; - oldRoom.RoomArray[11][9]=0; - oldRoom.RoomArray[11][10]=0; - oldRoom.RoomArray[11][11]=0; - Room newRoom = new Room(); - rooms.addElement(newRoom); - int[][] tablex = { - {3,3,3,3,3,3,3,3,0,0,0,0,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - newRoom.RoomArray = tablex; - int newPageIndex = rooms.indexOf(newRoom); - LinkRoomsUpDown(pageIndex,newPageIndex); - pageIndex=newPageIndex; - } - materials.addElement(new Portal("ROlevels/"+files[a], false, false)); - int matIndex = materials.size()-1; - int y = 1+(a%5)*2; - Room room = (Room) rooms.elementAt(pageIndex); - room.RoomArray[y][2] = matIndex; - room.AddTextBox(files[a], 3*28+14, y*32+32, 400); - } - - } +public class MainMenu extends Level { + public MainMenu(RoomDisplay rd) { + super(rd); + + // Material 0, Blank + materials.addElement(new Material(true, false)); + // Material 1, White Wall + materials.addElement(new Material(new Color(255, 255, 255), false, true)); + // Material 2, Green Wall + materials.addElement(new Material(new Color(0, 255, 0), false, true)); + // Material 3, Red Wall + materials.addElement(new Material(new Color(255, 0, 0), false, true)); + // Material 4, Blue Wall + materials.addElement(new Material(new Color(0, 0, 255), false, true)); + // Material 5, Portal to RO game + materials.addElement(new Portal("RO1.lvl", false, true)); + // Material 6, Portal to RO Lab + materials.addElement(new Portal("ROLab.lvl", false, true)); + // Material 7, Portal to RO tutorial A + materials.addElement(new Portal("ROTutA.lvl", false, true)); + // Material 8, Portal to RO tutorial B + materials.addElement(new Portal("ROTutB.lvl", false, true)); + // Material 9, Portal to RO tutorial C + materials.addElement(new Portal("ROTutC.lvl", false, true)); + // Material 10, Portal to RO tutorial D + materials.addElement(new Portal("ROTutD.lvl", false, true)); + // Material 11, Portal to RO tutorial E + materials.addElement(new Portal("ROTutE.lvl", false, true)); + // Material 12, Portal to RO tutorial F + materials.addElement(new Portal("ROTutF.lvl", false, true)); + // Material 13, Portal to RO Tutorial 3 + materials.addElement(new Portal("ROTut3.lvl", false, true)); + + // Material 14, Portal to EndGame 1 + materials.addElement(new Portal("ROEndGame.lvl", true, true)); + // Material 15, Portal to RO Level 6 + materials.addElement(new Portal("RO6.lvl", true, true)); + + + // Room 0, Help Screen + // Room 1, Credits + // Room 2, Credits part 2 + // Room 3, Credits part 3 + // Room 4, Title, Entry Point + // Room 5, Saved Games List + // Room 6, New Games List + + for (int a = 0; a < 10; a++) { + rooms.addElement(new Room()); + } + + { // Room 0: Help Screen + Room room = rooms.elementAt(0); + room.AddTextBox("Droid Quest Temporary Cheats", 4 * 28, 2 * 32, 500); + room.AddTextBox("Q = Quicken the Animation Timer", 2 * 28, 4 * 32, 500); + room.AddTextBox("W = Slow the Animation Timer", 2 * 28, 5 * 32, 500); + room.AddTextBox("M = Memory Report", 2 * 28, 6 * 32, 500); + room.AddTextBox("(To go to Main Menu, press Return.)", 70, 11 * 32, 500); + + } + { // Room 1: Credits + Room room = rooms.elementAt(1); + room.AddTextBox("Credits:", 7 * 28, 2 * 32, 500); + room.AddTextBox("Original Robot Odyssey by Mike Wallace and Leslie Grimm, (C) The Learning Company", + 2 * 28, 3 * 32, 500); + room.AddTextBox("Original Atari Adventure by Warren Robinett, (C) Atari International", + 2 * 28, 6 * 32, 500); + room.AddTextBox("DroidQuest (C) 2000 Thomas Foote", 2 * 28, 8 * 32, 500); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2} + }; + } + { // Room 2: Credits 2 + Room room = rooms.elementAt(2); + room.AddTextBox("Special thanks to...", 2 * 28, 2 * 32, 500); + room.AddTextBox("Eric Welsh Eric Jacobs Vladimir Dimitrov Nathan Woods John Isidoro Derek Pechel Jeffery Hanke Matheww Russo Jim Veneskey Erik Santiso Michael Mol", 2 * 28, 4 * 32, 220); + room.AddTextBox("Che Fox illuvius lexspoon shuffles Locklainn samdroid", 12 * 28, 4 * 32, 200); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2} + }; + LinkRoomsUpDown(1, 2); + } + { // Room 3: Credits 3 + Room room = rooms.elementAt(3); + room.AddTextBox("Christopher Walkup, age 6 Billy Leete, age 5", 2 * 28, 4 * 32, 350); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + LinkRoomsUpDown(2, 3); + } + { // Room 4: Title + Room room = rooms.elementAt(4); + room.AddGraphix("DQlogo.gif", 2 * 28, 1 * 32); + room.AddTextBox("Credits", 2 * 28, 6 * 32 + 8, 500); + room.AddArrow(0, 6 * 32, Arrow.DIR_LEFT, 28, Color.white); + room.AddTextBox("Saved Games", 9 * 28, 10 * 32, 80); + room.AddTextBox("Games", 450, 6 * 32 + 8, 500); + room.AddArrow(559, 6 * 32, Arrow.DIR_RIGHT, 28, Color.white); + room.AddTextBox("{000,000,000} Version 2.7", 0, 16, 500); + if (cheatmode) { + room.AddTextBox("{BIG} CHEAT ENABLED!", 91, 8 * 32, 500); + } + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} + }; + LinkRoomsLeftRight(1, 4); + } + { // Room 5: Save games + Room room = rooms.elementAt(5); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + LinkRoomsUpDown(4, 5); + } + { // Room 6: Robot Odyssey + Room room = rooms.elementAt(6); + room.AddTextBox("{BIG} ROBOT ODYSSEY I", 2 * 28, 2 * 32, 600); + room.AddTextBox("The Original Game", 2 * 28, 3 * 32, 500); + room.AddTextBox("Robotropolis", 8 * 28, 6 * 32, 500); + room.AddTextBox("Innovation Lab", 8 * 28, 8 * 32, 500); + room.AddTextBox("Tutorials", 8 * 28, 11 * 32, 300); + room.AddArrow(10 * 28, 383, Arrow.DIR_DOWN, 32, Color.white); + room.RoomArray = new int[][]{ + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4} + }; + LinkRoomsLeftRight(4, 6); + } + { // Room 7: RO Tutorials + Room room = rooms.elementAt(7); + room.RoomArray = new int[][]{ + {4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4} + }; + room.AddTextBox("Robot Anatomy", 3 * 28, 4 * 32, 500); + room.AddTextBox("Robot Wiring", 3 * 28, 6 * 32, 500); + room.AddTextBox("Sensors", 3 * 28, 8 * 32, 500); + room.AddTextBox("Toolkit", 3 * 28, 10 * 32, 500); + LinkRoomsUpDown(6, 7); + } + { // Room 8: RO Tutorials + Room room = rooms.elementAt(8); + room.RoomArray = new int[][]{ + {4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} + }; + room.AddTextBox("Robot Circuits", 3 * 28, 4 * 32, 500); + room.AddTextBox("Robot Teamwork", 3 * 28, 6 * 32, 500); + room.AddTextBox("Chip Design", 3 * 28, 8 * 32, 500); + LinkRoomsUpDown(7, 8); + } + { // Room 9: Secret Room + Room room = rooms.elementAt(9); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterial(2, 2, 14); + room.SetMaterial(2, 4, 15); + LinkRoomsUpDown(9, 4); + items.addElement(new BlueRobot(2 * 28, 6 * 32, room)); + items.addElement(new Crystal(5 * 28, 6 * 32, room, 100000)); + } + + + gameCursor = new GameCursor(9 * 28, 6 * 32, rooms.elementAt(4)); + helpCam = new HelpCam(rooms.elementAt(0)); + items.addElement(gameCursor); + items.addElement(helpCam); + player = gameCursor; + currentViewer = player; + + File f = new File("ROlevels/"); + if (!f.exists()) { + f.mkdir(); + } + String[] files = f.list(); + int pageIndex = 5; + for (int a = 0; a < files.length; a++) { + if (a > 4 && a % 5 == 0) { + // Add a new room + Room oldRoom = rooms.elementAt(pageIndex); + oldRoom.RoomArray[11][8] = 0; + oldRoom.RoomArray[11][9] = 0; + oldRoom.RoomArray[11][10] = 0; + oldRoom.RoomArray[11][11] = 0; + Room newRoom = new Room(); + rooms.addElement(newRoom); + newRoom.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + int newPageIndex = rooms.indexOf(newRoom); + LinkRoomsUpDown(pageIndex, newPageIndex); + pageIndex = newPageIndex; + } + materials.addElement(new Portal("ROlevels/" + files[a], false, false)); + int matIndex = materials.size() - 1; + int y = 1 + (a % 5) * 2; + Room room = rooms.elementAt(pageIndex); + room.RoomArray[y][2] = matIndex; + room.AddTextBox(files[a], 3 * 28 + 14, y * 32 + 32, 400); + } + + } } diff --git a/src/com/droidquest/levels/RO1.java b/src/com/droidquest/levels/RO1.java index 08ae49a..fa49895 100644 --- a/src/com/droidquest/levels/RO1.java +++ b/src/com/droidquest/levels/RO1.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.Wire; @@ -11,1016 +9,1015 @@ import com.droidquest.avatars.Remote; import com.droidquest.avatars.SolderingPen; import com.droidquest.decorations.Arrow; import com.droidquest.decorations.Graphix; -import com.droidquest.devices.ANDGate; -import com.droidquest.devices.ContactSensor; -import com.droidquest.devices.DirectionalSensor; -import com.droidquest.devices.FlipFlop; -import com.droidquest.devices.GenericChip; -import com.droidquest.devices.NOTGate; -import com.droidquest.devices.Node; -import com.droidquest.devices.RoomSensor; -import com.droidquest.devices.SmallChip; -import com.droidquest.items.AmpireBot; -import com.droidquest.items.BlackCrystal; -import com.droidquest.items.BlueRobot; -import com.droidquest.items.Crystal; -import com.droidquest.items.Initializer; -import com.droidquest.items.Item; -import com.droidquest.items.Key; -import com.droidquest.items.Magnet; -import com.droidquest.items.OrangeRobot; -import com.droidquest.items.Sentry; -import com.droidquest.items.Sentry3; -import com.droidquest.items.Suitcase; -import com.droidquest.items.Sweeper; -import com.droidquest.items.Token; -import com.droidquest.items.WhiteRobot; -import com.droidquest.materials.BlueWall; -import com.droidquest.materials.Lock; -import com.droidquest.materials.LockS1; -import com.droidquest.materials.Material; -import com.droidquest.materials.Portal; +import com.droidquest.devices.*; +import com.droidquest.items.*; +import com.droidquest.materials.*; -class RO1 extends Level -{ -public RO1(RoomDisplay rd) - { - super(rd); - - materials.addElement(new Material(true, false)); // 0= Blank - materials.addElement(new Material(new Color(190,190,255),false, true)); // 1= Light Blue Wall - int[][] lockProgram1 = { - {Lock.NARROW}, - {4,9,0, 4,6,1}, - {4,8,0, 4,5,1}, - {Lock.NARROW}, - {4,8,1, 4,5,0}, - {4,9,1, 4,6,0}, - }; - materials.addElement(new Lock(Color.blue, Color.blue, lockProgram1)); // 2= Lock 1 - materials.addElement(new Material(new Color(0,0,128),false,true)); // 3= Dark Blue Wall - materials.addElement(new BlueWall()); // 4= Blue Wall - int[][] lockProgram2 = { - {Lock.NARROW}, - { 5,1,0, 5,2,0, 5,3,0, 6,1,4, 6,2,4, 6,3,4}, - { 6,1,0, 6,2,0, 6,3,0, 7,1,4, 7,2,4, 7,3,4}, - { 7,1,0, 7,2,0, 7,3,0, 8,1,4, 8,2,4, 8,3,4}, - { 8,1,0, 8,2,0, 8,3,0, 9,1,4, 9,2,4, 9,3,4}, - { 9,1,0, 9,2,0, 9,3,0, 10,1,4, 10,2,4, 10,3,4}, - {10,1,0, 10,2,0, 10,3,0, 11,1,4, 11,2,4, 11,3,4}, - {11,1,0, 11,2,0, 11,3,0, 12,1,4, 12,2,4, 12,3,4}, - {12,1,0, 12,2,0, 12,3,0, 13,1,4, 13,2,4, 13,3,4}, - {13,1,0, 13,2,0, 13,3,0, 14,1,4, 14,2,4, 14,3,4}, - {14,1,0, 14,2,0, 14,3,0, 15,1,4, 15,2,4, 15,3,4}, - {15,1,0, 15,2,0, 15,3,0, 16,1,4, 16,2,4, 16,3,4}, - {16,1,0, 16,2,0, 16,3,0, 17,1,4, 17,2,4, 17,3,4}, - {17,1,0, 17,2,0, 17,3,0, 18,1,4, 18,2,4, 18,3,4}, - {Lock.NARROW}, - {17,1,4, 17,2,4, 17,3,4, 18,1,0, 18,2,0, 18,3,0}, - {16,1,4, 16,2,4, 16,3,4, 17,1,0, 17,2,0, 17,3,0}, - {15,1,4, 15,2,4, 15,3,4, 16,1,0, 16,2,0, 16,3,0}, - {14,1,4, 14,2,4, 14,3,4, 15,1,0, 15,2,0, 15,3,0}, - {13,1,4, 13,2,4, 13,3,4, 14,1,0, 14,2,0, 14,3,0}, - {12,1,4, 12,2,4, 12,3,4, 13,1,0, 13,2,0, 13,3,0}, - {11,1,4, 11,2,4, 11,3,4, 12,1,0, 12,2,0, 12,3,0}, - {10,1,4, 10,2,4, 10,3,4, 11,1,0, 11,2,0, 11,3,0}, - { 9,1,4, 9,2,4, 9,3,4, 10,1,0, 10,2,0, 10,3,0}, - { 8,1,4, 8,2,4, 8,3,4, 9,1,0, 9,2,0, 9,3,0}, - { 7,1,4, 7,2,4, 7,3,4, 8,1,0, 8,2,0, 8,3,0}, - { 6,1,4, 6,2,4, 6,3,4, 7,1,0, 7,2,0, 7,3,0}, - { 5,1,4, 5,2,4, 5,3,4, 6,1,0, 6,2,0, 6,3,0} - }; - materials.addElement(new Lock(Color.blue, Color.blue, lockProgram2)); // 5= Lock2 - materials.addElement(new Material(new Color(0,255,0),false, true)); // 6= Green Wall - materials.addElement(new Portal("RO2.lvl", true, true)); // 7= Portal to Level 2 - materials.addElement(new LockS1()); //8=Secret Lock +import java.awt.*; - for (int a=0; a<32; a++) - rooms.addElement(new Room()); +class RO1 extends Level { + public RO1(RoomDisplay rd) { + super(rd); - { // Room 0, Entry point - Room room = (Room) rooms.elementAt(0); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialFill(19,8,19,10,0); - room.AddTextBox("Welcome Traveller!",150,64, 400); - room.AddTextBox("You have fallen into the under- ground city of Robotropolis. To escape, travel upward through all five levels of the city." - ,60,100,400); - room.AddTextBox("The three robots in the next room will help you on your journey. To learn how they work, choose Robot Anatomy from the menu." - ,60,200,400); - room.AddTextBox("This way to Robotropolis",360,290,200); - room.AddArrow(559, 11*28+16, Arrow.DIR_RIGHT, 100, Color.white); - } - { // Room 1, Robots Here - Room room = (Room) rooms.elementAt(1); - int[][] table1 = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1}, - {0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, - {0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, - {0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table1; - items.addElement(new BlueRobot(6*28, 5*32, room)); - { - Item robot = (Item) items.lastElement(); - BlueRobot brobot = (BlueRobot) robot; - brobot.thrusterPower=true; - RoomSensor rSensor = new RoomSensor(8*28,4*32+16,brobot.InternalRoom, - new Key(0,0,null,Color.white)); - items.addElement(rSensor); - rSensor.rotate(1); rSensor.rotate(1); - NOTGate ng = new NOTGate(5*28,3*32,brobot.InternalRoom); - items.addElement(ng); - FlipFlop ff = new FlipFlop(9*28,6*32,brobot.InternalRoom); - items.addElement(ff); - Wire dummy; - dummy = new Wire(rSensor.ports[0], ng.ports[0]); - dummy = new Wire(ng.ports[1], brobot.devices[9].ports[0]); - dummy = new Wire(ff.ports[0], brobot.devices[5].ports[0]); - dummy = new Wire(ff.ports[1], brobot.devices[7].ports[0]); - dummy = new Wire(ff.ports[2], brobot.devices[1].ports[0]); - dummy = new Wire(ff.ports[3], brobot.devices[3].ports[0]); - } - - items.addElement(new WhiteRobot(8*28, 3*32, room)); - { - Item robot = (Item) items.lastElement(); - WhiteRobot wrobot = (WhiteRobot) robot; - wrobot.thrusterPower=true; - - RoomSensor rSensor = new RoomSensor(4*28,4*32, wrobot.InternalRoom, - new Crystal(0,0,null,0)); - items.addElement(rSensor); - rSensor.rotate(1); rSensor.rotate(1); - NOTGate ng = new NOTGate(5*28, 7*32, wrobot.InternalRoom); - items.addElement(ng); - ng.rotate(1);ng.rotate(1);ng.rotate(1); - FlipFlop ff = new FlipFlop(8*28,6*32,wrobot.InternalRoom); - items.addElement(ff); - ANDGate ag1 = new ANDGate(9*28,2*32,wrobot.InternalRoom); - items.addElement(ag1); - ANDGate ag2 = new ANDGate(12*28,8*32,wrobot.InternalRoom); - items.addElement(ag2); - ag2.rotate(1);ag2.rotate(1); - Node node = new Node(15*28, 7*32, wrobot.InternalRoom, Node.TYPE_THREE); - items.addElement(node); - node.rotate(1); node.rotate(1); - - Wire dummy; - dummy = new Wire(rSensor.ports[0], wrobot.devices[8].ports[0]); - dummy = new Wire(node.ports[0], wrobot.devices[5].ports[0]); - dummy = new Wire(node.ports[1], ag2.ports[0]); - dummy = new Wire(node.ports[2], ng.ports[0]); - dummy = new Wire(node.ports[3], ag1.ports[1]); - dummy = new Wire(ag1.ports[2], wrobot.devices[0].ports[0]); - dummy = new Wire(ag2.ports[2], wrobot.devices[2].ports[0]); - dummy = new Wire(ng.ports[1], wrobot.devices[3].ports[0]); - dummy = new Wire(ff.ports[0], wrobot.devices[4].ports[0]); - dummy = new Wire(ff.ports[1], wrobot.devices[6].ports[0]); - dummy = new Wire(ff.ports[2], ag1.ports[0]); - dummy = new Wire(ff.ports[3], ag2.ports[1]); - } - - items.addElement(new OrangeRobot(14*28, 9*32, room)); - { - Item robot = (Item) items.lastElement(); - OrangeRobot orobot = (OrangeRobot) robot; - orobot.thrusterPower=true; - - RoomSensor rSensor = new RoomSensor(8*28,4*32+16,orobot.InternalRoom, - new Key(0,0,null, Color.white)); - items.addElement(rSensor); - rSensor.rotate(1); rSensor.rotate(1); - NOTGate ng = new NOTGate(5*28,3*32,orobot.InternalRoom); - items.addElement(ng); - SmallChip sc = new SmallChip(10*28,6*32,orobot.InternalRoom,"2"); - items.addElement(sc); - sc.LoadChip("chips/WallHugger.chip"); - Wire dummy; - dummy = new Wire(rSensor.ports[0], ng.ports[0]); - dummy = new Wire(ng.ports[1], orobot.devices[9].ports[0]); // Antenna - dummy = new Wire(sc.ports[0], orobot.devices[0].ports[0]); // Top Thruster - dummy = new Wire(sc.ports[1], orobot.devices[7].ports[0]); // Left Bumper - dummy = new Wire(sc.ports[2], orobot.devices[3].ports[0]); // Left Thruster - dummy = new Wire(sc.ports[3], orobot.devices[6].ports[0]); // Bottom Bumper - dummy = new Wire(sc.ports[4], orobot.devices[2].ports[0]); // Bottom Thruster - dummy = new Wire(sc.ports[5], orobot.devices[5].ports[0]); // Right Bumper - dummy = new Wire(sc.ports[6], orobot.devices[1].ports[0]); // Right Thruster - dummy = new Wire(sc.ports[7], orobot.devices[4].ports[0]); // Top Bumper - } - items.addElement(new Key(8*28, 8*32, room, Color.blue)); - } - { // Room 2, Sewer Door - Room room = (Room) rooms.elementAt(2); - int[][] table2 = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0}, - {1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0}, - {0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1}, - {0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1}, - {0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1} - }; - room.RoomArray = table2; - room.AddTextBox("{BIG} The City Sewer",40,80,500); - items.addElement(new Sweeper(476, 224, room)); - } - { // Room 3, Maze 1 "PR" - Room room = (Room) rooms.elementAt(3); - int[][] table3= { - {1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1}, - {1,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1}, - {1,0,0,1,0,0,1,0,0,1,1,1,1,0,0,0,0,0,0,0}, - {1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0}, - {1,0,0,1,1,1,1,0,0,1,0,0,1,0,0,0,0,0,0,0}, - {1,0,0,1,0,0,0,0,0,1,1,1,1,0,0,1,1,1,1,1}, - {1,1,1,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1}, - {1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1} - }; - room.RoomArray = table3; - String[] i1 = {"0073.jpg","0074.jpg"}; - room.graphix.addElement(new Graphix(i1, 4*28+14,5*32)); - } - { // Room 4, Maze 2 "CG" - Room room = (Room) rooms.elementAt(4); - int[][] table4= { - {1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1}, - {1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1}, - {1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1}, - {1,0,0,1,1,1,1,0,0,0,0,1,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1}, - {1,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,0,0,0,0}, - {1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0}, - {1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0}, - {1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table4; - String[] i6 = {"0075.jpg","0076.jpg","0077.jpg", "0076.jpg"}; - room.graphix.addElement(new Graphix(i6, 13*28, 4*32, - Graphix.BOUNCE, 0,2, 3*16)); - } - { // Room 5, Maze 3 "PC" - Room room = (Room) rooms.elementAt(5); - int[][] table5= { - {1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,1,1,1,1,0,0,1,0,0,1,1,1,0,0,0,0}, - {0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0}, - {0,0,0,0,1,1,1,1,0,0,1,0,0,1,1,1,1,1,1,1}, - {0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1} - }; - room.RoomArray = table5; - } - { // Room 6, Maze 4 "RC" - Room room = (Room) rooms.elementAt(6); - int[][] table6= { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0}, - {1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0}, - {1,0,0,1,1,1,0,0,0,0,1,0,0,0,0,0,1,1,1,1}, - {1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1}, - {0,0,0,1,0,0,1,0,0,0,1,1,1,1,0,0,0,0,0,1}, - {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1} - }; - room.RoomArray = table6; - String[] i7 = {"0082.jpg","0083.jpg","0084.jpg", "0085.jpg", "0084.jpg", "0083.jpg", "0082.jpg"}; - room.graphix.addElement(new Graphix(i7, 12*28, 4*32, - Graphix.BOUNCE, 0,2, 3*16)); - } - { // Room 7, Maze 5 "MW" - Room room = (Room) rooms.elementAt(7); - int[][] table7= { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,1,0,0,1}, - {0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,1}, - {1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1}, - {1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1}, - {1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1}, - {1,0,0,1,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table7; - String[] i2 = {"0086.jpg","0087.jpg"}; - room.graphix.addElement(new Graphix(i2, 5*28,2*32)); - } - { // Room 8, Maze 6 "CIG" - Room room = (Room) rooms.elementAt(8); - int[][] table8= { - {1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1}, - {1,1,1,1,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1}, - {0,0,0,1,0,0,1,1,1,0,0,0,1,0,0,1,0,0,0,0}, - {0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,1,0,0}, - {1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,1,1,0,0}, - {1,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0}, - {1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,0,0,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1}, - {1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1}, - {1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1} - }; - room.RoomArray = table8; - } - { // Room 9, Maze 7 "NH" - Room room = (Room) rooms.elementAt(9); - int[][] table9= { - {1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1}, - {1,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1}, - {1,0,0,1,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1}, - {1,0,0,1,0,1,0,0,1,0,0,1,1,1,1,1,0,0,0,1}, - {1,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,0,1}, - {1,0,0,1,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,1}, - {1,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1}, - {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table9; - } - { // Room 10, Maze 8 "SG" - Room room = (Room) rooms.elementAt(10); - int[][] table10= { - {1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1}, - {0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, - {0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, - {0,0,0,1,1,1,1,1,0,0,0,0,1,0,0,0,1,0,0,0}, - {0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,0}, - {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table10; - String[] i8 = {"0078.jpg","0079.jpg","0080.jpg", "0081.jpg"}; - room.graphix.addElement(new Graphix(i8, 13*28, 10*32, - Graphix.BOUNCE, 2,0, 5*14)); - } - { // Room 11, Maze Bottom - Room room = (Room) rooms.elementAt(11); - int[][] table11= { - {3,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3}, - {3,8,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table11; - items.addElement(new ContactSensor(9*28,2*32,room, new Token(0,0,null))); - } - { // Room 12, Top Corridor 1 - Room room = (Room) rooms.elementAt(12); - int[][] table12 = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table12; - } - { // Room 13, Top Corridor 2 - Room room = (Room) rooms.elementAt(13); - int[][] table13 = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table13; - } - { // Room 14, Top Corridor Branch - Room room = (Room) rooms.elementAt(14); - int[][] table14 = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3} - }; - room.RoomArray = table14; - } - { // Room 15, Hallway Top Right - Room room = (Room) rooms.elementAt(15); - int[][] table15 = { - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3} - }; - room.RoomArray = table15; - } - { // Room 16, Hallway Bottom Right - Room room = (Room) rooms.elementAt(16); - int[][] table16 = { - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table16; - } - { // Room 17, Hallway Bottom - Room room = (Room) rooms.elementAt(17); - int[][] table17 = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,0,0,0,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,0,0,0,0,0,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,0,0,0,0,0,0,0,3,3,3,3,3,3} - }; - room.RoomArray = table17; - items.addElement(new AmpireBot(10*28,3*32, room)); - } - { // Room 18, Hallway Bottom Left - Room room = (Room) rooms.elementAt(18); - int[][] table18 = { - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table18; - } - { // Room 19, Hallway Top Left - Room room = (Room) rooms.elementAt(19); - int[][] table19 = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3} - }; - room.RoomArray = table19; - } - { // Room 20, Hallway Top - Room room = (Room) rooms.elementAt(20); - int[][] table20 = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table20; - } - { // Room 21, WallHugger Puzzle - Room room = (Room) rooms.elementAt(21); - int[][] table21 = { - {3,3,3,3,3,3,3,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,0,0,0,0,0,0,0,3,3,3,3,3,3}, - {3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3}, - {3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,3,0,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,3,3}, - {3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table21; - items.addElement(new Magnet(10*28,9*32, room)); - int[] pace = {3*28, 120, 16*28, 120}; - int[] protect = {0,3*32,19*28,11*32, 10*28,0}; - items.addElement(new Sentry(3*28,120, room, pace, protect, false)); - } - { // Room 22, Bouncer Puzzle - Room room = (Room) rooms.elementAt(22); - int[][] table22 = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3}, - {3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table22; - items.addElement(new Crystal(16*28,5*32, room,100000)); - int[] pace = {3*28,94, 3*28,302}; - int[] protect = {4*28,0,19*28,11*32, 0,5*32}; - items.addElement(new Sentry(3*28,94, room, pace, protect, false)); - } - { // Room 23, AnteChamber - Room room = (Room) rooms.elementAt(23); - int[][] table23 = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,3,3,3,3,3,0,0,0,0,3,3,3}, - {0,0,0,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,3,3}, - {0,0,0,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,3,3}, - {3,3,0,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,0,0}, - {3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,0,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,0,0}, - {3,3,0,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,0,0}, - {3,3,3,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,3,3}, - {3,3,3,3,3,0,0,0,3,3,3,3,3,0,0,0,0,0,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,3,3} - }; - room.RoomArray = table23; - room.AddTextBox("Do you have EVERYTHING?", - 98,278,168); - } - { // Room 24, Directional Token Sensor here - Room room = (Room) rooms.elementAt(24); - int[][] table24 = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,3,3}, - {3,3,3,0,0,0,0,3,3,3,3,3,3,3,0,0,0,0,3,3}, - {3,3,0,0,0,0,0,0,3,3,3,3,3,3,0,0,0,0,3,3}, - {3,3,0,0,0,0,0,0,3,3,3,3,3,3,0,0,0,0,3,3}, - {3,3,0,0,0,0,0,0,3,3,3,3,3,3,0,0,0,0,3,3}, - {3,3,0,0,0,0,0,0,3,3,3,3,3,3,0,0,0,0,3,3}, - {3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table24; - room.AddTextBox("Time to board a 'Bot!", - 170,320,500); - items.addElement(new DirectionalSensor(3*28+14,4*32,room,new Token(0,0,null))); - } - { // Room 25, Sewer Grate Top - Room room = (Room) rooms.elementAt(25); - int[][] table25 = { - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {4,0,0,0,4,0,0,0,0,0,4,0,0,4,0,0,4,0,0,4}, - {4,0,0,0,4,0,0,0,0,0,4,0,0,4,0,0,4,0,0,4}, - {4,0,0,0,4,0,0,4,0,0,4,0,0,4,0,0,4,0,0,0}, - {4,0,0,0,4,0,0,4,0,0,4,0,0,4,0,0,4,0,0,0}, - {0,0,0,0,4,0,0,4,0,0,4,0,0,4,0,0,4,0,0,0}, - {0,0,0,0,4,0,0,4,0,0,4,0,0,4,0,0,4,0,0,4}, - {0,0,0,0,4,0,0,4,0,0,0,0,0,4,0,0,4,0,0,4}, - {0,0,0,0,4,0,0,4,0,0,0,0,0,4,0,0,4,0,0,4}, - {4,0,0,0,4,0,0,4,0,0,4,0,0,4,0,0,0,0,0,4}, - {4,0,0,0,4,0,0,4,0,0,4,0,0,4,0,0,0,0,0,4}, - {4,0,0,0,4,0,0,4,0,0,4,0,0,4,0,0,4,0,0,4} - }; - room.RoomArray = table25; - room.AddTextBox("SEWER GRATE", - 182,48,90); - items.addElement(new Sentry3(2*28,64, room)); - } - { // Room 26, Sewer Grate Bottom - Room room = (Room) rooms.elementAt(26); - int[][] table26 = { - {4,0,0,0,4,0,0,4,0,0,4,0,0,4,0,0,4,0,0,4}, - {4,0,0,0,0,0,0,4,0,0,4,0,0,4,0,0,4,0,0,4}, - {4,0,0,0,0,0,0,4,4,4,4,0,0,0,0,0,4,4,4,4}, - {4,4,4,4,4,0,0,4,0,0,4,0,0,0,0,0,4,0,0,4}, - {4,0,0,0,4,0,0,4,0,0,4,4,4,4,4,4,4,0,0,4}, - {4,0,0,0,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,4,4,4,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,4,4,4,0,0,4,4,0,0,4}, - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4} - }; - room.RoomArray = table26; - String[] i3 = {"0064.jpg","0065.jpg"}; - room.graphix.addElement(new Graphix(i3, 5*28,10*32)); - String[] i4 = {"0066.jpg","0067.jpg"}; - room.graphix.addElement(new Graphix(i4, 11*28,8*32)); - String[] i5 = {"0068.jpg","0069.jpg"}; - room.graphix.addElement(new Graphix(i5, 16*28,9*32)); - room.AddTextBox("These poor creatures never made it out...Will you???", - 84,224,500); - } - { // Room 27, 2nd Lock - Room room = (Room) rooms.elementAt(27); - int[][] table27 = { - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {4,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0}, - {4,4,4,4,4,4,0,0,0,0,0,0,0,5,4,0,0,0,0,0}, - {4,0,0,0,0,4,4,4,4,4,4,0,0,4,4,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,4,4,4,4,4,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4} - }; - room.RoomArray = table27; - room.AddTextBox("Congratulations!", - 2*28,304,500); - room.AddTextBox("That was a great job!", - 2*28,320,500); - } - { // Room 28, Portal Chamber - Room room = (Room) rooms.elementAt(28); - int[][] table28 = { - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {4,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4} - }; - room.RoomArray = table28; - room.AddTextBox("Prepare for an experience that will transport you to another dimension", - 336,48,224); - room.AddTextBox("You CAN take it with you (If you hold on tight)....", - 336,256,224); - } - { // Room 29, Help Screen - Room room = (Room) rooms.elementAt(29); - int[][] table29 = { - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6} - }; - room.RoomArray = table29; - room.AddTextBox("Escape from the City Sewer!", - 3*28,2*32,500); - room.AddTextBox("HINTS:", - 2*28,3*32,500); - room.AddTextBox("Observe how the robots move. Each is pre-wired to help you.", - 2*28,4*32,500); - room.AddTextBox("Robots go where humans dare not tread.", - 2*28,6*32,500); - room.AddTextBox("The key to success lies within.", - 2*28,7*32,500); - room.AddTextBox("Black crystals foil Ampire Bots.", - 2*28,8*32,500); - room.AddTextBox("Chip 1 is \"COUNT-TO-N\" Chip 2 is \"WALLHUGGER\"", - 2*28,9*32,400); - room.AddTextBox("(To continue, press RETURN.)", - 3*28,11*32,500); - } + materials.addElement(new Material(true, false)); // 0= Blank + materials.addElement(new Material(new Color(190, 190, 255), false, true)); // 1= Light Blue Wall + int[][] lockProgram1 = { + {Lock.NARROW}, + {4, 9, 0, 4, 6, 1}, + {4, 8, 0, 4, 5, 1}, + {Lock.NARROW}, + {4, 8, 1, 4, 5, 0}, + {4, 9, 1, 4, 6, 0}, + }; + materials.addElement(new Lock(Color.blue, Color.blue, lockProgram1)); // 2= Lock 1 + materials.addElement(new Material(new Color(0, 0, 128), false, true)); // 3= Dark Blue Wall + materials.addElement(new BlueWall()); // 4= Blue Wall + int[][] lockProgram2 = { + {Lock.NARROW}, + {5, 1, 0, 5, 2, 0, 5, 3, 0, 6, 1, 4, 6, 2, 4, 6, 3, 4}, + {6, 1, 0, 6, 2, 0, 6, 3, 0, 7, 1, 4, 7, 2, 4, 7, 3, 4}, + {7, 1, 0, 7, 2, 0, 7, 3, 0, 8, 1, 4, 8, 2, 4, 8, 3, 4}, + {8, 1, 0, 8, 2, 0, 8, 3, 0, 9, 1, 4, 9, 2, 4, 9, 3, 4}, + {9, 1, 0, 9, 2, 0, 9, 3, 0, 10, 1, 4, 10, 2, 4, 10, 3, 4}, + {10, 1, 0, 10, 2, 0, 10, 3, 0, 11, 1, 4, 11, 2, 4, 11, 3, 4}, + {11, 1, 0, 11, 2, 0, 11, 3, 0, 12, 1, 4, 12, 2, 4, 12, 3, 4}, + {12, 1, 0, 12, 2, 0, 12, 3, 0, 13, 1, 4, 13, 2, 4, 13, 3, 4}, + {13, 1, 0, 13, 2, 0, 13, 3, 0, 14, 1, 4, 14, 2, 4, 14, 3, 4}, + {14, 1, 0, 14, 2, 0, 14, 3, 0, 15, 1, 4, 15, 2, 4, 15, 3, 4}, + {15, 1, 0, 15, 2, 0, 15, 3, 0, 16, 1, 4, 16, 2, 4, 16, 3, 4}, + {16, 1, 0, 16, 2, 0, 16, 3, 0, 17, 1, 4, 17, 2, 4, 17, 3, 4}, + {17, 1, 0, 17, 2, 0, 17, 3, 0, 18, 1, 4, 18, 2, 4, 18, 3, 4}, + {Lock.NARROW}, + {17, 1, 4, 17, 2, 4, 17, 3, 4, 18, 1, 0, 18, 2, 0, 18, 3, 0}, + {16, 1, 4, 16, 2, 4, 16, 3, 4, 17, 1, 0, 17, 2, 0, 17, 3, 0}, + {15, 1, 4, 15, 2, 4, 15, 3, 4, 16, 1, 0, 16, 2, 0, 16, 3, 0}, + {14, 1, 4, 14, 2, 4, 14, 3, 4, 15, 1, 0, 15, 2, 0, 15, 3, 0}, + {13, 1, 4, 13, 2, 4, 13, 3, 4, 14, 1, 0, 14, 2, 0, 14, 3, 0}, + {12, 1, 4, 12, 2, 4, 12, 3, 4, 13, 1, 0, 13, 2, 0, 13, 3, 0}, + {11, 1, 4, 11, 2, 4, 11, 3, 4, 12, 1, 0, 12, 2, 0, 12, 3, 0}, + {10, 1, 4, 10, 2, 4, 10, 3, 4, 11, 1, 0, 11, 2, 0, 11, 3, 0}, + {9, 1, 4, 9, 2, 4, 9, 3, 4, 10, 1, 0, 10, 2, 0, 10, 3, 0}, + {8, 1, 4, 8, 2, 4, 8, 3, 4, 9, 1, 0, 9, 2, 0, 9, 3, 0}, + {7, 1, 4, 7, 2, 4, 7, 3, 4, 8, 1, 0, 8, 2, 0, 8, 3, 0}, + {6, 1, 4, 6, 2, 4, 6, 3, 4, 7, 1, 0, 7, 2, 0, 7, 3, 0}, + {5, 1, 4, 5, 2, 4, 5, 3, 4, 6, 1, 0, 6, 2, 0, 6, 3, 0} + }; + materials.addElement(new Lock(Color.blue, Color.blue, lockProgram2)); // 5= Lock2 + materials.addElement(new Material(new Color(0, 255, 0), false, true)); // 6= Green Wall + materials.addElement(new Portal("RO2.lvl", true, true)); // 7= Portal to Level 2 + materials.addElement(new LockS1()); //8=Secret Lock - { // Room 30, Secret Trash-flow - Room room = (Room) rooms.elementAt(30); - int[][] table= { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,0,0,0,0,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,0,0,0,0,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,0,0,0,0,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,0,0,0,0,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - } - { // Room 31, Secret room - Room room = (Room) rooms.elementAt(31); - int[][] table= { - {3,3,3,3,3,3,3,3,0,0,0,0,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("Hi! I'm the Secret Helper. Congratulations on finding Secret #1 (and #2... wink wink!)", - 3*28,2*32,450); - room.AddTextBox("Look at this... Somebody threw out a perfectly good suitcase. I wonder what's inside it?", - 3*28,9*32,450); - String[] helperlist = { - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper1.gif","helper4.gif","helper2.gif","helper3.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper5.gif","helper5.gif","helper5.gif","helper5.gif", - }; - Graphix helper = new Graphix(helperlist, 4*28, 5*32); - room.graphix.addElement(helper); - Item sc = new Suitcase(14*28,5*32,room); - items.addElement(sc); - items.addElement(new Key(2*28,5*32,sc.InternalRoom,Color.green)); - } + for (int a = 0; a < 32; a++) { + rooms.addElement(new Room()); + } - - int[] roomlist1 = {0,1,2,12,13,14,23,25,27,28}; - LinkRoomsHorizontally(roomlist1); - - int[] roomlist2 = {2,3,4,5,6,7,8,9,10,11}; - LinkRoomsVertically(roomlist2); - - int[] roomlist3 = {3,5,7,9}; - LinkRoomsHorizontally(roomlist3); - - int[] roomlist4 = {4,6,8,10,18,17,16,22}; - LinkRoomsHorizontally(roomlist4); - - LinkRoomsUpDown(14,15); - LinkRoomsUpDown(15,16); - - LinkRoomsUpDown(19,18); - - LinkRoomsLeftRight(19,20); - LinkRoomsLeftRight(20,15); - - LinkRoomsUpDown(17,21); - - LinkRoomsUpDown(23,24); - - LinkRoomsUpDown(25,26); - - LinkRoomsUpDown(30,31); - - - for (int a=0; a<14; a++) - { - int speed = (random.nextInt(5)+1)*2; - Graphix grx = new Graphix("junk"+a+".jpg", - 19*28, - random.nextInt(3*32)+4*32, - Graphix.CYCLE, - -speed, 0, 20*32/speed - ); - int t = random.nextInt(20*32/speed); - grx.x-=speed*t; - grx.count=t; - ((Room) rooms.elementAt(11)).graphix.addElement(grx); - } - - gameCursor = new GameCursor(252,288,(Room) rooms.elementAt(0)); - solderingPen = new SolderingPen(); - remote = new Remote(); - helpCam = new HelpCam( (Room) rooms.elementAt(29)); - - items.addElement(gameCursor); - - SmallChip sc = new SmallChip(0,0,null,"1"); - sc.LoadChip("chips/CountToN.chip"); - items.addElement(sc); - items.addElement(new RO1Init()); - - items.addElement(solderingPen); - items.addElement(remote); - items.addElement(helpCam); - player = gameCursor; - currentViewer = player; - items.addElement(new BlackCrystal(2*28,7*32, (Room) rooms.elementAt(3))); - - } + { // Room 0, Entry point + Room room = rooms.elementAt(0); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialFill(19, 8, 19, 10, 0); + room.AddTextBox("Welcome Traveller!", 150, 64, 400); + room.AddTextBox("You have fallen into the under- ground city of Robotropolis. To escape, travel upward through all five levels of the city." + , 60, 100, 400); + room.AddTextBox("The three robots in the next room will help you on your journey. To learn how they work, choose Robot Anatomy from the menu." + , 60, 200, 400); + room.AddTextBox("This way to Robotropolis", 360, 290, 200); + room.AddArrow(559, 11 * 28 + 16, Arrow.DIR_RIGHT, 100, Color.white); + } + { // Room 1, Robots Here + Room room = rooms.elementAt(1); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + items.addElement(new BlueRobot(6 * 28, 5 * 32, room)); + { + Item robot = items.lastElement(); + BlueRobot brobot = (BlueRobot) robot; + brobot.thrusterPower = true; + RoomSensor rSensor = new RoomSensor(8 * 28, 4 * 32 + 16, brobot.InternalRoom, + new Key(0, 0, null, Color.white)); + items.addElement(rSensor); + rSensor.rotate(1); + rSensor.rotate(1); + NOTGate ng = new NOTGate(5 * 28, 3 * 32, brobot.InternalRoom); + items.addElement(ng); + FlipFlop ff = new FlipFlop(9 * 28, 6 * 32, brobot.InternalRoom); + items.addElement(ff); + Wire dummy; + dummy = new Wire(rSensor.ports[0], ng.ports[0]); + dummy = new Wire(ng.ports[1], brobot.devices[9].ports[0]); + dummy = new Wire(ff.ports[0], brobot.devices[5].ports[0]); + dummy = new Wire(ff.ports[1], brobot.devices[7].ports[0]); + dummy = new Wire(ff.ports[2], brobot.devices[1].ports[0]); + dummy = new Wire(ff.ports[3], brobot.devices[3].ports[0]); + } + + items.addElement(new WhiteRobot(8 * 28, 3 * 32, room)); + { + Item robot = items.lastElement(); + WhiteRobot wrobot = (WhiteRobot) robot; + wrobot.thrusterPower = true; + + RoomSensor rSensor = new RoomSensor(4 * 28, 4 * 32, wrobot.InternalRoom, + new Crystal(0, 0, null, 0)); + items.addElement(rSensor); + rSensor.rotate(1); + rSensor.rotate(1); + NOTGate ng = new NOTGate(5 * 28, 7 * 32, wrobot.InternalRoom); + items.addElement(ng); + ng.rotate(1); + ng.rotate(1); + ng.rotate(1); + FlipFlop ff = new FlipFlop(8 * 28, 6 * 32, wrobot.InternalRoom); + items.addElement(ff); + ANDGate ag1 = new ANDGate(9 * 28, 2 * 32, wrobot.InternalRoom); + items.addElement(ag1); + ANDGate ag2 = new ANDGate(12 * 28, 8 * 32, wrobot.InternalRoom); + items.addElement(ag2); + ag2.rotate(1); + ag2.rotate(1); + Node node = new Node(15 * 28, 7 * 32, wrobot.InternalRoom, Node.TYPE_THREE); + items.addElement(node); + node.rotate(1); + node.rotate(1); + + Wire dummy; + dummy = new Wire(rSensor.ports[0], wrobot.devices[8].ports[0]); + dummy = new Wire(node.ports[0], wrobot.devices[5].ports[0]); + dummy = new Wire(node.ports[1], ag2.ports[0]); + dummy = new Wire(node.ports[2], ng.ports[0]); + dummy = new Wire(node.ports[3], ag1.ports[1]); + dummy = new Wire(ag1.ports[2], wrobot.devices[0].ports[0]); + dummy = new Wire(ag2.ports[2], wrobot.devices[2].ports[0]); + dummy = new Wire(ng.ports[1], wrobot.devices[3].ports[0]); + dummy = new Wire(ff.ports[0], wrobot.devices[4].ports[0]); + dummy = new Wire(ff.ports[1], wrobot.devices[6].ports[0]); + dummy = new Wire(ff.ports[2], ag1.ports[0]); + dummy = new Wire(ff.ports[3], ag2.ports[1]); + } + + items.addElement(new OrangeRobot(14 * 28, 9 * 32, room)); + { + Item robot = items.lastElement(); + OrangeRobot orobot = (OrangeRobot) robot; + orobot.thrusterPower = true; + + RoomSensor rSensor = new RoomSensor(8 * 28, 4 * 32 + 16, orobot.InternalRoom, + new Key(0, 0, null, Color.white)); + items.addElement(rSensor); + rSensor.rotate(1); + rSensor.rotate(1); + NOTGate ng = new NOTGate(5 * 28, 3 * 32, orobot.InternalRoom); + items.addElement(ng); + SmallChip sc = new SmallChip(10 * 28, 6 * 32, orobot.InternalRoom, "2"); + items.addElement(sc); + sc.LoadChip("chips/WallHugger.chip"); + Wire dummy; + dummy = new Wire(rSensor.ports[0], ng.ports[0]); + dummy = new Wire(ng.ports[1], orobot.devices[9].ports[0]); // Antenna + dummy = new Wire(sc.ports[0], orobot.devices[0].ports[0]); // Top Thruster + dummy = new Wire(sc.ports[1], orobot.devices[7].ports[0]); // Left Bumper + dummy = new Wire(sc.ports[2], orobot.devices[3].ports[0]); // Left Thruster + dummy = new Wire(sc.ports[3], orobot.devices[6].ports[0]); // Bottom Bumper + dummy = new Wire(sc.ports[4], orobot.devices[2].ports[0]); // Bottom Thruster + dummy = new Wire(sc.ports[5], orobot.devices[5].ports[0]); // Right Bumper + dummy = new Wire(sc.ports[6], orobot.devices[1].ports[0]); // Right Thruster + dummy = new Wire(sc.ports[7], orobot.devices[4].ports[0]); // Top Bumper + } + items.addElement(new Key(8 * 28, 8 * 32, room, Color.blue)); + } + { // Room 2, Sewer Door + Room room = rooms.elementAt(2); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}, + {0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1} + }; + room.AddTextBox("{BIG} The City Sewer", 40, 80, 500); + items.addElement(new Sweeper(476, 224, room)); + } + { // Room 3, Maze 1 "PR" + Room room = rooms.elementAt(3); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}, + {1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}, + {1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1} + }; + String[] i1 = {"0073.jpg", "0074.jpg"}; + room.graphix.addElement(new Graphix(i1, 4 * 28 + 14, 5 * 32)); + } + { // Room 4, Maze 2 "CG" + Room room = rooms.elementAt(4); + room.RoomArray = new int[][]{ + {1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1}, + {1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + String[] i6 = {"0075.jpg", "0076.jpg", "0077.jpg", "0076.jpg"}; + room.graphix.addElement(new Graphix(i6, 13 * 28, 4 * 32, + Graphix.BOUNCE, 0, 2, 3 * 16)); + } + { // Room 5, Maze 3 "PC" + Room room = rooms.elementAt(5); + room.RoomArray = new int[][]{ + {1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1}, + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1} + }; + } + { // Room 6, Maze 4 "RC" + Room room = rooms.elementAt(6); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1}, + {1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1} + }; + String[] i7 = {"0082.jpg", "0083.jpg", "0084.jpg", "0085.jpg", "0084.jpg", "0083.jpg", "0082.jpg"}; + room.graphix.addElement(new Graphix(i7, 12 * 28, 4 * 32, + Graphix.BOUNCE, 0, 2, 3 * 16)); + } + { // Room 7, Maze 5 "MW" + Room room = rooms.elementAt(7); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1}, + {0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1}, + {1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1}, + {1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1}, + {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1}, + {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} + }; + String[] i2 = {"0086.jpg", "0087.jpg"}; + room.graphix.addElement(new Graphix(i2, 5 * 28, 2 * 32)); + } + { // Room 8, Maze 6 "CIG" + Room room = rooms.elementAt(8); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1}, + {0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0}, + {1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0}, + {1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1} + }; + } + { // Room 9, Maze 7 "NH" + Room room = rooms.elementAt(9); + room.RoomArray = new int[][]{ + {1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1}, + {1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + } + { // Room 10, Maze 8 "SG" + Room room = rooms.elementAt(10); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} + }; + String[] i8 = {"0078.jpg", "0079.jpg", "0080.jpg", "0081.jpg"}; + room.graphix.addElement(new Graphix(i8, 13 * 28, 10 * 32, + Graphix.BOUNCE, 2, 0, 5 * 14)); + } + { // Room 11, Maze Bottom + Room room = rooms.elementAt(11); + room.RoomArray = new int[][]{ + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 8, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + items.addElement(new ContactSensor(9 * 28, 2 * 32, room, new Token(0, 0, null))); + } + { // Room 12, Top Corridor 1 + Room room = rooms.elementAt(12); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + } + { // Room 13, Top Corridor 2 + Room room = rooms.elementAt(13); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + } + { // Room 14, Top Corridor Branch + Room room = rooms.elementAt(14); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3} + }; + } + { // Room 15, Hallway Top Right + Room room = rooms.elementAt(15); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3} + }; + } + { // Room 16, Hallway Bottom Right + Room room = rooms.elementAt(16); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + } + { // Room 17, Hallway Bottom + Room room = rooms.elementAt(17); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3} + }; + items.addElement(new AmpireBot(10 * 28, 3 * 32, room)); + } + { // Room 18, Hallway Bottom Left + Room room = rooms.elementAt(18); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + } + { // Room 19, Hallway Top Left + Room room = rooms.elementAt(19); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3} + }; + } + { // Room 20, Hallway Top + Room room = rooms.elementAt(20); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + } + { // Room 21, WallHugger Puzzle + Room room = rooms.elementAt(21); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + items.addElement(new Magnet(10 * 28, 9 * 32, room)); + int[] pace = {3 * 28, 120, 16 * 28, 120}; + int[] protect = {0, 3 * 32, 19 * 28, 11 * 32, 10 * 28, 0}; + items.addElement(new Sentry(3 * 28, 120, room, pace, protect, false)); + } + { // Room 22, Bouncer Puzzle + Room room = rooms.elementAt(22); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + items.addElement(new Crystal(16 * 28, 5 * 32, room, 100000)); + int[] pace = {3 * 28, 94, 3 * 28, 302}; + int[] protect = {4 * 28, 0, 19 * 28, 11 * 32, 0, 5 * 32}; + items.addElement(new Sentry(3 * 28, 94, room, pace, protect, false)); + } + { // Room 23, AnteChamber + Room room = rooms.elementAt(23); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3} + }; + room.AddTextBox("Do you have EVERYTHING?", + 98, 278, 168); + } + { // Room 24, Directional Token Sensor here + Room room = rooms.elementAt(24); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3}, + {3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("Time to board a 'Bot!", + 170, 320, 500); + items.addElement(new DirectionalSensor(3 * 28 + 14, 4 * 32, room, new Token(0, 0, null))); + } + { // Room 25, Sewer Grate Top + Room room = rooms.elementAt(25); + room.RoomArray = new int[][]{ + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4}, + {4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4}, + {4, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 0}, + {4, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4}, + {0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4}, + {0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4}, + {4, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4} + }; + room.AddTextBox("SEWER GRATE", + 182, 48, 90); + items.addElement(new Sentry3(2 * 28, 64, room)); + } + { // Room 26, Sewer Grate Bottom + Room room = rooms.elementAt(26); + room.RoomArray = new int[][]{ + {4, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 4, 4, 4, 4}, + {4, 4, 4, 4, 4, 0, 0, 4, 0, 0, 4, 0, 0, 0, 0, 0, 4, 0, 0, 4}, + {4, 0, 0, 0, 4, 0, 0, 4, 0, 0, 4, 4, 4, 4, 4, 4, 4, 0, 0, 4}, + {4, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 0, 0, 4, 4, 0, 0, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} + }; + String[] i3 = {"0064.jpg", "0065.jpg"}; + room.graphix.addElement(new Graphix(i3, 5 * 28, 10 * 32)); + String[] i4 = {"0066.jpg", "0067.jpg"}; + room.graphix.addElement(new Graphix(i4, 11 * 28, 8 * 32)); + String[] i5 = {"0068.jpg", "0069.jpg"}; + room.graphix.addElement(new Graphix(i5, 16 * 28, 9 * 32)); + room.AddTextBox("These poor creatures never made it out...Will you???", + 84, 224, 500); + } + { // Room 27, 2nd Lock + Room room = rooms.elementAt(27); + room.RoomArray = new int[][]{ + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0}, + {4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 5, 4, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 0, 0, 4, 4, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} + }; + room.AddTextBox("Congratulations!", + 2 * 28, 304, 500); + room.AddTextBox("That was a great job!", + 2 * 28, 320, 500); + } + { // Room 28, Portal Chamber + Room room = rooms.elementAt(28); + room.RoomArray = new int[][]{ + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} + }; + room.AddTextBox("Prepare for an experience that will transport you to another dimension", + 336, 48, 224); + room.AddTextBox("You CAN take it with you (If you hold on tight)....", + 336, 256, 224); + } + { // Room 29, Help Screen + Room room = rooms.elementAt(29); + room.RoomArray = new int[][]{ + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6} + }; + room.AddTextBox("Escape from the City Sewer!", + 3 * 28, 2 * 32, 500); + room.AddTextBox("HINTS:", + 2 * 28, 3 * 32, 500); + room.AddTextBox("Observe how the robots move. Each is pre-wired to help you.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("Robots go where humans dare not tread.", + 2 * 28, 6 * 32, 500); + room.AddTextBox("The key to success lies within.", + 2 * 28, 7 * 32, 500); + room.AddTextBox("Black crystals foil Ampire Bots.", + 2 * 28, 8 * 32, 500); + room.AddTextBox("Chip 1 is \"COUNT-TO-N\" Chip 2 is \"WALLHUGGER\"", + 2 * 28, 9 * 32, 400); + room.AddTextBox("(To continue, press RETURN.)", + 3 * 28, 11 * 32, 500); + } + + { // Room 30, Secret Trash-flow + Room room = rooms.elementAt(30); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3} + }; + } + { // Room 31, Secret room + Room room = rooms.elementAt(31); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("Hi! I'm the Secret Helper. Congratulations on finding Secret #1 (and #2... wink wink!)", + 3 * 28, 2 * 32, 450); + room.AddTextBox("Look at this... Somebody threw out a perfectly good suitcase. I wonder what's inside it?", + 3 * 28, 9 * 32, 450); + String[] helperlist = { + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper1.gif", "helper4.gif", "helper2.gif", "helper3.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper5.gif", "helper5.gif", "helper5.gif", "helper5.gif", + }; + Graphix helper = new Graphix(helperlist, 4 * 28, 5 * 32); + room.graphix.addElement(helper); + Item sc = new Suitcase(14 * 28, 5 * 32, room); + items.addElement(sc); + items.addElement(new Key(2 * 28, 5 * 32, sc.InternalRoom, Color.green)); + } + + + int[] roomlist1 = {0, 1, 2, 12, 13, 14, 23, 25, 27, 28}; + LinkRoomsHorizontally(roomlist1); + + int[] roomlist2 = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + LinkRoomsVertically(roomlist2); + + int[] roomlist3 = {3, 5, 7, 9}; + LinkRoomsHorizontally(roomlist3); + + int[] roomlist4 = {4, 6, 8, 10, 18, 17, 16, 22}; + LinkRoomsHorizontally(roomlist4); + + LinkRoomsUpDown(14, 15); + LinkRoomsUpDown(15, 16); + + LinkRoomsUpDown(19, 18); + + LinkRoomsLeftRight(19, 20); + LinkRoomsLeftRight(20, 15); + + LinkRoomsUpDown(17, 21); + + LinkRoomsUpDown(23, 24); + + LinkRoomsUpDown(25, 26); + + LinkRoomsUpDown(30, 31); + + + for (int a = 0; a < 14; a++) { + int speed = (random.nextInt(5) + 1) * 2; + Graphix grx = new Graphix("junk" + a + ".jpg", + 19 * 28, + random.nextInt(3 * 32) + 4 * 32, + Graphix.CYCLE, + -speed, 0, 20 * 32 / speed + ); + int t = random.nextInt(20 * 32 / speed); + grx.x -= speed * t; + grx.count = t; + rooms.elementAt(11).graphix.addElement(grx); + } + + gameCursor = new GameCursor(252, 288, rooms.elementAt(0)); + solderingPen = new SolderingPen(); + remote = new Remote(); + helpCam = new HelpCam(rooms.elementAt(29)); + + items.addElement(gameCursor); + + SmallChip sc = new SmallChip(0, 0, null, "1"); + sc.LoadChip("chips/CountToN.chip"); + items.addElement(sc); + items.addElement(new RO1Init()); + + items.addElement(solderingPen); + items.addElement(remote); + items.addElement(helpCam); + player = gameCursor; + currentViewer = player; + items.addElement(new BlackCrystal(2 * 28, 7 * 32, rooms.elementAt(3))); + + } } -class RO1Init extends Initializer -{ -public void Init() - { - // The Magnet and the Energy Crystal go into (one or the other) - // X=10*28, Y=9*32, Room=21 - // X=16*28, Y=5*32, Room-22 - Item magnet = level.FindItem("Magnet"); - Item crystal = level.FindItem(".Crystal"); - if (level.random.nextInt(2)==1) - { - magnet.x=10*28; - magnet.y=9*32; - magnet.room=(Room) level.rooms.elementAt(21); - crystal.x=16*28; - crystal.y=5*32; - crystal.room=(Room) level.rooms.elementAt(22); - } - else - { - crystal.x=10*28; - crystal.y=9*32; - crystal.room=(Room) level.rooms.elementAt(21); - magnet.x=16*28; - magnet.y=5*32; - magnet.room=(Room) level.rooms.elementAt(22); - } - - // The Blue Key goes inside one of the Robots. - Item robot1 = level.FindItem("BlueRobot"); - Item robot2 = level.FindItem("WhiteRobot"); - Item robot3 = level.FindItem("OrangeRobot"); - Item key = level.FindItem("Key"); - switch (level.random.nextInt(3)) - { - case 0: key.room = robot1.InternalRoom; break; - case 1: key.room = robot2.InternalRoom; break; - case 2: key.room = robot3.InternalRoom; break; - } - - // The Black Crystal and Chip 1 go somewhere in the Maze - // Room=3, 2,7 - // Room=4 4,1 - // Room=5 1,18 - // Room=6 6,6 - // Room=7 4,4 - // Room=8 16,5 - // Room=9 4,3 - // Room=10 6,8 - - Item bcrystal = level.FindItem("BlackCrystal"); - switch (level.random.nextInt(8)) - { - case 0: bcrystal.x = 2*28; bcrystal.y = 7*32; - bcrystal.room = (Room) level.rooms.elementAt(3); break; - case 1: bcrystal.x = 4*28; bcrystal.y = 1*32; - bcrystal.room = (Room) level.rooms.elementAt(4); break; - case 2: bcrystal.x = 14*28; bcrystal.y = 4*32; - bcrystal.room = (Room) level.rooms.elementAt(5); break; - case 3: bcrystal.x = 6*28; bcrystal.y = 6*32; - bcrystal.room = (Room) level.rooms.elementAt(6); break; - case 4: bcrystal.x = 4*28; bcrystal.y = 4*32; - bcrystal.room = (Room) level.rooms.elementAt(7); break; - case 5: bcrystal.x =16*28; bcrystal.y = 5*32; - bcrystal.room = (Room) level.rooms.elementAt(8); break; - case 6: bcrystal.x = 4*28; bcrystal.y = 3*32; - bcrystal.room = (Room) level.rooms.elementAt(9); break; - case 7: bcrystal.x = 6*28; bcrystal.y = 8*32; - bcrystal.room = (Room) level.rooms.elementAt(10); break; - } - - // Room=3 17,10 - // Room=4 5,2 - // Room=5 2,9 - // Room=6 17,9 - // Room=7 8,5 - // Room=8 7,9 - // Room=9 13,7 - // Room=10 5,1 - Item chip=null; - for (int a=0; a< level.items.size(); a++) - { - Item item = (Item) level.items.elementAt(a); - if (item.getClass().toString().endsWith("SmallChip")) - if (((GenericChip)item).label.endsWith("1")) - chip = item; - } - if (chip==null) - return; - switch (level.random.nextInt(8)) - { - case 0: chip.x =17*28; chip.y =10*32; - chip.room = (Room) level.rooms.elementAt(3); break; - case 1: chip.x = 5*28; chip.y = 2*32; - chip.room = (Room) level.rooms.elementAt(4); break; - case 2: chip.x = 2*28; chip.y = 9*32; - chip.room = (Room) level.rooms.elementAt(5); break; - case 3: chip.x =17*28; chip.y = 9*32; - chip.room = (Room) level.rooms.elementAt(6); break; - case 4: chip.x = 8*28; chip.y = 5*32; - chip.room = (Room) level.rooms.elementAt(7); break; - case 5: chip.x = 7*28; chip.y = 9*32; - chip.room = (Room) level.rooms.elementAt(8); break; - case 6: chip.x =13*28; chip.y = 7*32; - chip.room = (Room) level.rooms.elementAt(9); break; - case 7: chip.x = 5*28; chip.y = 1*32; - chip.room = (Room) level.rooms.elementAt(10); break; - } - } +class RO1Init extends Initializer { + public void Init() { + // The Magnet and the Energy Crystal go into (one or the other) + // X=10*28, Y=9*32, Room=21 + // X=16*28, Y=5*32, Room-22 + Item magnet = level.FindItem("Magnet"); + Item crystal = level.FindItem(".Crystal"); + if (level.random.nextInt(2) == 1) { + magnet.x = 10 * 28; + magnet.y = 9 * 32; + magnet.room = level.rooms.elementAt(21); + crystal.x = 16 * 28; + crystal.y = 5 * 32; + crystal.room = level.rooms.elementAt(22); + } + else { + crystal.x = 10 * 28; + crystal.y = 9 * 32; + crystal.room = level.rooms.elementAt(21); + magnet.x = 16 * 28; + magnet.y = 5 * 32; + magnet.room = level.rooms.elementAt(22); + } + + // The Blue Key goes inside one of the Robots. + Item robot1 = level.FindItem("BlueRobot"); + Item robot2 = level.FindItem("WhiteRobot"); + Item robot3 = level.FindItem("OrangeRobot"); + Item key = level.FindItem("Key"); + switch (level.random.nextInt(3)) { + case 0: + key.room = robot1.InternalRoom; + break; + case 1: + key.room = robot2.InternalRoom; + break; + case 2: + key.room = robot3.InternalRoom; + break; + } + + // The Black Crystal and Chip 1 go somewhere in the Maze + // Room=3, 2,7 + // Room=4 4,1 + // Room=5 1,18 + // Room=6 6,6 + // Room=7 4,4 + // Room=8 16,5 + // Room=9 4,3 + // Room=10 6,8 + + Item bcrystal = level.FindItem("BlackCrystal"); + switch (level.random.nextInt(8)) { + case 0: + bcrystal.x = 2 * 28; + bcrystal.y = 7 * 32; + bcrystal.room = level.rooms.elementAt(3); + break; + case 1: + bcrystal.x = 4 * 28; + bcrystal.y = 1 * 32; + bcrystal.room = level.rooms.elementAt(4); + break; + case 2: + bcrystal.x = 14 * 28; + bcrystal.y = 4 * 32; + bcrystal.room = level.rooms.elementAt(5); + break; + case 3: + bcrystal.x = 6 * 28; + bcrystal.y = 6 * 32; + bcrystal.room = level.rooms.elementAt(6); + break; + case 4: + bcrystal.x = 4 * 28; + bcrystal.y = 4 * 32; + bcrystal.room = level.rooms.elementAt(7); + break; + case 5: + bcrystal.x = 16 * 28; + bcrystal.y = 5 * 32; + bcrystal.room = level.rooms.elementAt(8); + break; + case 6: + bcrystal.x = 4 * 28; + bcrystal.y = 3 * 32; + bcrystal.room = level.rooms.elementAt(9); + break; + case 7: + bcrystal.x = 6 * 28; + bcrystal.y = 8 * 32; + bcrystal.room = level.rooms.elementAt(10); + break; + } + + // Room=3 17,10 + // Room=4 5,2 + // Room=5 2,9 + // Room=6 17,9 + // Room=7 8,5 + // Room=8 7,9 + // Room=9 13,7 + // Room=10 5,1 + Item chip = null; + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item.getClass().toString().endsWith("SmallChip")) { + if (((GenericChip) item).label.endsWith("1")) { + chip = item; + } + } + } + if (chip == null) { + return; + } + switch (level.random.nextInt(8)) { + case 0: + chip.x = 17 * 28; + chip.y = 10 * 32; + chip.room = level.rooms.elementAt(3); + break; + case 1: + chip.x = 5 * 28; + chip.y = 2 * 32; + chip.room = level.rooms.elementAt(4); + break; + case 2: + chip.x = 2 * 28; + chip.y = 9 * 32; + chip.room = level.rooms.elementAt(5); + break; + case 3: + chip.x = 17 * 28; + chip.y = 9 * 32; + chip.room = level.rooms.elementAt(6); + break; + case 4: + chip.x = 8 * 28; + chip.y = 5 * 32; + chip.room = level.rooms.elementAt(7); + break; + case 5: + chip.x = 7 * 28; + chip.y = 9 * 32; + chip.room = level.rooms.elementAt(8); + break; + case 6: + chip.x = 13 * 28; + chip.y = 7 * 32; + chip.room = level.rooms.elementAt(9); + break; + case 7: + chip.x = 5 * 28; + chip.y = 1 * 32; + chip.room = level.rooms.elementAt(10); + break; + } + } } \ No newline at end of file diff --git a/src/com/droidquest/levels/RO2.java b/src/com/droidquest/levels/RO2.java index 3c8d6ac..398d43b 100644 --- a/src/com/droidquest/levels/RO2.java +++ b/src/com/droidquest/levels/RO2.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.avatars.GameCursor; @@ -12,986 +10,930 @@ import com.droidquest.decorations.Arrow; import com.droidquest.decorations.Graphix; import com.droidquest.devices.ContactSensor; import com.droidquest.devices.SmallChip; -import com.droidquest.items.Handle; -import com.droidquest.items.Key; -import com.droidquest.items.Polarizer; -import com.droidquest.items.Sentry; -import com.droidquest.items.Token; -import com.droidquest.items.ToolBox; -import com.droidquest.items.Train; -import com.droidquest.items.XitTicket; -import com.droidquest.materials.CoinSlot; -import com.droidquest.materials.CrystalRecharger; -import com.droidquest.materials.Lock; -import com.droidquest.materials.Material; -import com.droidquest.materials.Portal; -import com.droidquest.materials.SecretReset; -import com.droidquest.materials.SecretSet; -import com.droidquest.materials.Switch; -import com.droidquest.materials.Switch1; -import com.droidquest.materials.XitSlot; +import com.droidquest.items.*; +import com.droidquest.materials.*; -class RO2 extends Level -{ -public RO2 (RoomDisplay rd) - { - super(rd); - - materials.addElement(new Material(true, false)); // 0= Empty Space - materials.addElement(new Material(new Color(0,204,0),false, true)); // 1= Green - materials.addElement(new Material(new Color(192,192,255),false,true)); // 2= Lt Blue - materials.addElement(new Material(new Color(255,224,192),false, true)); // 3= Brown - materials.addElement(new Material(new Color(255,128,0),false, true)); // 4= Orange - materials.addElement(new Material(new Color(255,255,255),false, true)); // 5= White - materials.addElement(new Material(new Color(0,0,255),false,true)); // 6= Blue - materials.addElement(new Material(new Color(0,0,128),false, true)); // 7= Dk Blue - materials.addElement(new Material(new Color(63,32,0),false, true)); // 8= Dk Orange - int[][] lockProgram = { - {Lock.NARROW}, - {14,5,0}, - {14,4,0}, - {Lock.REMOVE}, - {14,4,6}, - {14,5,6}}; - materials.addElement(new Lock(Color.blue, Color.blue, lockProgram)); // 9= Lock - materials.addElement(new CoinSlot()); // 10=CoinSlot - materials.addElement(new Switch1()); // 11=Switch1 - int[][] program1 = { - {Switch.WAIT4CONTACT}, - {Switch.SETVALUEHIGH}, - {Switch.REPLACE, 5,10,0, 3,4,0}, - {Switch.REPLACE, 6,10,0, 3,3,0}, - {Switch.REPLACE, 7,10,0, 3,2,0}, - {Switch.WAIT4TIME, 5}, - {Switch.REPLACE, 7,10,2, 3,2,2}, - {Switch.REPLACE, 6,10,2, 3,3,2}, - {Switch.REPLACE, 5,10,2, 3,4,2}, - {Switch.SETVALUELOW} - }; - materials.addElement(new Switch(Switch.ROT_UP, program1)); // 12=Switch2 - materials.addElement(new CrystalRecharger()); // 13=Recharger - int program2[][] = { - {Switch.WAIT4CONTACT}, - {Switch.SETVALUEHIGH}, - {Switch.REPLACE, 16,2,0, 17,2,0}, - {Switch.WAIT4TIME, 5}, - {Switch.REPLACE, 16,2,2, 17,2,2}, - {Switch.SETVALUELOW} - }; - materials.addElement(new Switch(Switch.ROT_UP, program2)); // 14=Switch3 - int program3[][] = { - {Switch.WAIT4CONTACT}, - {Switch.SETVALUEHIGH}, - {Switch.REPLACE, 16,3,0}, - {Switch.REPLACE, 16,2,0}, - {Switch.WAIT4TIME, 5}, - {Switch.REPLACE, 16,2,6}, - {Switch.REPLACE, 16,3,6}, - {Switch.SETVALUELOW} - }; - materials.addElement(new Switch(Switch.ROT_UP, program3)); // 15=Switch4 - - int program4[][] = { - {Switch.WAIT4CONTACT}, - {Switch.SETVALUEHIGH}, - {Switch.REPLACE, 1,4,0}, - {Switch.REPLACE, 2,4,0}, - {Switch.WAIT4TIME, 5}, - {Switch.REPLACE, 2,4,6}, - {Switch.REPLACE, 1,4,6}, - {Switch.SETVALUELOW} - }; - materials.addElement(new Switch(Switch.ROT_UP, program4)); // 16=Switch4 - materials.addElement(new XitSlot()); // 17=XitSlot - materials.addElement(new Portal("RO3.lvl", true, true)); // 18=Portal - materials.addElement(new SecretSet()); // 19=SecretSet - materials.addElement(new SecretReset()); // 20=SecretReset - - int program5[][] = { - {Lock.NARROW}, - {19,5,0, 19,6,0, 18,5,3, 18,6,3}, - {19,4,0, 19,7,0, 18,4,3, 18,7,3}, - {18,3,3, 18,8,3, 18,5,0, 18,6,0}, - {Lock.NARROW}, - {18,3,0, 18,8,0, 18,5,3, 18,6,3}, - {19,4,3, 19,7,3, 18,4,0, 18,7,0}, - {19,5,3, 19,6,3, 18,5,0, 18,6,0}, - }; - materials.addElement(new Lock(Color.blue, Color.blue, program5)); // 21=SecretLock1 - - int program6[][] = { - {Lock.NARROW}, - {17,5,0, 17,6,0}, - {17,4,0, 17,7,0}, - {Lock.NARROW}, - {17,4,3, 17,7,3}, - {17,5,3, 17,6,3}, - }; - materials.addElement(new Lock(Color.green, Color.green, program6)); // 22=SecretLock1 - - for (int a=0; a<41; a++) - rooms.addElement(new Room()); - - { // Room 0: Help Screen - Room room = (Room) rooms.elementAt(0); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table; - room.AddTextBox("Ride the Subway to the Town!",4*28,64, 500); - room.AddTextBox("HINTS:",2*28,3*32, 500); - room.AddTextBox("Find the token to drop into the Turnstyle slot.",2*28,4*32, 500); - room.AddTextBox("Ride the Subway to places that no one has ever dared to go.",2*28,6*32, 500); - room.AddTextBox("Use the Exit Ticket to start the escalators going up, up, up...",2*28,8*32, 500); - room.AddTextBox("Chips 3 & 4 are blank.",2*28,10*32, 500); - room.AddTextBox("(To continue, press RETURN.)",96,350, 500); - } - { // Room 1: Escalator - Room room = (Room) rooms.elementAt(1); - int[][] table = { - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, - {2, 2, 2, 2, 2, 2, 2,17, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2} - }; - room.RoomArray = table; - room.AddTextBox("Insert Exit Ticket",244,10*32, 100); - } - { // Room 2: Secret Room - Room room = (Room) rooms.elementAt(2); - int[][] table = { - {3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 0, 0, 0,21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} - }; - room.RoomArray = table; - room.AddTextBox("Congratulations!!",176,66, 560); - room.AddTextBox("You have reached the Secret Room of Public Knowledge.",2*28,4*32, 500); - room.AddTextBox("Robot Odyssey I is dedicated to Warren Robinett, author of Atari Adventure, Rocky's Boots, and the animation utility underlying Robot Odyssey I.",2*28,6*32, 500); - } +import java.awt.*; - { // Room 3: Laundrobot, Level 1 - Room room = (Room) rooms.elementAt(3); - int[][] table = { - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7} - }; - room.RoomArray = table; - } - { // Room 4: Laundrobot, Level 2 (Two Buttons) - Room room = (Room) rooms.elementAt(4); - int[][] table = { - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0}, - {0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, - {0, 0, 0, 2, 0,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2}, - {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {0,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2} - }; - room.RoomArray = table; - } - { // Room 5: Laundrobot, Level 3 (Sentry & Xit Ticket) - Room room = (Room) rooms.elementAt(5); - int[][] table = { - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,6,6,6,6,6,6,0,0,6,6,6,6,6,6,6,6,6,6,6}, - {0,0,0,0,6,0,0,0,0,6,0,0,0,0,0,6,0,0,0,6}, - {0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6}, - {6,0,0,6,6,6,6,6,6,6,6,6,6,6,6,0,0,0,6,6}, - {6,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,6,6}, - {6,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,6,6}, - {6,0,0,0,6,0,0,0,0,0,0,0,0,6,6,6,6,6,6,6}, - {6,0,0,0,6,0,0,0,0,0,0,0,0,6,6,6,6,6,6,0}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,0,0,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} - }; - room.RoomArray = table; - items.addElement(new XitTicket(15*28,6*32+16,room)); - int[] pace = {11*28,7*32, 13*28,7*32}; - int[] protect = {5*28,2*32,19*28,5*32, 8*28,0, - 4*28,6*32,12*28,10*32, 0,3*32}; - items.addElement(new Sentry(11*28,7*32,room, pace, protect, true)); - } - { // Room 6: Laundrobot Station - Room room = (Room) rooms.elementAt(6); - int[][] table = { - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,8,0,0,0,0,8,8,0,0,0,0,8,0,0,0,8}, - {8,0,0,0,8,0,0,0,8,0,0,8,0,0,0,8,0,0,0,8}, - {8,0,0,0,8,0,0,0,0,0,0,8,0,0,0,8,0,0,0,8}, - {8,0,0,0,8,0,0,0,0,0,8,0,0,0,0,8,0,0,0,8}, - {8,0,0,0,8,0,0,0,0,0,8,0,0,0,0,8,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,8,0,0,0,0,0,8,0,0,0,0,8,0,0,0,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8} - }; - room.RoomArray = table; - room.AddTextBox("Laundrobot Station",6*28,2*32, 300); - } +class RO2 extends Level { + public RO2(RoomDisplay rd) { + super(rd); - { // Room 7: Muse Robotique Station, Level 1 - Room room = (Room) rooms.elementAt(7); - int[][] table = { - {7, 7, 7, 7, 7,19, 7, 7, 7, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 7,20, 7, 0, 0, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} - }; - room.RoomArray = table; - } - { // Room 8: Muse Robotique Station, Level 2 - Room room = (Room) rooms.elementAt(8); - int[][] table = { - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0}, - {2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2}, - {0, 0, 0, 0, 0,20, 0, 0, 0, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2}, - {2, 2, 2, 2, 2,19, 2, 2, 2, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0} - }; - room.RoomArray = table; - } - { // Room 9: Muse Robotique Station, Level 3 - Room room = (Room) rooms.elementAt(9); - int[][] table = { - {6, 6, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0}, - {6,16, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, - {6, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0}, - {6, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0}, - {6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, - {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6} - }; - room.RoomArray = table; - } - { // Room 10: Muse Robotique Station, Level 4 - Room room = (Room) rooms.elementAt(10); - int[][] table = { - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,0,0,0,0,0,0,0,0,8,8,8,8,8}, - {8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8}, - {8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8}, - {8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8}, - {8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8,8,8,8}, - {8,8,0,0,0,0,0,8,8,8,8,8,8,8,8,0,0,0,0,0} - }; - room.RoomArray = table; - room.AddTextBox("Muse Robotique Station",216,178, 200); - } + materials.addElement(new Material(true, false)); // 0= Empty Space + materials.addElement(new Material(new Color(0, 204, 0), false, true)); // 1= Green + materials.addElement(new Material(new Color(192, 192, 255), false, true)); // 2= Lt Blue + materials.addElement(new Material(new Color(255, 224, 192), false, true)); // 3= Brown + materials.addElement(new Material(new Color(255, 128, 0), false, true)); // 4= Orange + materials.addElement(new Material(new Color(255, 255, 255), false, true)); // 5= White + materials.addElement(new Material(new Color(0, 0, 255), false, true)); // 6= Blue + materials.addElement(new Material(new Color(0, 0, 128), false, true)); // 7= Dk Blue + materials.addElement(new Material(new Color(63, 32, 0), false, true)); // 8= Dk Orange + int[][] lockProgram = { + {Lock.NARROW}, + {14, 5, 0}, + {14, 4, 0}, + {Lock.REMOVE}, + {14, 4, 6}, + {14, 5, 6}}; + materials.addElement(new Lock(Color.blue, Color.blue, lockProgram)); // 9= Lock + materials.addElement(new CoinSlot()); // 10=CoinSlot + materials.addElement(new Switch1()); // 11=Switch1 + int[][] program1 = { + {Switch.WAIT4CONTACT}, + {Switch.SETVALUEHIGH}, + {Switch.REPLACE, 5, 10, 0, 3, 4, 0}, + {Switch.REPLACE, 6, 10, 0, 3, 3, 0}, + {Switch.REPLACE, 7, 10, 0, 3, 2, 0}, + {Switch.WAIT4TIME, 5}, + {Switch.REPLACE, 7, 10, 2, 3, 2, 2}, + {Switch.REPLACE, 6, 10, 2, 3, 3, 2}, + {Switch.REPLACE, 5, 10, 2, 3, 4, 2}, + {Switch.SETVALUELOW} + }; + materials.addElement(new Switch(Switch.ROT_UP, program1)); // 12=Switch2 + materials.addElement(new CrystalRecharger()); // 13=Recharger + int program2[][] = { + {Switch.WAIT4CONTACT}, + {Switch.SETVALUEHIGH}, + {Switch.REPLACE, 16, 2, 0, 17, 2, 0}, + {Switch.WAIT4TIME, 5}, + {Switch.REPLACE, 16, 2, 2, 17, 2, 2}, + {Switch.SETVALUELOW} + }; + materials.addElement(new Switch(Switch.ROT_UP, program2)); // 14=Switch3 + int program3[][] = { + {Switch.WAIT4CONTACT}, + {Switch.SETVALUEHIGH}, + {Switch.REPLACE, 16, 3, 0}, + {Switch.REPLACE, 16, 2, 0}, + {Switch.WAIT4TIME, 5}, + {Switch.REPLACE, 16, 2, 6}, + {Switch.REPLACE, 16, 3, 6}, + {Switch.SETVALUELOW} + }; + materials.addElement(new Switch(Switch.ROT_UP, program3)); // 15=Switch4 - { // Room 11: Jack in the Bot Station, Level 1 - Room room = (Room) rooms.elementAt(11); - int[][] table = { - {0,0,0,0,0,7,0,0,7,7,7,0,0,7,7,7,7,0,0,7}, - {0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7} - }; - room.RoomArray = table; - toolbox = new ToolBox(3*28, 7*32, room); - items.addElement(toolbox); - } - { // Room 12: Jack in the Bot Station, Level 2 - Room room = (Room) rooms.elementAt(12); - int[][] table = { - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, - {2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2,14, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2}, - {2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, - {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0}, - {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0}, - {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0}, - {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0}, - {0, 0, 0, 0, 0, 2, 0, 0, 2, 2, 2, 0, 0, 2, 2, 2, 2, 0, 0, 2} - }; - room.RoomArray = table; - room.AddTextBox("Subway token",28,122, 560); - room.AddArrow(0,3*32+16,Arrow.DIR_LEFT,28,Color.white); - } - { // Room 13: Big Magnet - Room room = (Room) rooms.elementAt(13); - int[][] table = { - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6}, - {0,0,0,0,0,0,0,0,6,6,6,0,6,0,0,0,0,0,6,6}, - {0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,6,6,6,0,6,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6} - }; - room.RoomArray = table; - items.addElement(new SmallChip(13*28+14, 5*32+16, room, "4")); - } - { // Room 14: Jack in the Bot Station - Room room = (Room) rooms.elementAt(14); - int[][] table = { - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8} - }; - room.RoomArray = table; - room.AddTextBox("Jack in the 'Bot Station",160,178, 300); - } + int program4[][] = { + {Switch.WAIT4CONTACT}, + {Switch.SETVALUEHIGH}, + {Switch.REPLACE, 1, 4, 0}, + {Switch.REPLACE, 2, 4, 0}, + {Switch.WAIT4TIME, 5}, + {Switch.REPLACE, 2, 4, 6}, + {Switch.REPLACE, 1, 4, 6}, + {Switch.SETVALUELOW} + }; + materials.addElement(new Switch(Switch.ROT_UP, program4)); // 16=Switch4 + materials.addElement(new XitSlot()); // 17=XitSlot + materials.addElement(new Portal("RO3.lvl", true, true)); // 18=Portal + materials.addElement(new SecretSet()); // 19=SecretSet + materials.addElement(new SecretReset()); // 20=SecretReset - { // Room 15: Game starts here - Room room = (Room) rooms.elementAt(15); - int[][] table = { - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,7,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,7,7}, - {0,0,0,0,0,0,0,0,0,0,7,7,7,7,7,0,0,0,7,7}, - {0,0,0,0,0,0,0,0,0,0,7,7,7,7,7,0,0,0,7,7}, - {7,7,7,0,0,0,0,0,0,0,7,7,7,7,7,0,0,0,7,7}, - {7,7,7,0,0,0,0,0,0,0,7,7,7,7,7,0,0,0,0,0}, - {7,7,7,0,0,0,0,0,0,0,7,7,7,7,7,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7} - }; - room.RoomArray = table; - } - { // Room 16: Seer's and Robot Station, Level 2 - Room room = (Room) rooms.elementAt(16); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,2,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,2,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0}, - {2,2,2,2,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0}, - {2,2,2,2,2,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2}, - {2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} - }; - room.RoomArray = table; - } - { // Room 17: Token first here - Room room = (Room) rooms.elementAt(17); - int[][] table = { - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,9,6,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,6,0}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,0,0,6,0} - }; - room.RoomArray = table; - items.addElement(new Token(6*28, 8*32, room)); - int[] pace={3*28,2*32, 12*28,7*32}; - int[] protect={0,0,18*28,9*32-2,15*28,10*32}; - items.addElement(new Sentry(2*28, 2*32, room, pace, protect, true)); - } - { // Room 18: Seer's and Robot Station - Room room = (Room) rooms.elementAt(18); - int[][] table = { - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,0,0,0,0,0,0,0,8,8,8,8,8,8,8}, - {8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,8,8,8,8,8}, - {8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8,8}, - {8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8} - }; - room.RoomArray = table; - room.AddTextBox("Seer's and Robot Station",164,178, 300); - } + int program5[][] = { + {Lock.NARROW}, + {19, 5, 0, 19, 6, 0, 18, 5, 3, 18, 6, 3}, + {19, 4, 0, 19, 7, 0, 18, 4, 3, 18, 7, 3}, + {18, 3, 3, 18, 8, 3, 18, 5, 0, 18, 6, 0}, + {Lock.NARROW}, + {18, 3, 0, 18, 8, 0, 18, 5, 3, 18, 6, 3}, + {19, 4, 3, 19, 7, 3, 18, 4, 0, 18, 7, 0}, + {19, 5, 3, 19, 6, 3, 18, 5, 0, 18, 6, 0}, + }; + materials.addElement(new Lock(Color.blue, Color.blue, program5)); // 21=SecretLock1 - { // Room 19: Picadilly Circuit Station, Level 1 - Room room = (Room) rooms.elementAt(19); - int[][] table19 = { - {0,0,0,7,7,7,7,7,7,7,7,7,7,7,0,0,7,7,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,7,7,0,0,7,7,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,7,7,0,0,7,7,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,7,7,0,0,7,7,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,7,7,0,0,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,7,7,0,0,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,7,7,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,7,7,0,0,0,0,0,0}, - {7,7,7,0,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7,7}, - {0,0,7,0,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7,7}, - {0,0,0,7,7,7,7,0,0,0,0,0,7,7,7,7,7,7,7,7}, - {7,0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7} - }; - ((Room) rooms.elementAt(19)).RoomArray = table19; - } - { // Room 20: Picadilly Circuit Station, Level 2 - Room room = (Room) rooms.elementAt(20); - int[][] table = { - {0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2}, - {0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2}, - {0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2}, - {0,0,0,2,0,0,0,0,0,2,2,2,0,0,0,0,2,2,2,2}, - {0,0,0,2,0,0,0,0,0,0,0,2,2,2,0,0,2,2,0,0}, - {0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,2,2,0,0}, - {0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,2,2,0,0}, - {0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0,2,2,0,0} - }; - room.RoomArray = table; - } - { // Room 21: Xit Ticket sensor here - Room room = (Room) rooms.elementAt(21); - int[][] table = { - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,0,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6} - }; - room.RoomArray = table; - items.addElement(new ContactSensor(11*28,2*32,room,new XitTicket(0,0,null))); - } - { // Room 22: Picadilly Circuit Station - Room room = (Room) rooms.elementAt(22); - int[][] table = { - {8,0,0,0,0,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,0,0,0,0,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,0,0,0,0,0,0,0,0,0,8,8,8,8,8,8,8,8,8,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8,8,8,8,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,0,0,8} - }; - room.RoomArray = table; - room.AddTextBox("Picadilly Circuit Station",76,178, 500); - } + int program6[][] = { + {Lock.NARROW}, + {17, 5, 0, 17, 6, 0}, + {17, 4, 0, 17, 7, 0}, + {Lock.NARROW}, + {17, 4, 3, 17, 7, 3}, + {17, 5, 3, 17, 6, 3}, + }; + materials.addElement(new Lock(Color.green, Color.green, program6)); // 22=SecretLock1 - { // Room 23: Cobble Bot Station, Level 1 - Room room = (Room) rooms.elementAt(23); - int[][] table = { - {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0}, - {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0}, - {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0,13, 0, 7, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 7, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 7, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 7, 7}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0}, - {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7} - }; - room.RoomArray = table; - items.addElement(new SmallChip(8*28, 9*32, room, "3")); - } - { // Room 24: Entrance to Token Maze - Room room = (Room) rooms.elementAt(24); - int[][] table = { - {2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,2,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0}, - {2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,2,0,0}, - {0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0}, - {0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0}, - {0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0}, - {2,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,2,0,0}, - {2,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,2,0,0}, - {2,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0}, - {2,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0}, - {2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,2,0,0} - }; - room.RoomArray = table; - } - { // Room 25: Cobble Bot Square Station, Level 3 - Room room = (Room) rooms.elementAt(25); - int[][] table = { - {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0,15, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6}, - {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0}, - {6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0} - }; - room.RoomArray = table; - room.AddTextBox("Restroom",392,198, 560); - room.AddArrow(559,6*32,Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 26: Cobble Bot Square Station - Room room = (Room) rooms.elementAt(26); - int[][] table = { - {8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,8,8,8,8,8}, - {8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,8,8,8,8,8}, - {8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8,8}, - {8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8}, - {8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8}, - {8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8} - }; - room.RoomArray = table; - room.AddTextBox("Cobble 'Bot Square Station",160,178, 250); - } + for (int a = 0; a < 41; a++) { + rooms.addElement(new Room()); + } - { // Room 27: Jack in the Bot Station, Level 1 - Room room = (Room) rooms.elementAt(27); - int[][] table = { - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0}, - {7,7,7,7,7,7,0,0,0,0,0,0,0,0,7,7,7,7,7,7} - }; - room.RoomArray = table; - } - { // Room 28: Token Maze - Room room = (Room) rooms.elementAt(28); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,2}, - {0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,2,0,0,0}, - {2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,2,0,0,0}, - {0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,2,2,2,2,2}, - {0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,2,0,0,0,0}, - {0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,2,0,0,0,0}, - {2,0,0,0,0,2,0,0,0,0,2,0,0,0,0,2,0,0,0,0}, - {2,0,0,0,0,2,0,0,0,0,2,0,0,0,0,2,0,0,0,2}, - {2,0,0,0,2,2,0,0,0,0,2,0,0,0,0,2,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - int[] pace = {11*28,10*32, 14*28,10*32}; - int[] protect = {3*28,0,10*28,11*32,0,5*32, - 10*28,0,16*28,11*32,19*28,6*32}; - items.addElement(new Sentry(0,0,room, pace,protect, true)); - } - { // Room 29: Turnstile, BART - Room room = (Room) rooms.elementAt(29); - int[][] table = { - {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, - {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0}, - {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0}, - {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6}, - {0, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, - {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0, 0, 0}, - {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 6} - }; - room.RoomArray = table; - room.AddTextBox("{BIG} {000,204,000} B {BSP} {SML} {255,255,255} ay {BIG} {000,204,000} A {BSP} {SML} {255,255,255} rea {BIG} {000,204,000} R {BSP} {SML} {255,255,255} obot {BIG} {000,204,000} T {BSP} {SML} {255,255,255} ransport",2*28,58, 560); - room.AddTextBox("Insert token, please.",9*28,9*32, 200); - room.AddArrow(13*28,10*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 30: Jack in the Bot Station - Room room = (Room) rooms.elementAt(30); - int[][] table = { - {8,8,8,8,8,8,0,0,0,0,0,0,0,0,8,8,8,8,8,8}, - {8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,8,8,8,8,8}, - {8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8,8}, - {8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8}, - {8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8}, - {8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8} - }; - room.RoomArray = table; - room.AddTextBox("Robotoplatz Station",216,178, 150); - } + { // Room 0: Help Screen + Room room = rooms.elementAt(0); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + room.AddTextBox("Ride the Subway to the Town!", 4 * 28, 64, 500); + room.AddTextBox("HINTS:", 2 * 28, 3 * 32, 500); + room.AddTextBox("Find the token to drop into the Turnstyle slot.", 2 * 28, 4 * 32, 500); + room.AddTextBox("Ride the Subway to places that no one has ever dared to go.", 2 * 28, 6 * 32, 500); + room.AddTextBox("Use the Exit Ticket to start the escalators going up, up, up...", 2 * 28, 8 * 32, 500); + room.AddTextBox("Chips 3 & 4 are blank.", 2 * 28, 10 * 32, 500); + room.AddTextBox("(To continue, press RETURN.)", 96, 350, 500); + } + { // Room 1: Escalator + Room room = rooms.elementAt(1); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 17, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Insert Exit Ticket", 244, 10 * 32, 100); + } + { // Room 2: Secret Room + Room room = rooms.elementAt(2); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("Congratulations!!", 176, 66, 560); + room.AddTextBox("You have reached the Secret Room of Public Knowledge.", 2 * 28, 4 * 32, 500); + room.AddTextBox("Robot Odyssey I is dedicated to Warren Robinett, author of Atari Adventure, Rocky's Boots, and the animation utility underlying Robot Odyssey I.", 2 * 28, 6 * 32, 500); + } - { // Room 31: Subway Depot, Level 1 - Room room = (Room) rooms.elementAt(31); - int[][] table = { - {7,0,0,0,0,0,7,7,7,7,7,0,0,7,7,7,7,7,7,7}, - {7,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0}, - {7,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,0,0,0,0,0,0,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7} - }; - room.RoomArray = table; - } - { // Room 32: Subway Depot, Level 2 - Room room = (Room) rooms.elementAt(32); - int[][] table = { - {0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2}, - {2,2,2,2,2,2,2,0,0,0,0,0,0,0,2,0,0,0,0,0}, - {0,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0}, - {0,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0}, - {0,0,0,0,0,0,2,0,0,0,0,0,0,0,2,2,0,2,2,2}, - {2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,2,2,2,2,2,0,0,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - } - { // Room 33: After Turnstile - Room room = (Room) rooms.elementAt(33); - int[][] table = { - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,6,6,6,6,6,6,6,6,6,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,6,6,6,6,6,6,6,6,6,6,6} - }; - room.RoomArray = table; - } - { // Room 34: Subway Depot - Room room = (Room) rooms.elementAt(34); - int[][] table = { - {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, - {8, 0,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 8}, - {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8} - }; - room.RoomArray = table; - room.AddTextBox("SUBWAY DEPOT",408,84, 100); - room.AddTextBox("Push this button to call train.",104,2*32, 200); - room.AddTextBox("Pull here",384,206, 560); - room.AddArrow(13*28+14,5*32,Arrow.DIR_UP,32,Color.white); - items.addElement(new Handle(13*28,4*32+12,room)); - items.addElement(new Train()); - } + { // Room 3: Laundrobot, Level 1 + Room room = rooms.elementAt(3); + room.RoomArray = new int[][]{ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + } + { // Room 4: Laundrobot, Level 2 (Two Buttons) + Room room = rooms.elementAt(4); + room.RoomArray = new int[][]{ + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0}, + {0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {0, 0, 0, 2, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2}, + {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2} + }; + } + { // Room 5: Laundrobot, Level 3 (Sentry & Xit Ticket) + Room room = rooms.elementAt(5); + room.RoomArray = new int[][]{ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 6, 6, 6, 6, 6, 6, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 6}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6}, + {6, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 6, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6}, + {6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6}, + {6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 0}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + }; + items.addElement(new XitTicket(15 * 28, 6 * 32 + 16, room)); + int[] pace = {11 * 28, 7 * 32, 13 * 28, 7 * 32}; + int[] protect = {5 * 28, 2 * 32, 19 * 28, 5 * 32, 8 * 28, 0, + 4 * 28, 6 * 32, 12 * 28, 10 * 32, 0, 3 * 32}; + items.addElement(new Sentry(11 * 28, 7 * 32, room, pace, protect, true)); + } + { // Room 6: Laundrobot Station + Room room = rooms.elementAt(6); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 8, 0, 0, 0, 8}, + {8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 8, 0, 0, 0, 8}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 8, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 8, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8} + }; + room.AddTextBox("Laundrobot Station", 6 * 28, 2 * 32, 300); + } - { // Room 35: Secret tunnel 1 - Room room = (Room) rooms.elementAt(35); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("At last...",220,2*32,450); - } - { // Room 36: Secret tunnel 2 - Room room = (Room) rooms.elementAt(36); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("the mystery is finally revealed!",88,2*32,450); - } - { // Room 37: Secret tunnel 3 - Room room = (Room) rooms.elementAt(37); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("Just what does the lock in the Secret Room of Public Knowledge open?", - 2*28,2*32,500); - } - { // Room 38: Secret tunnel 4 - Room room = (Room) rooms.elementAt(38); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("What else, but a secret passage to...",58,2*32,450); - } - { // Room 39: Secret lock - Room room = (Room) rooms.elementAt(39); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("...ANOTHER LOCK!",2*28,2*32,450); - room.AddTextBox("You DO have the green key, don't you?",58,8*32,450); - room.AddTextBox("If not, go back to the sewers and look around.",58,10*32,450); - } - { // Room 40: Secret room - Room room = (Room) rooms.elementAt(40); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("Hello again! Yes, every level has a secret! Here's the key to Secret #3.", - 2*28,2*32,500); - room.AddTextBox("This Polarizer will open a door when it is hit by a random surge of energy, and the direction of the door will match the polarity of the energy.", - 2*28-8,9*32-10,500); - String[] helperlist = { - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper1.gif","helper4.gif","helper2.gif","helper3.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper5.gif","helper5.gif","helper5.gif","helper5.gif", - }; - Graphix helper = new Graphix(helperlist,14*28, 5*32); - room.graphix.addElement(helper); - items.addElement(new Polarizer(4*28,5*32,room)); - items.addElement(new Key(6*28, 5*32, room, Color.yellow)); - } - - // 1 - // 34 30 26 22 18 14 10 6 - // 33 29 25 21 17 13 9 5 - // 32 28 24 29 16 12 8 4 - // 31 27 23 19 15 11 7 3 + { // Room 7: Muse Robotique Station, Level 1 + Room room = rooms.elementAt(7); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 19, 7, 7, 7, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 7, 20, 7, 0, 0, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + } + { // Room 8: Muse Robotique Station, Level 2 + Room room = rooms.elementAt(8); + room.RoomArray = new int[][]{ + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0}, + {2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 20, 0, 0, 0, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 19, 2, 2, 2, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0} + }; + } + { // Room 9: Muse Robotique Station, Level 3 + Room room = rooms.elementAt(9); + room.RoomArray = new int[][]{ + {6, 6, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0}, + {6, 16, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0}, + {6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6} + }; + } + { // Room 10: Muse Robotique Station, Level 4 + Room room = rooms.elementAt(10); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8}, + {8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8}, + {8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8}, + {8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8}, + {8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0} + }; + room.AddTextBox("Muse Robotique Station", 216, 178, 200); + } - int[][] roomgrid = { - {34,30,26,22,18,14,10, 6,34}, - {33,29,25,21,17,13, 9, 5,33}, - {32,28,24,20,16,12, 8, 4,32}, - {31,27,23,19,15,11, 7, 3,31}, - {34,30,26,22,18,14,10, 6,34} - }; - LinkRoomsGrid(roomgrid); - - // 14 - // 1 - // 11 - LinkRoomsUpDown(11,1); - LinkRoomsUpDown(1,14); - - int[] secretlist = {2,35,36,37,38,39,40}; - LinkRoomsHorizontally(secretlist); - - gameCursor = new GameCursor(6*28,8*32,(Room) rooms.elementAt(15)); - solderingPen = new SolderingPen(); - remote = new Remote(); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - player = gameCursor; - currentViewer = player; - - } + { // Room 11: Jack in the Bot Station, Level 1 + Room room = rooms.elementAt(11); + room.RoomArray = new int[][]{ + {0, 0, 0, 0, 0, 7, 0, 0, 7, 7, 7, 0, 0, 7, 7, 7, 7, 0, 0, 7}, + {0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + toolbox = new ToolBox(3 * 28, 7 * 32, room); + items.addElement(toolbox); + } + { // Room 12: Jack in the Bot Station, Level 2 + Room room = rooms.elementAt(12); + room.RoomArray = new int[][]{ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 14, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0}, + {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0}, + {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0}, + {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0}, + {0, 0, 0, 0, 0, 2, 0, 0, 2, 2, 2, 0, 0, 2, 2, 2, 2, 0, 0, 2} + }; + room.AddTextBox("Subway token", 28, 122, 560); + room.AddArrow(0, 3 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 13: Big Magnet + Room room = rooms.elementAt(13); + room.RoomArray = new int[][]{ + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 0, 6, 0, 0, 0, 0, 0, 6, 6}, + {0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 0, 6, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6} + }; + items.addElement(new SmallChip(13 * 28 + 14, 5 * 32 + 16, room, "4")); + } + { // Room 14: Jack in the Bot Station + Room room = rooms.elementAt(14); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8} + }; + room.AddTextBox("Jack in the 'Bot Station", 160, 178, 300); + } + + { // Room 15: Game starts here + Room room = rooms.elementAt(15); + room.RoomArray = new int[][]{ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7}, + {7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7}, + {7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0}, + {7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + } + { // Room 16: Seer's and Robot Station, Level 2 + Room room = rooms.elementAt(16); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + }; + } + { // Room 17: Token first here + Room room = rooms.elementAt(17); + room.RoomArray = new int[][]{ + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 6, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 6, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 6, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 6, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 6, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 6, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 6, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 6, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 9, 6, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 6, 0}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 6, 0} + }; + items.addElement(new Token(6 * 28, 8 * 32, room)); + int[] pace = {3 * 28, 2 * 32, 12 * 28, 7 * 32}; + int[] protect = {0, 0, 18 * 28, 9 * 32 - 2, 15 * 28, 10 * 32}; + items.addElement(new Sentry(2 * 28, 2 * 32, room, pace, protect, true)); + } + { // Room 18: Seer's and Robot Station + Room room = rooms.elementAt(18); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8}, + {8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8}, + {8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8} + }; + room.AddTextBox("Seer's and Robot Station", 164, 178, 300); + } + + { // Room 19: Picadilly Circuit Station, Level 1 + Room room = rooms.elementAt(19); + room.RoomArray = new int[][]{ + {0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 7, 7, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 7, 7, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 7, 7, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + } + { // Room 20: Picadilly Circuit Station, Level 2 + Room room = rooms.elementAt(20); + room.RoomArray = new int[][]{ + {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2}, + {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2}, + {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2}, + {0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2}, + {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 2, 2, 0, 0}, + {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0}, + {0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0}, + {0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0} + }; + } + { // Room 21: Xit Ticket sensor here + Room room = rooms.elementAt(21); + room.RoomArray = new int[][]{ + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6} + }; + items.addElement(new ContactSensor(11 * 28, 2 * 32, room, new XitTicket(0, 0, null))); + } + { // Room 22: Picadilly Circuit Station + Room room = rooms.elementAt(22); + room.RoomArray = new int[][]{ + {8, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 8} + }; + room.AddTextBox("Picadilly Circuit Station", 76, 178, 500); + } + + { // Room 23: Cobble Bot Station, Level 1 + Room room = rooms.elementAt(23); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 13, 0, 7, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 7, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 7, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7} + }; + items.addElement(new SmallChip(8 * 28, 9 * 32, room, "3")); + } + { // Room 24: Entrance to Token Maze + Room room = rooms.elementAt(24); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {2, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {2, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0} + }; + } + { // Room 25: Cobble Bot Square Station, Level 3 + Room room = rooms.elementAt(25); + room.RoomArray = new int[][]{ + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 15, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0} + }; + room.AddTextBox("Restroom", 392, 198, 560); + room.AddArrow(559, 6 * 32, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 26: Cobble Bot Square Station + Room room = rooms.elementAt(26); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8}, + {8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8}, + {8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8}, + {8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8} + }; + room.AddTextBox("Cobble 'Bot Square Station", 160, 178, 250); + } + + { // Room 27: Jack in the Bot Station, Level 1 + Room room = rooms.elementAt(27); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7} + }; + } + { // Room 28: Token Maze + Room room = rooms.elementAt(28); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2}, + {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0}, + {2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0}, + {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 2}, + {2, 0, 0, 0, 2, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + int[] pace = {11 * 28, 10 * 32, 14 * 28, 10 * 32}; + int[] protect = {3 * 28, 0, 10 * 28, 11 * 32, 0, 5 * 32, + 10 * 28, 0, 16 * 28, 11 * 32, 19 * 28, 6 * 32}; + items.addElement(new Sentry(0, 0, room, pace, protect, true)); + } + { // Room 29: Turnstile, BART + Room room = rooms.elementAt(29); + room.RoomArray = new int[][]{ + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6}, + {0, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 6} + }; + room.AddTextBox("{BIG} {000,204,000} B {BSP} {SML} {255,255,255} ay {BIG} {000,204,000} A {BSP} {SML} {255,255,255} rea {BIG} {000,204,000} R {BSP} {SML} {255,255,255} obot {BIG} {000,204,000} T {BSP} {SML} {255,255,255} ransport", 2 * 28, 58, 560); + room.AddTextBox("Insert token, please.", 9 * 28, 9 * 32, 200); + room.AddArrow(13 * 28, 10 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 30: Jack in the Bot Station + Room room = rooms.elementAt(30); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8}, + {8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8}, + {8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8}, + {8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8} + }; + room.AddTextBox("Robotoplatz Station", 216, 178, 150); + } + + { // Room 31: Subway Depot, Level 1 + Room room = rooms.elementAt(31); + room.RoomArray = new int[][]{ + {7, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + } + { // Room 32: Subway Depot, Level 2 + Room room = rooms.elementAt(32); + room.RoomArray = new int[][]{ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2} + }; + } + { // Room 33: After Turnstile + Room room = rooms.elementAt(33); + room.RoomArray = new int[][]{ + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6} + }; + } + { // Room 34: Subway Depot + Room room = rooms.elementAt(34); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8} + }; + room.AddTextBox("SUBWAY DEPOT", 408, 84, 100); + room.AddTextBox("Push this button to call train.", 104, 2 * 32, 200); + room.AddTextBox("Pull here", 384, 206, 560); + room.AddArrow(13 * 28 + 14, 5 * 32, Arrow.DIR_UP, 32, Color.white); + items.addElement(new Handle(13 * 28, 4 * 32 + 12, room)); + items.addElement(new Train()); + } + + { // Room 35: Secret tunnel 1 + Room room = rooms.elementAt(35); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("At last...", 220, 2 * 32, 450); + } + { // Room 36: Secret tunnel 2 + Room room = rooms.elementAt(36); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("the mystery is finally revealed!", 88, 2 * 32, 450); + } + { // Room 37: Secret tunnel 3 + Room room = rooms.elementAt(37); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("Just what does the lock in the Secret Room of Public Knowledge open?", + 2 * 28, 2 * 32, 500); + } + { // Room 38: Secret tunnel 4 + Room room = rooms.elementAt(38); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("What else, but a secret passage to...", 58, 2 * 32, 450); + } + { // Room 39: Secret lock + Room room = rooms.elementAt(39); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("...ANOTHER LOCK!", 2 * 28, 2 * 32, 450); + room.AddTextBox("You DO have the green key, don't you?", 58, 8 * 32, 450); + room.AddTextBox("If not, go back to the sewers and look around.", 58, 10 * 32, 450); + } + { // Room 40: Secret room + Room room = rooms.elementAt(40); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("Hello again! Yes, every level has a secret! Here's the key to Secret #3.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("This Polarizer will open a door when it is hit by a random surge of energy, and the direction of the door will match the polarity of the energy.", + 2 * 28 - 8, 9 * 32 - 10, 500); + String[] helperlist = { + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper1.gif", "helper4.gif", "helper2.gif", "helper3.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper5.gif", "helper5.gif", "helper5.gif", "helper5.gif", + }; + Graphix helper = new Graphix(helperlist, 14 * 28, 5 * 32); + room.graphix.addElement(helper); + items.addElement(new Polarizer(4 * 28, 5 * 32, room)); + items.addElement(new Key(6 * 28, 5 * 32, room, Color.yellow)); + } + + // 1 + // 34 30 26 22 18 14 10 6 + // 33 29 25 21 17 13 9 5 + // 32 28 24 29 16 12 8 4 + // 31 27 23 19 15 11 7 3 + + int[][] roomgrid = { + {34, 30, 26, 22, 18, 14, 10, 6, 34}, + {33, 29, 25, 21, 17, 13, 9, 5, 33}, + {32, 28, 24, 20, 16, 12, 8, 4, 32}, + {31, 27, 23, 19, 15, 11, 7, 3, 31}, + {34, 30, 26, 22, 18, 14, 10, 6, 34} + }; + LinkRoomsGrid(roomgrid); + + // 14 + // 1 + // 11 + LinkRoomsUpDown(11, 1); + LinkRoomsUpDown(1, 14); + + int[] secretlist = {2, 35, 36, 37, 38, 39, 40}; + LinkRoomsHorizontally(secretlist); + + gameCursor = new GameCursor(6 * 28, 8 * 32, rooms.elementAt(15)); + solderingPen = new SolderingPen(); + remote = new Remote(); + helpCam = new HelpCam(rooms.elementAt(0)); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + player = gameCursor; + currentViewer = player; + + } } diff --git a/src/com/droidquest/levels/RO3.java b/src/com/droidquest/levels/RO3.java index 849da0f..4dc581c 100644 --- a/src/com/droidquest/levels/RO3.java +++ b/src/com/droidquest/levels/RO3.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.avatars.GameCursor; @@ -15,897 +13,839 @@ import com.droidquest.devices.DirectionalSensor; import com.droidquest.devices.SmallChip; import com.droidquest.devices.StormShield; import com.droidquest.items.Button; -import com.droidquest.items.Crystal; -import com.droidquest.items.ElevatorKey; -import com.droidquest.items.ElevatorSwitch; -import com.droidquest.items.F12Form; -import com.droidquest.items.FFButton; -import com.droidquest.items.GateKeeper; -import com.droidquest.items.HiddenCamera; -import com.droidquest.items.Key; -import com.droidquest.items.Sentry; -import com.droidquest.items.SlipperyToken; -import com.droidquest.items.StormCloud; -import com.droidquest.items.VendingHandle; -import com.droidquest.materials.CameraDisable; -import com.droidquest.materials.CameraEnable; -import com.droidquest.materials.ElevatorInPortal; -import com.droidquest.materials.ElevatorLock; -import com.droidquest.materials.ElevatorOutPortal; -import com.droidquest.materials.Material; -import com.droidquest.materials.PlayerBlocker; -import com.droidquest.materials.Portal; -import com.droidquest.materials.ShapeEditor; -import com.droidquest.materials.SwitchA; -import com.droidquest.materials.SwitchB; -import com.droidquest.materials.VendingSlot; +import com.droidquest.items.*; +import com.droidquest.materials.*; -class RO3 extends Level -{ - public RO3 (RoomDisplay rd) - { - super(rd); +import java.awt.*; - materials.addElement(new Material(true, false)); // 0= Empty Space - materials.addElement(new Material(new Color(0,204,0),false, true)); // 1= Green - materials.addElement(new Material(new Color(255,224,192),false, true)); // 2= Lt Orange - materials.addElement(new Material(new Color(128,128,128),false, true)); // 3= Grey - materials.addElement(new Material(new Color(255,128,0),false, true)); // 4= Orange - materials.addElement(new Material(new Color(255,255,255),false, true)); // 5= White - materials.addElement(new Material(new Color(0,0,255),false, true)); // 6= Blue - materials.addElement(new Material(new Color(0,0,128),false,true)); // 7= Dk Blue - materials.addElement(new Material(new Color(63,32,0),false, true)); // 8= Dk Orange - materials.addElement(new ShapeEditor(new StormCloud(0,0,null))); // 9= Storm Editor - materials.addElement(new ElevatorLock()); // 10= ElevatorLock - materials.addElement(new ElevatorInPortal()); // 11= ElevatorIn - materials.addElement(new ElevatorOutPortal()); // 12= ElevatorOut - materials.addElement(new ElevatorSwitch()); // 13= ElevatorSwitch - materials.addElement(new VendingSlot()); // 14= VendingSlot - materials.addElement(new PlayerBlocker(Color.black)); // 15= PlayerBlock - materials.addElement(new SwitchA()); // 16 - materials.addElement(new SwitchB()); // 17 - materials.addElement(new CameraEnable()); // 18= Periscope - materials.addElement(new CameraDisable()); // 19 - String[] files = {"field0.jpg","field1.jpg"}; - materials.addElement(new PlayerBlocker(files)); // 20= Blue FF - materials.addElement(new Portal("RO4.lvl", true, true)); // 21= Portal +class RO3 extends Level { + public RO3(RoomDisplay rd) { + super(rd); - for (int a=0; a<=36; a++) - rooms.addElement(new Room()); + materials.addElement(new Material(true, false)); // 0= Empty Space + materials.addElement(new Material(new Color(0, 204, 0), false, true)); // 1= Green + materials.addElement(new Material(new Color(255, 224, 192), false, true)); // 2= Lt Orange + materials.addElement(new Material(new Color(128, 128, 128), false, true)); // 3= Grey + materials.addElement(new Material(new Color(255, 128, 0), false, true)); // 4= Orange + materials.addElement(new Material(new Color(255, 255, 255), false, true)); // 5= White + materials.addElement(new Material(new Color(0, 0, 255), false, true)); // 6= Blue + materials.addElement(new Material(new Color(0, 0, 128), false, true)); // 7= Dk Blue + materials.addElement(new Material(new Color(63, 32, 0), false, true)); // 8= Dk Orange + materials.addElement(new ShapeEditor(new StormCloud(0, 0, null))); // 9= Storm Editor + materials.addElement(new ElevatorLock()); // 10= ElevatorLock + materials.addElement(new ElevatorInPortal()); // 11= ElevatorIn + materials.addElement(new ElevatorOutPortal()); // 12= ElevatorOut + materials.addElement(new ElevatorSwitch()); // 13= ElevatorSwitch + materials.addElement(new VendingSlot()); // 14= VendingSlot + materials.addElement(new PlayerBlocker(Color.black)); // 15= PlayerBlock + materials.addElement(new SwitchA()); // 16 + materials.addElement(new SwitchB()); // 17 + materials.addElement(new CameraEnable()); // 18= Periscope + materials.addElement(new CameraDisable()); // 19 + String[] files = {"field0.jpg", "field1.jpg"}; + materials.addElement(new PlayerBlocker(files)); // 20= Blue FF + materials.addElement(new Portal("RO4.lvl", true, true)); // 21= Portal - {// Room 0 : Help Screen - Room room = (Room) rooms.elementAt(0); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table; - room.AddTextBox("Explore the Town!",164,2*32, 560); - room.AddTextBox("HINTS: Weather the magnetic storm with a shield in a 'bot. (Turn it on.)", - 2*28,4*32, 500); - room.AddTextBox("Chips 5 & 6 are blank.",2*28,6*32, 500); - room.AddTextBox("Sometimes junk can open doors...",2*28,7*32, 560); - room.AddTextBox("A Form-12 is your ticket to the Master Control Room.",2*28,8*32, 560); - room.AddTextBox("(To continue, press RETURN.)",4*28,11*32, 500); - } - {// Room 1 : Intro Maze 1 - Room room = (Room) rooms.elementAt(1); - int[][] table = { - {2,2,0,0,0,2,2,0,0,0,0,0,0,2,2,0,0,0,2,2}, - {2,2,0,0,0,2,2,2,0,0,0,0,2,2,2,0,0,0,2,2}, - {2,0,0,0,0,0,2,2,2,0,0,0,0,2,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,2,2,2,2,2,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,2,2,2,2,2,2,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,2,2,2,0,0,2,2,2,0,0,0,0,0,2}, - {2,2,0,0,0,2,2,2,0,0,0,0,2,2,2,0,0,0,2,2}, - {2,2,0,0,0,2,2,0,0,0,0,0,0,2,2,0,0,0,2,2} - }; - room.RoomArray = table; - room.AddTextBox("EXIT",9*28+6,196,100); - room.AddArrow(280,4*32,Arrow.DIR_UP,32,Color.white); - room.AddArrow(280,8*32,Arrow.DIR_DOWN,32,Color.white); - room.AddArrow(7*28,6*32,Arrow.DIR_LEFT,28,Color.white); - room.AddArrow(13*28,6*32,Arrow.DIR_RIGHT,28,Color.white); - } - {// Room 2 : Intro Maze 2 - Room room = (Room) rooms.elementAt(2); - int[][] table = { - {2,2,0,0,0,2,2,0,0,0,0,0,0,2,2,0,0,0,2,2}, - {2,2,0,0,0,2,2,2,0,0,0,0,2,2,2,0,0,0,2,2}, - {2,0,0,0,0,0,2,2,2,0,0,0,0,2,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,2,2,2,2,2,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,2,2,2,2,2,2,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,2,2,2,0,0,2,2,2,0,0,0,0,0,2}, - {2,2,0,0,0,2,2,2,0,0,0,0,2,2,2,0,0,0,2,2}, - {2,2,0,0,0,2,2,0,0,0,0,0,0,2,2,0,0,0,2,2} - }; - room.RoomArray = table; - room.AddTextBox("EXIT",9*28+6,196,100); - room.AddArrow(280,4*32,Arrow.DIR_UP,32,Color.white); - room.AddArrow(280,8*32,Arrow.DIR_DOWN,32,Color.white); - room.AddArrow(7*28,6*32,Arrow.DIR_LEFT,28,Color.white); - room.AddArrow(13*28,6*32,Arrow.DIR_RIGHT,28,Color.white); - } - {// Room 3 : Intro Maze 3 - Room room = (Room) rooms.elementAt(3); - int[][] table = { - {2,2,0,0,0,2,2,0,0,0,0,0,0,2,2,0,0,0,2,2}, - {2,2,0,0,0,2,2,2,0,0,0,0,2,2,2,0,0,0,2,2}, - {2,0,0,0,0,0,2,2,2,0,0,0,0,2,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,2,2,2,2,2,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,2,2,2,2,2,2,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,2,2,2,0,0,2,2,2,0,0,0,0,0,2}, - {2,2,0,0,0,2,2,2,0,0,0,0,2,2,2,0,0,0,2,2}, - {2,2,0,0,0,2,2,0,0,0,0,0,0,2,2,0,0,0,2,2} - }; - room.RoomArray = table; - room.AddTextBox("EXIT",9*28+6,196,100); - room.AddArrow(280,4*32,Arrow.DIR_UP,32,Color.white); - room.AddArrow(280,8*32,Arrow.DIR_DOWN,32,Color.white); - room.AddArrow(7*28,6*32,Arrow.DIR_LEFT,28,Color.white); - room.AddArrow(13*28,6*32,Arrow.DIR_RIGHT,28,Color.white); - } - {// Room 4 : Sensor Editor Room, Magnetic Shield here - Room room = (Room) rooms.elementAt(4); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Sensor Editor",64,56, 560); - room.AddTextBox("Magnetic Storm Shield (For Robots Only)",60,346, 560); - items.addElement(new StormShield(3*28, 8*32, room)); - } - {// Room 5 : Street Maze - Room room = (Room) rooms.elementAt(5); - int[][] table = { - {3,3,3,3,3,3,3,3,3,0,0,3,3,0,0,0,0,0,3,3}, - {3,3,0,0,3,3,0,0,3,3,3,3,3,0,0,0,0,0,3,3}, - {3,3,0,0,3,3,0,0,0,0,0,3,3,0,0,3,0,0,3,3}, - {3,3,0,0,3,3,0,0,0,0,0,3,3,0,0,3,0,0,3,3}, - {3,3,0,0,3,3,3,3,3,0,0,0,0,0,0,3,0,0,0,0}, - {3,3,0,0,3,3,0,0,3,0,0,0,0,0,0,3,0,0,0,0}, - {3,3,0,0,3,3,0,0,3,0,0,3,3,0,0,3,0,0,0,0}, - {3,3,0,0,0,0,0,0,3,0,0,3,3,0,0,3,0,0,0,0}, - {3,3,0,0,0,0,0,0,3,0,0,3,3,0,0,3,0,0,3,3}, - {3,3,0,0,3,3,0,0,3,0,0,3,3,0,0,3,0,0,3,3}, - {3,3,0,0,3,3,0,0,3,0,0,3,3,0,0,3,0,0,3,3}, - {3,3,0,0,3,3,0,0,3,0,0,3,3,0,0,0,0,0,3,3} - }; - room.RoomArray = table; - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - } - {// Room 6 : Street Maze - Room room = (Room) rooms.elementAt(6); - int[][] table = { - {3,3,0,0,3,3,0,0,3,0,0,3,3,0,0,0,0,0,3,3}, - {3,3,0,0,0,0,0,0,3,0,0,3,3,0,0,0,0,0,3,3}, - {3,3,0,0,0,0,0,0,3,0,0,3,3,0,0,3,3,3,3,3}, - {3,3,0,0,3,3,0,0,3,0,0,0,0,0,0,3,0,0,3,3}, - {0,0,0,0,3,3,0,0,3,0,0,0,0,0,0,3,0,0,3,3}, - {0,0,0,0,3,3,0,0,3,0,0,3,3,3,3,3,0,0,3,3}, - {0,0,0,0,3,3,0,0,3,0,0,3,3,3,3,3,3,3,3,3}, - {0,0,0,0,3,3,0,0,0,0,0,3,3,0,0,0,0,0,3,3}, - {3,3,3,3,3,3,0,0,0,0,0,3,3,0,0,0,0,0,3,3}, - {3,3,0,0,3,3,0,0,3,0,0,0,3,0,0,3,0,0,3,3}, - {3,3,0,0,3,3,0,0,3,0,0,0,3,0,0,3,0,0,3,3}, - {3,3,0,0,3,3,0,0,3,3,0,0,3,0,0,3,0,0,3,3} - }; - room.RoomArray = table; - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - } - {// Room 7 : Street Maze - Room room = (Room) rooms.elementAt(7); - int[][] table = { - {3,3,0,0,3,3,0,0,3,3,0,0,3,0,0,3,0,0,3,3}, - {3,3,0,0,3,3,0,0,0,0,0,0,0,0,0,3,0,0,0,3}, - {3,3,0,0,3,3,0,0,0,0,0,0,0,0,0,3,3,0,0,3}, - {3,3,0,0,3,3,0,0,3,3,3,3,3,0,0,0,0,0,0,3}, - {3,3,0,0,3,3,0,0,3,0,0,3,3,0,0,0,0,0,0,0}, - {3,3,0,0,3,3,3,3,3,0,0,3,3,0,0,3,3,0,0,0}, - {3,3,0,0,3,3,0,0,0,0,0,0,0,0,0,3,3,0,0,0}, - {3,3,0,0,3,3,0,0,0,0,0,0,0,0,0,3,3,0,0,0}, - {3,3,0,0,3,3,0,0,3,3,3,3,3,0,0,3,3,3,3,3}, - {3,3,3,3,3,3,0,0,3,0,0,3,3,0,0,3,3,3,3,3}, - {3,0,0,0,3,3,0,0,3,0,0,3,3,0,0,3,3,0,0,3}, - {3,0,0,0,3,3,0,0,3,0,0,3,3,0,0,3,3,0,0,3} - }; - room.RoomArray = table; - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - } - {// Room 8 : Brown Tunnel - Room room = (Room) rooms.elementAt(8); - int[][] table = { - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8} - }; - room.RoomArray = table; - } - {// Room 9 : Lower Elevator, Trash Pile - Room room = (Room) rooms.elementAt(9); - int[][] table = { - {7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,11,11, 7, 7}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,11,11, 7, 7}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 7, 7, 7, 7, 7, 7}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - {7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} - }; - room.RoomArray = table; - room.AddTextBox("ELEVATOR",9*28,152, 560); - room.AddTextBox("The things robots throw away...",0,6*32, 200); - room.AddArrow(14*28,4*32+16,Arrow.DIR_RIGHT,28,Color.white); - items.addElement(new ElevatorKey(1*28,9*32,room)); - String[] filelist = {"trash0.gif","trash1.gif","trash2.gif","trash3.gif"}; - room.graphix.addElement(new Graphix(filelist,28,8*32)); - } - {// Room 10 : Stairs, Sentry - Room room = (Room) rooms.elementAt(10); - int[][] table = { - {7,7,7,7,7,7,7,7,7,7,0,0,0,0,7,7,7,7,7,7}, - {7,7,7,7,7,0,0,0,0,0,0,0,0,0,7,7,7,7,7,7}, - {7,7,7,7,7,0,0,0,0,0,0,0,0,0,7,7,7,7,7,7}, - {7,7,7,7,7,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7}, - {7,7,7,7,7,0,0,0,0,0,0,0,7,7,7,7,7,7,7,7}, - {7,7,7,7,7,0,0,0,0,0,0,7,7,7,7,7,7,7,7,7}, - {7,7,7,7,7,0,0,0,0,0,7,7,7,7,7,7,7,7,7,7}, - {7,7,7,7,7,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7}, - {7,7,7,7,7,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7}, - {7,7,7,7,7,7,0,0,0,0,0,0,0,0,7,7,7,7,7,7}, - {7,7,7,7,7,7,7,0,0,0,0,0,0,0,7,7,7,7,7,7}, - {7,7,7,7,7,7,7,7,0,0,0,0,0,0,7,7,7,7,7,7} - }; - room.RoomArray = table; - room.AddTextBox("Use elevator.",8*28,10*32, 560); - int[] pace = {6*28,2*32, 6*28,8*32}; - int[] pounce = {5*28,3*32,14*28,5*32, 12*28,0, - 5*28,6*32,14*28,8*32, 9*28,11*32}; - items.addElement(new Sentry(7*28,2*32,room,pace,pounce, true)); - } - {// Room 11 : Upper Elevator, Top of Stairs - Room room = (Room) rooms.elementAt(11); - int[][] table = { - {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,11,11, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,11,11, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, - {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7} - }; - room.RoomArray = table; - items.addElement(new Crystal(7*28,4*32,room,100000)); - } - {// Room 12 : Vending Machine - Room room = (Room) rooms.elementAt(12); - int[][] table = { - {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - {7,14,14,14,14,14,14,14,14,14, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - {7,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 7}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7} - }; - room.RoomArray = table; - room.AddTextBox("..........................................",28,274, 560); - room.AddTextBox("1) Insert Token ",112,6*32, 560); - room.AddTextBox("2) Pull ",308,96, 560); - room.AddTextBox("VENDING MACHINE",48,50, 560); - room.AddArrow(3*28,5*32,Arrow.DIR_UP,32,Color.white); - room.AddArrow(11*28+22,4*32+4,Arrow.DIR_DOWN,30,Color.white); - items.addElement(new VendingHandle(11*28,4*32+10,room)); - items.addElement(new F12Form(3*28, 2*32, room)); - } - {// Room 13 : Blue Maze : Button Room - Room room = (Room) rooms.elementAt(13); - int[][] table = { - { 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - { 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - { 7, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 7}, - { 7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, - {20, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, - {20, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, - {20, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, - { 7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, - { 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7}, - { 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - { 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - { 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} - }; - room.RoomArray = table; - items.addElement(new HiddenCamera(room)); - items.addElement(new FFButton(10*28, 5*32, room)); - } - {// Room 14 : Blue Maze - Room room = (Room) rooms.elementAt(14); - int[][] table = { - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7} - }; - room.RoomArray = table; - } - {// Room 15 : Blue Maze - Room room = (Room) rooms.elementAt(15); - int[][] table = { - {7,7,7,7,7,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7}, - {7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,7}, - {7,7,7,7,7,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7} - }; - room.RoomArray = table; - } - {// Room 16 : Street Maze - Room room = (Room) rooms.elementAt(16); - int[][] table = { - {3,3,0,0,3,3,0,0,3,3,0,0,3,0,0,3,0,0,3,3}, - {3,3,0,0,3,3,0,0,3,0,0,0,3,0,0,3,0,0,3,3}, - {3,0,0,0,3,3,0,0,3,0,0,3,3,0,0,3,0,0,3,3}, - {3,0,0,3,3,3,0,0,3,0,0,3,3,0,0,3,0,0,3,3}, - {3,0,0,3,3,3,0,0,3,0,0,0,0,0,0,3,0,0,0,0}, - {3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,3,0,0,0,0}, - {3,0,0,0,0,0,0,0,3,0,0,0,0,3,3,3,3,0,0,0}, - {3,3,3,3,0,0,3,3,3,3,3,0,0,3,0,0,3,0,0,0}, - {3,0,0,3,0,0,3,3,0,0,3,0,0,3,3,3,3,0,0,3}, - {3,0,0,3,0,0,3,3,0,0,3,0,0,0,0,0,0,0,0,3}, - {3,0,0,3,0,0,3,3,0,0,3,0,0,0,0,0,0,0,0,3}, - {3,0,0,3,0,0,3,3,0,0,3,0,0,3,3,0,0,3,3,3} - }; - room.RoomArray = table; - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - } - {// Room 17 : Street Maze - Room room = (Room) rooms.elementAt(17); - int[][] table = { - {3,0,0,3,0,0,3,3,0,0,3,0,0,3,3,0,0,3,3,3}, - {3,0,0,3,0,0,0,0,0,0,3,3,3,3,3,0,0,0,0,3}, - {3,0,0,3,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,3}, - {3,0,0,3,3,3,0,0,3,3,0,0,3,0,0,0,0,0,0,3}, - {0,0,0,3,0,3,0,0,3,3,0,0,3,0,0,3,3,3,3,3}, - {0,0,0,3,3,3,0,0,3,3,0,0,3,0,0,3,0,0,3,3}, - {0,0,3,0,0,3,3,3,3,3,0,0,0,0,0,3,0,0,3,3}, - {0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,3,3}, - {3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3}, - {3,3,0,0,3,3,0,0,0,0,0,0,3,0,0,0,0,0,3,3}, - {3,3,0,0,3,3,0,0,3,3,3,3,3,0,0,0,0,0,3,3}, - {3,3,0,0,3,3,0,0,3,3,0,0,3,0,0,3,0,0,3,3} - }; - room.RoomArray = table; - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - } - {// Room 18 : Street Maze - Room room = (Room) rooms.elementAt(18); - int[][] table = { - {3,0,0,0,3,3,0,0,3,0,0,3,3,0,0,3,3,0,0,3}, - {3,3,3,3,3,3,0,0,0,0,0,0,3,0,0,0,3,0,0,3}, - {3,0,0,0,0,0,3,0,0,0,0,0,3,0,0,0,3,0,0,3}, - {3,0,0,0,0,0,3,0,0,3,0,0,3,3,3,3,3,0,0,3}, - {3,0,0,3,0,0,3,3,3,3,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,3,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,3,0,0,3,0,0,0,0,0,3,3,3,3,3,3,3,3}, - {3,0,0,3,0,0,3,0,0,3,0,0,3,0,0,0,0,0,0,3}, - {3,0,0,3,0,0,0,0,0,3,0,0,0,0,0,0,3,0,0,3}, - {3,0,0,3,0,0,0,0,0,3,0,0,0,0,0,0,3,0,0,3}, - {3,0,0,3,0,0,0,0,0,3,0,0,0,3,3,3,3,0,0,3}, - {3,0,0,3,3,3,3,3,3,3,3,3,3,3,0,0,3,0,0,3} - }; - room.RoomArray = table; - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new SmallChip(28+14, 2*32+16, room, "6")); - } - {// Room 19 : Street Tunnel - Room room = (Room) rooms.elementAt(19); - int[][] table = { - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8} - }; - room.RoomArray = table; - } - {// Room 20 : Blue Maze - Room room = (Room) rooms.elementAt(20); - int[][] table = { - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {7,7,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,0,0,0,0,0,7,7,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,0,0,0,0,0,7,7,0,0,7,7,7,7,7,7,7,7,7}, - {7,7,7,7,7,7,7,7,7,0,0,7,0,0,0,0,0,0,0,7}, - {7,7,7,7,7,7,7,7,7,0,0,7,7,7,7,7,7,7,7,7} - }; - room.RoomArray = table; - } - {// Room 21 : Blue Maze - Room room = (Room) rooms.elementAt(21); - int[][] table = { - {7,7,7,7,7,7,7,7,7,7,0,0,0,0,7,7,7,7,7,7}, - {7,0,0,0,0,0,0,0,0,7,0,0,0,0,7,0,0,0,0,7}, - {7,7,7,7,7,7,7,7,7,7,0,0,0,0,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7} - }; - room.RoomArray = table; - items.addElement(new SmallChip(10*28, 3*32, room, "5")); - } - {// Room 22 : Blue Maze - Room room = (Room) rooms.elementAt(22); - int[][] table = { - {7,7,7,7,7,7,0,0,0,7,7,7,7,7,7,7,7,7,7,7}, - {7,0,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,7}, - {7,7,7,7,7,7,0,0,0,7,0,0,0,0,0,0,0,0,0,7}, - {0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,7}, - {0,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,7,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,7,0,0,7,7}, - {7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,7,7}, - {7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,7,7} - }; - room.RoomArray = table; - items.addElement(new ContactSensor(13*28,8*32,room, - new Key(0,0,null, Color.blue))); - } - {// Room 23 : Blue Maze : 2 buttons - Room room = (Room) rooms.elementAt(23); - int[][] table = { - {7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - {0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7,16, 0, 0, 0, 0, 0, 0, 7}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - {7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7}, - {0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0}, - {0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7}, - {7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - {0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7,17, 0, 0, 0, 0, 0, 0, 7}, - {7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7} - }; - room.RoomArray = table; - room.AddTextBox("Two buttons a day keep the sentry away.",148,5*32, 250); - int[] pace = {3*28,4*32, 3*28,9*32}; - int[] protect = {4*28,1*32, 6*28,3*32, 0,2*32, - 4*28,3*32, 6*28,9*32, 0,6*32, - 4*28,9*32, 6*28,11*32, 0,9*32}; - items.addElement(new Sentry(3*28,3*32,room,pace,protect, true)); - } - {// Room 24 : Blue Maze: Button Anteroom - Room room = (Room) rooms.elementAt(24); - int[][] table = { - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, - {7, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 7}, - {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, - {0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0,20}, - {0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0,20}, - {0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0,20}, - {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, - {7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,19,19, 7}, - {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,19,18, 7}, - {7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} - }; - room.RoomArray = table; - room.AddTextBox("Look into the next room.",14*28,9*32+16, 150); - room.AddArrow(17*28, 10*32+16, Arrow.DIR_RIGHT,28,Color.white); - } - {// Room 25 : Blue Maze - Room room = (Room) rooms.elementAt(25); - int[][] table = { - {7,7,7,7,7,7,7,7,7,0,0,7,7,7,7,7,7,7,7,7}, - {7,7,7,7,7,7,7,7,7,0,0,7,0,0,0,0,0,0,0,7}, - {7,7,0,0,0,0,0,7,7,0,0,7,7,7,7,7,7,7,7,7}, - {7,7,0,0,0,0,0,7,7,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,0,0,0,0,0,7,7,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7} - }; - room.RoomArray = table; - } - {// Room 26 : Blue Maze - Room room = (Room) rooms.elementAt(26); - int[][] table = { - {7,7,7,7,7,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7}, - {7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,7}, - {7,7,7,7,7,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,0,0,0,0,7,7,7,7,7,7}, - {7,7,7,7,7,7,7,7,7,7,0,0,0,0,7,7,7,7,7,7} - }; - room.RoomArray = table; - } - {// Room 27 : Blue Maze - Room room = (Room) rooms.elementAt(27); - int[][] table = { - {7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,7,7}, - {7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,7,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,7,0,0,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,7,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,0}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,7,7,0,0,0,0,0,0,0,7,7}, - {7,7,7,7,7,7,0,0,0,7,7,7,7,7,7,7,7,7,7,7}, - {7,7,7,7,7,7,0,0,0,7,7,7,7,7,7,7,7,7,7,7} - }; - room.RoomArray = table; - } - {// Room 28 : Brown Tunnel - Room room = (Room) rooms.elementAt(28); - int[][] table = { - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8} - }; - room.RoomArray = table; - } - {// Room 29 : Blue Maze : Form Taker - Room room = (Room) rooms.elementAt(29); - int[][] table = { - {7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,7,0,0,7,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,7,0,0,7,7}, - {7,7,7,0,0,0,0,0,0,0,7,7,0,0,0,7,0,0,7,7}, - {7,7,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,7,7}, - {7,7,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,7,7}, - {7,7,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,0,7,7}, - {7,7,7,0,0,0,0,0,0,0,7,7,0,0,0,7,0,0,7,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,7,0,0,7,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,7,0,0,7,7} - }; - room.RoomArray = table; - room.AddTextBox("Submit a Form-12, please.",3*28,3*32, 150); - room.AddTextBox(" OFFICIAL GATEKEEPER",112,9*32, 200); - room.AddGraphix("trashcan.gif",2*28, 8*32); - items.addElement(new GateKeeper(7*28,4*32,room)); - items.addElement(new DirectionalSensor(16*28,5*32,room, - new Button(0,0,null,Color.white))); - } - {// Room 30 : Blue Maze - Room room = (Room) rooms.elementAt(30); - int[][] table = { - {7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0}, - {7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0}, - {7,0,0,0,7,0,0,0,7,7,7,0,0,0,0,7,7,7,7,7}, - {7,0,0,0,7,0,0,0,7,0,7,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,0,0,0,7,0,7,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,7,0,7,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,7,0,7,0,0,0,0,7,7,7,7,7}, - {7,7,7,7,7,0,0,0,7,0,7,0,0,0,0,7,0,0,0,7}, - {7,0,0,0,7,0,0,0,7,7,7,0,0,0,0,7,0,0,0,7}, - {7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7}, - {7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7}, - {7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7} - }; - room.RoomArray = table; - items.addElement(new DirectionalSensor(6*28,3*32,room,new Key(0,0,null,Color.blue))); - } - {// Room 31 : Blue Maze - Room room = (Room) rooms.elementAt(31); - int[][] table = { - {7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7}, - {7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,0,0,0,0,0,0,0,0,7,7,7,7,7,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,7,7,7,7,7,0,0,0,0,0,0,0,0,7,7,7,7,7,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0}, - {7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7} - }; - room.RoomArray = table; - } - {// Room 32 : Blue Maze - Room room = (Room) rooms.elementAt(32); - int[][] table = { - {7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7}, - {7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7}, - {7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7}, - {7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7}, - {7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7}, - {7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7}, - {7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0} - }; - room.RoomArray = table; - } - {// Room 33 : Brown Tunnel - Room room = (Room) rooms.elementAt(33); - int[][] table = { - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8} - }; - room.RoomArray = table; - } - {// Room 34 : Street Maze : Token - Room room = (Room) rooms.elementAt(34); - int[][] table = { - {3,0,0,3,3,3,3,3,3,3,3,3,3,3,0,0,3,0,0,3}, - {3,0,0,3,3,3,3,3,3,3,3,3,3,3,0,0,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,3,3,3,3,3,3,3,3,0,0,3,3,0,0,0,0,0,3,3} - }; - room.RoomArray = table; - room.AddTextBox("I never could hang onto money...",3*28,152, 560); - items.addElement(new SlipperyToken(3*28, 3*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - items.addElement(new StormCloud(10*28, 6*32, room)); - } - {// Room 35 : Elevator - Room room = (Room) rooms.elementAt(35); - int[][] table = { - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, - { 4, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4}, - { 4, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 4}, - { 4, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 4}, - { 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - { 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - { 4,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} - }; - room.RoomArray = table; - room.AddArrow(10*28-2,66,Arrow.DIR_UP,28,Color.green); - room.AddArrow(10*28-1,66,Arrow.DIR_UP,28,Color.green); - room.AddArrow(10*28,66,Arrow.DIR_UP,28,Color.green); - room.AddArrow(10*28+1,66,Arrow.DIR_UP,28,Color.green); - room.AddArrow(10*28+2,66,Arrow.DIR_UP,28,Color.green); - }; + for (int a = 0; a <= 36; a++) { + rooms.addElement(new Room()); + } - {// Room 36 : Secret room - Room room = (Room) rooms.elementAt(36); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Good work! You Found me again!", - 2*28,2*32, 500); - room.AddTextBox("You may find this hard to swallow, but there is no key to Secret #4. Just ride a robot through one of the challanges.", - 2*28,4*32, 500); - String[] helperlist = { - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper1.gif","helper4.gif","helper2.gif","helper3.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper5.gif","helper5.gif","helper5.gif","helper5.gif", - }; - Graphix helper = new Graphix(helperlist,15*28, 8*32); - room.graphix.addElement(helper); - items.addElement(new Crystal(2*28,8*32,room,100000)); - items.addElement(new Key(2*28,9*32,room,Color.red)); - } + {// Room 0 : Help Screen + Room room = rooms.elementAt(0); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + room.AddTextBox("Explore the Town!", 164, 2 * 32, 560); + room.AddTextBox("HINTS: Weather the magnetic storm with a shield in a 'bot. (Turn it on.)", + 2 * 28, 4 * 32, 500); + room.AddTextBox("Chips 5 & 6 are blank.", 2 * 28, 6 * 32, 500); + room.AddTextBox("Sometimes junk can open doors...", 2 * 28, 7 * 32, 560); + room.AddTextBox("A Form-12 is your ticket to the Master Control Room.", 2 * 28, 8 * 32, 560); + room.AddTextBox("(To continue, press RETURN.)", 4 * 28, 11 * 32, 500); + } + {// Room 1 : Intro Maze 1 + Room room = rooms.elementAt(1); + room.RoomArray = new int[][]{ + {2, 2, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 2, 2}, + {2, 2, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2}, + {2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2}, + {2, 2, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2}, + {2, 2, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 2, 2} + }; + room.AddTextBox("EXIT", 9 * 28 + 6, 196, 100); + room.AddArrow(280, 4 * 32, Arrow.DIR_UP, 32, Color.white); + room.AddArrow(280, 8 * 32, Arrow.DIR_DOWN, 32, Color.white); + room.AddArrow(7 * 28, 6 * 32, Arrow.DIR_LEFT, 28, Color.white); + room.AddArrow(13 * 28, 6 * 32, Arrow.DIR_RIGHT, 28, Color.white); + } + {// Room 2 : Intro Maze 2 + Room room = rooms.elementAt(2); + room.RoomArray = new int[][]{ + {2, 2, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 2, 2}, + {2, 2, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2}, + {2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2}, + {2, 2, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2}, + {2, 2, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 2, 2} + }; + room.AddTextBox("EXIT", 9 * 28 + 6, 196, 100); + room.AddArrow(280, 4 * 32, Arrow.DIR_UP, 32, Color.white); + room.AddArrow(280, 8 * 32, Arrow.DIR_DOWN, 32, Color.white); + room.AddArrow(7 * 28, 6 * 32, Arrow.DIR_LEFT, 28, Color.white); + room.AddArrow(13 * 28, 6 * 32, Arrow.DIR_RIGHT, 28, Color.white); + } + {// Room 3 : Intro Maze 3 + Room room = rooms.elementAt(3); + room.RoomArray = new int[][]{ + {2, 2, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 2, 2}, + {2, 2, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2}, + {2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 2}, + {2, 2, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2}, + {2, 2, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 2, 2} + }; + room.AddTextBox("EXIT", 9 * 28 + 6, 196, 100); + room.AddArrow(280, 4 * 32, Arrow.DIR_UP, 32, Color.white); + room.AddArrow(280, 8 * 32, Arrow.DIR_DOWN, 32, Color.white); + room.AddArrow(7 * 28, 6 * 32, Arrow.DIR_LEFT, 28, Color.white); + room.AddArrow(13 * 28, 6 * 32, Arrow.DIR_RIGHT, 28, Color.white); + } + {// Room 4 : Sensor Editor Room, Magnetic Shield here + Room room = rooms.elementAt(4); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Sensor Editor", 64, 56, 560); + room.AddTextBox("Magnetic Storm Shield (For Robots Only)", 60, 346, 560); + items.addElement(new StormShield(3 * 28, 8 * 32, room)); + } + {// Room 5 : Street Maze + Room room = rooms.elementAt(5); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3}, + {3, 3, 0, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 0, 0}, + {3, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 0, 0}, + {3, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 3, 3} + }; + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + } + {// Room 6 : Street Maze + Room room = rooms.elementAt(6); + room.RoomArray = new int[][]{ + {3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 3}, + {0, 0, 0, 0, 3, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 3}, + {0, 0, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 3, 3, 3, 0, 0, 3, 3}, + {0, 0, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 0, 3, 0, 0, 3, 0, 0, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 0, 3, 0, 0, 3, 0, 0, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 0, 0, 3, 3} + }; + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + } + {// Room 7 : Street Maze + Room room = rooms.elementAt(7); + room.RoomArray = new int[][]{ + {3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 0, 0, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 0, 0, 3, 3, 3, 3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 0}, + {3, 3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0}, + {3, 3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 3, 3, 3, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3}, + {3, 0, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3} + }; + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + } + {// Room 8 : Brown Tunnel + Room room = rooms.elementAt(8); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8} + }; + } + {// Room 9 : Lower Elevator, Trash Pile + Room room = rooms.elementAt(9); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 11, 11, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 11, 11, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + room.AddTextBox("ELEVATOR", 9 * 28, 152, 560); + room.AddTextBox("The things robots throw away...", 0, 6 * 32, 200); + room.AddArrow(14 * 28, 4 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new ElevatorKey(1 * 28, 9 * 32, room)); + String[] filelist = {"trash0.gif", "trash1.gif", "trash2.gif", "trash3.gif"}; + room.graphix.addElement(new Graphix(filelist, 28, 8 * 32)); + } + {// Room 10 : Stairs, Sentry + Room room = rooms.elementAt(10); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7} + }; + room.AddTextBox("Use elevator.", 8 * 28, 10 * 32, 560); + int[] pace = {6 * 28, 2 * 32, 6 * 28, 8 * 32}; + int[] pounce = {5 * 28, 3 * 32, 14 * 28, 5 * 32, 12 * 28, 0, + 5 * 28, 6 * 32, 14 * 28, 8 * 32, 9 * 28, 11 * 32}; + items.addElement(new Sentry(7 * 28, 2 * 32, room, pace, pounce, true)); + } + {// Room 11 : Upper Elevator, Top of Stairs + Room room = rooms.elementAt(11); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7} + }; + items.addElement(new Crystal(7 * 28, 4 * 32, room, 100000)); + } + {// Room 12 : Vending Machine + Room room = rooms.elementAt(12); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 14, 14, 14, 14, 14, 14, 14, 14, 14, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7} + }; + room.AddTextBox("..........................................", 28, 274, 560); + room.AddTextBox("1) Insert Token ", 112, 6 * 32, 560); + room.AddTextBox("2) Pull ", 308, 96, 560); + room.AddTextBox("VENDING MACHINE", 48, 50, 560); + room.AddArrow(3 * 28, 5 * 32, Arrow.DIR_UP, 32, Color.white); + room.AddArrow(11 * 28 + 22, 4 * 32 + 4, Arrow.DIR_DOWN, 30, Color.white); + items.addElement(new VendingHandle(11 * 28, 4 * 32 + 10, room)); + items.addElement(new F12Form(3 * 28, 2 * 32, room)); + } + {// Room 13 : Blue Maze : Button Room + Room room = rooms.elementAt(13); + room.RoomArray = new int[][]{ + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 7}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {20, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {20, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {20, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + items.addElement(new HiddenCamera(room)); + items.addElement(new FFButton(10 * 28, 5 * 32, room)); + } + {// Room 14 : Blue Maze + Room room = rooms.elementAt(14); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7} + }; + } + {// Room 15 : Blue Maze + Room room = rooms.elementAt(15); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + } + {// Room 16 : Street Maze + Room room = rooms.elementAt(16); + room.RoomArray = new int[][]{ + {3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 0, 0, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 0, 3, 0, 0, 3, 0, 0, 3, 3}, + {3, 0, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3}, + {3, 0, 0, 3, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3}, + {3, 0, 0, 3, 3, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0}, + {3, 3, 3, 3, 0, 0, 3, 3, 3, 3, 3, 0, 0, 3, 0, 0, 3, 0, 0, 0}, + {3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 3, 3, 0, 0, 3}, + {3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 3, 3} + }; + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + } + {// Room 17 : Street Maze + Room room = rooms.elementAt(17); + room.RoomArray = new int[][]{ + {3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 3, 3}, + {3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3}, + {3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 3, 3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 3, 0, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 3, 3, 3}, + {0, 0, 0, 3, 3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 0, 0, 3, 3}, + {0, 0, 3, 0, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 3, 0, 0, 3, 3}, + {0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 3}, + {3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 0, 0, 3, 3} + }; + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + } + {// Room 18 : Street Maze + Room room = rooms.elementAt(18); + room.RoomArray = new int[][]{ + {3, 0, 0, 0, 3, 3, 0, 0, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 3, 3, 3, 3, 3, 0, 0, 3}, + {3, 0, 0, 3, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 3, 0, 0, 3, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 3, 0, 0, 3, 0, 0, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3}, + {3, 0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3}, + {3, 0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 3, 3, 3, 0, 0, 3}, + {3, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 3, 0, 0, 3} + }; + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new SmallChip(28 + 14, 2 * 32 + 16, room, "6")); + } + {// Room 19 : Street Tunnel + Room room = rooms.elementAt(19); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8} + }; + } + {// Room 20 : Blue Maze + Room room = rooms.elementAt(20); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 0, 0, 0, 0, 0, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + } + {// Room 21 : Blue Maze + Room room = rooms.elementAt(21); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7} + }; + items.addElement(new SmallChip(10 * 28, 3 * 32, room, "5")); + } + {// Room 22 : Blue Maze + Room room = rooms.elementAt(22); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 7, 7} + }; + items.addElement(new ContactSensor(13 * 28, 8 * 32, room, + new Key(0, 0, null, Color.blue))); + } + {// Room 23 : Blue Maze : 2 buttons + Room room = rooms.elementAt(23); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 16, 0, 0, 0, 0, 0, 0, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7}, + {0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0}, + {0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7}, + {7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 17, 0, 0, 0, 0, 0, 0, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + room.AddTextBox("Two buttons a day keep the sentry away.", 148, 5 * 32, 250); + int[] pace = {3 * 28, 4 * 32, 3 * 28, 9 * 32}; + int[] protect = {4 * 28, 1 * 32, 6 * 28, 3 * 32, 0, 2 * 32, + 4 * 28, 3 * 32, 6 * 28, 9 * 32, 0, 6 * 32, + 4 * 28, 9 * 32, 6 * 28, 11 * 32, 0, 9 * 32}; + items.addElement(new Sentry(3 * 28, 3 * 32, room, pace, protect, true)); + } + {// Room 24 : Blue Maze: Button Anteroom + Room room = rooms.elementAt(24); + room.RoomArray = new int[][]{ + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 7}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 20}, + {0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 20}, + {0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 20}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 19, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 18, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + room.AddTextBox("Look into the next room.", 14 * 28, 9 * 32 + 16, 150); + room.AddArrow(17 * 28, 10 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + {// Room 25 : Blue Maze + Room room = rooms.elementAt(25); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 7, 0, 0, 0, 0, 0, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + } + {// Room 26 : Blue Maze + Room room = rooms.elementAt(26); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7} + }; + } + {// Room 27 : Blue Maze + Room room = rooms.elementAt(27); + room.RoomArray = new int[][]{ + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7}, + {7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + } + {// Room 28 : Brown Tunnel + Room room = rooms.elementAt(28); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8} + }; + } + {// Room 29 : Blue Maze : Form Taker + Room room = rooms.elementAt(29); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 0, 0, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 0, 0, 7, 7} + }; + room.AddTextBox("Submit a Form-12, please.", 3 * 28, 3 * 32, 150); + room.AddTextBox(" OFFICIAL GATEKEEPER", 112, 9 * 32, 200); + room.AddGraphix("trashcan.gif", 2 * 28, 8 * 32); + items.addElement(new GateKeeper(7 * 28, 4 * 32, room)); + items.addElement(new DirectionalSensor(16 * 28, 5 * 32, room, + new Button(0, 0, null, Color.white))); + } + {// Room 30 : Blue Maze + Room room = rooms.elementAt(30); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0}, + {7, 0, 0, 0, 7, 0, 0, 0, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {7, 0, 0, 0, 7, 0, 0, 0, 7, 7, 7, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7} + }; + items.addElement(new DirectionalSensor(6 * 28, 3 * 32, room, new Key(0, 0, null, Color.blue))); + } + {// Room 31 : Blue Maze + Room room = rooms.elementAt(31); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7} + }; + } + {// Room 32 : Blue Maze + Room room = rooms.elementAt(32); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 7}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0} + }; + } + {// Room 33 : Brown Tunnel + Room room = rooms.elementAt(33); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8} + }; + } + {// Room 34 : Street Maze : Token + Room room = rooms.elementAt(34); + room.RoomArray = new int[][]{ + {3, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 3, 0, 0, 3}, + {3, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 3, 3} + }; + room.AddTextBox("I never could hang onto money...", 3 * 28, 152, 560); + items.addElement(new SlipperyToken(3 * 28, 3 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + items.addElement(new StormCloud(10 * 28, 6 * 32, room)); + } + {// Room 35 : Elevator + Room room = rooms.elementAt(35); + room.RoomArray = new int[][]{ + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4}, + {4, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} + }; + room.AddArrow(10 * 28 - 2, 66, Arrow.DIR_UP, 28, Color.green); + room.AddArrow(10 * 28 - 1, 66, Arrow.DIR_UP, 28, Color.green); + room.AddArrow(10 * 28, 66, Arrow.DIR_UP, 28, Color.green); + room.AddArrow(10 * 28 + 1, 66, Arrow.DIR_UP, 28, Color.green); + room.AddArrow(10 * 28 + 2, 66, Arrow.DIR_UP, 28, Color.green); + } - // Intro Maze - LinkRoomsUpDown(1,2); - LinkRoomsUpDown(2,3); - LinkRoomsUpDown(3,1); - LinkRoomsLeftRight(1,3); - LinkRoomsLeftRight(3,1); + {// Room 36 : Secret room + Room room = rooms.elementAt(36); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Good work! You Found me again!", + 2 * 28, 2 * 32, 500); + room.AddTextBox("You may find this hard to swallow, but there is no key to Secret #4. Just ride a robot through one of the challanges.", + 2 * 28, 4 * 32, 500); + String[] helperlist = { + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper1.gif", "helper4.gif", "helper2.gif", "helper3.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper5.gif", "helper5.gif", "helper5.gif", "helper5.gif", + }; + Graphix helper = new Graphix(helperlist, 15 * 28, 8 * 32); + room.graphix.addElement(helper); + items.addElement(new Crystal(2 * 28, 8 * 32, room, 100000)); + items.addElement(new Key(2 * 28, 9 * 32, room, Color.red)); + } - // Exit from Intro Maze - int[] roomlist1={4,2,33,6}; - LinkRoomsHorizontally(roomlist1); + // Intro Maze + LinkRoomsUpDown(1, 2); + LinkRoomsUpDown(2, 3); + LinkRoomsUpDown(3, 1); + LinkRoomsLeftRight(1, 3); + LinkRoomsLeftRight(3, 1); - // Main Street - int[] roomlist2={5,6,16,17,7,18,34,5}; - LinkRoomsVertically(roomlist2); + // Exit from Intro Maze + int[] roomlist1 = {4, 2, 33, 6}; + LinkRoomsHorizontally(roomlist1); - // Entrance to lower Elevator - LinkRoomsLeftRight(5,8); - LinkRoomsLeftRight(8,9); + // Main Street + int[] roomlist2 = {5, 6, 16, 17, 7, 18, 34, 5}; + LinkRoomsVertically(roomlist2); - // Stairs to vending machine - int[] roomlist3={12,11,10,9}; - LinkRoomsVertically(roomlist3); + // Entrance to lower Elevator + LinkRoomsLeftRight(5, 8); + LinkRoomsLeftRight(8, 9); - // Tunnel through Street Maze - LinkRoomsLeftRight(16,19); - LinkRoomsLeftRight(19,17); + // Stairs to vending machine + int[] roomlist3 = {12, 11, 10, 9}; + LinkRoomsVertically(roomlist3); - // Blue Maze - int[][] roomgrid = { - {30,20,21,14,22,30}, - {31,23,24,13,29,31}, - {32,25,26,15,27,32}, - {30,20,21,14,22,30} - }; - LinkRoomsGrid(roomgrid); + // Tunnel through Street Maze + LinkRoomsLeftRight(16, 19); + LinkRoomsLeftRight(19, 17); - // Tunnel to Blue Maze - LinkRoomsLeftRight(7,28); - LinkRoomsLeftRight(28,31); + // Blue Maze + int[][] roomgrid = { + {30, 20, 21, 14, 22, 30}, + {31, 23, 24, 13, 29, 31}, + {32, 25, 26, 15, 27, 32}, + {30, 20, 21, 14, 22, 30} + }; + LinkRoomsGrid(roomgrid); - gameCursor = new GameCursor(10*28,6*32,(Room) rooms.elementAt(1)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - solderingPen = new SolderingPen(); - remote = new Remote(); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - player = gameCursor; - currentViewer = player; + // Tunnel to Blue Maze + LinkRoomsLeftRight(7, 28); + LinkRoomsLeftRight(28, 31); - } + gameCursor = new GameCursor(10 * 28, 6 * 32, rooms.elementAt(1)); + helpCam = new HelpCam(rooms.elementAt(0)); + solderingPen = new SolderingPen(); + remote = new Remote(); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + player = gameCursor; + currentViewer = player; + + } } diff --git a/src/com/droidquest/levels/RO4.java b/src/com/droidquest/levels/RO4.java index a149f01..5549fe8 100644 --- a/src/com/droidquest/levels/RO4.java +++ b/src/com/droidquest/levels/RO4.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.avatars.GameCursor; @@ -10,1091 +8,1044 @@ import com.droidquest.avatars.Remote; import com.droidquest.avatars.SolderingPen; import com.droidquest.decorations.Graphix; import com.droidquest.devices.SmallChip; -import com.droidquest.items.CamDisk; -import com.droidquest.items.Disk; -import com.droidquest.items.EnergyButton; -import com.droidquest.items.Key; -import com.droidquest.items.MasterRobot; -import com.droidquest.items.NotAButton; -import com.droidquest.items.SpyCam; -import com.droidquest.items.Switch4A; -import com.droidquest.items.Switch4B; -import com.droidquest.items.Switch4C; -import com.droidquest.items.Switch4D; -import com.droidquest.items.TrashCollector; -import com.droidquest.materials.AntiPlayer; -import com.droidquest.materials.CrystalRecharger; -import com.droidquest.materials.ElevatorDoor; -import com.droidquest.materials.ForceField; -import com.droidquest.materials.Lock; -import com.droidquest.materials.Material; -import com.droidquest.materials.MineField; -import com.droidquest.materials.Monitor; -import com.droidquest.materials.PlayerBlocker; -import com.droidquest.materials.Portal; +import com.droidquest.items.*; +import com.droidquest.materials.*; -class RO4 extends Level -{ -public RO4 (RoomDisplay rd) - { - super(rd); - - materials.addElement(new Material(true, false)); // 0=Empty Space - materials.addElement(new Material(new Color(0,204,0),false, true)); // 1=green - materials.addElement(new Material(new Color(128,128,128),false, true)); // 2=grey - materials.addElement(new Material(new Color(0,0,255),false, true)); // 3=blue - materials.addElement(new Material(new Color(255,128,0),false, true)); // 4=orange - materials.addElement(new Material(new Color(255,255,255),false, true)); // 5=white - materials.addElement(new Material(new Color(0,0,128),false, true)); // 6=dk blue - materials.addElement(new Material(new Color(192,192,255),false, true)); // 7=grey-blue - materials.addElement(new MineField()); // 8=Minefield - materials.addElement(new Material(new Color(255,224,192),false, true)); // 9= - materials.addElement(new Material(new Color(63,32,0),false, true)); // 10=dk orange - materials.addElement(new Material(new Color(128,128,128),false, true)); // 11=grey - materials.addElement(new Monitor()); // 12=monitor - materials.addElement(new CrystalRecharger()); // 13=Recharger - materials.addElement(new PlayerBlocker(Color.black)); // 14=FF (Energy) - materials.addElement(new ElevatorDoor()); // 15=ElevatorDoor - materials.addElement(new AntiPlayer()); // 16=AntiPlayer - String[] grillwork = {"ventgrill.gif"}; - materials.addElement(new PlayerBlocker(grillwork)); // 17=VentGrill - int[][] lockProgram1 = { - {Lock.WIDE}, - {17,9,0, 17,10,0}, - {16,9,0, 16,10,0}, - {15,9,0, 15,10,0}, - {Lock.REMOVE}, - {15,9,9, 15,10,9}, - {16,9,9, 16,10,9}, - {17,9,9, 17,10,9} - }; - materials.addElement(new Lock(new Color(255,128,0), - Color.blue, lockProgram1)); // 18= Lock1 - int[][] lockProgram2 = { - {Lock.NARROW}, - {2,3,0}, - {Lock.REMOVE}, - {2,3,9} - }; - materials.addElement(new Lock(new Color(255,128,0), - Color.blue, lockProgram2)); // 19= Lock1 - materials.addElement(new ForceField("OrangeRobot", - new Color(255,128,0))); // 20=OrangeFF - materials.addElement(new ForceField("WhiteRobot", Color.white)); // 21=WhiteFF - materials.addElement(new ForceField("BlueRobot", Color.blue)); // 22=BlueFF - materials.addElement(new Switch4A()); // 23=Switch - materials.addElement(new Switch4B()); // 24=Switch - materials.addElement(new Switch4C()); // 25=Switch - materials.addElement(new Switch4D()); // 26=Switch - materials.addElement(new Portal("RO5.lvl",true, true)); // 27=Portal - - int[][] lockProgram3 = { - {Lock.NARROW}, - {9,11,0, 10,11,0}, - {8,11,0, 11,11,0}, - {Lock.NARROW}, - {8,11,5, 11,11,5}, - {9,11,5, 10,11,5}, - }; - materials.addElement(new Lock(Color.red,Color.red, lockProgram3)); // 28= Lock1 +import java.awt.*; - for(int a = 0; a<62; a++) - rooms.addElement(new Room()); - - String[] camFiles = { - "cam0.gif", - "cam0.gif", - "cam1.gif", - "cam1.gif", - "cam2.gif", - "cam2.gif", - "cam1.gif", - "cam1.gif" - }; - Graphix camGraphix = new Graphix(camFiles, 28,32); - - - {// Room 0 : Help Screen - Room room = (Room) rooms.elementAt(0); - room.SetMaterialOutline(0,0,19,11,1); - room.AddTextBox("MASTER COMPUTER CENTER",136,64, 560); - room.AddTextBox("HINTS:",2*28,3*32, 560); - room.AddTextBox("A central robot can become your friend.",4*28,4*32, 400); - room.AddTextBox("The Sweeper 'Bot likes to keep the hallways clean.",4*28,6*32+16, 400); - room.AddTextBox("Chips 7 & 8 are blank.",4*28,9*32, 400); - room.AddTextBox("(To continue, press RETURN.)",4*28,11*32, 560); - } - {// Room 1 : Master Computer Help - Room room = (Room) rooms.elementAt(1); - room.SetMaterialOutline(0,0,19,11,3); - room.AddTextBox("THE MASTER COMPUTER",6*28,2*32, 500); - room.AddTextBox("The master computer controls many of the features of Robotropolis.", - 72,4*32, 480); - room.AddTextBox("Use the cameras to monitor robot progress.", - 72,6*32, 500); - room.AddTextBox("The computer can be turned off and the robot released by pressing the four buttons.", - 72,8*32, 450); - room.AddTextBox("(To continue, press RETURN.)",4*28,11*32, 560); - - } - {// Room 2 : Minefield Help - Room room = (Room) rooms.elementAt(2); - room.SetMaterialFromRoom(1); - room.AddTextBox("THE MINEFIELD",6*28,2*32,450); - room.AddTextBox("The walls in the map room are in the same position as the mines in the minefield.", - 2*28,3*32,500); - room.AddTextBox("Mines are set off when a robot thrusts against them for more than an instant.", - 2*28,6*32,500); - room.AddTextBox("Additional mines keep out non-robots.",2*28,8*32,500); - room.AddTextBox("Robot communication is helpful.",2*28,9*32,500); - room.AddTextBox("(To continue, press RETURN.)",4*28,11*32, 560); - } - {// Room 3 : Force Field Help - Room room = (Room) rooms.elementAt(3); - room.SetMaterialFromRoom(1); - room.AddTextBox("THE FORCE FIELD TUNNEL",6*28,2*32,500); - room.AddTextBox("Robot relays pass key items along.", 2*28,4*32,500); - room.AddTextBox("Plan ahead for the return journey.",2*28,6*32,500); - room.AddTextBox("(To continue, press RETURN.)",4*28,11*32, 560); - } - {// Room 4 : Ventilation Shaft Help - Room room = (Room) rooms.elementAt(4); - room.SetMaterialFromRoom(1); - room.AddTextBox("THE VENTILATION SHAFT",6*28,2*32,500); - room.AddTextBox("Counting chips can pick out air tubes.", 2*28,4*32,500); - room.AddTextBox("Be sure to pick the right tube.",2*28,6*32, 560); - room.AddTextBox("(To continue, press RETURN.)",4*28,11*32, 560); - } - {// Room 5 : Top Left Corridor - Room room = (Room) rooms.elementAt(5); - room.SetMaterialFill(0,0,19,2,3); - room.SetMaterialFill(0,0,4,11,3); - room.SetMaterialFill(15,9,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 6 : Top Corridor - Room room = (Room) rooms.elementAt(6); - room.SetMaterialFill(0,0,19,2,3); - room.SetMaterialFill(0,9,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 7 : Top Corridor - Room room = (Room) rooms.elementAt(7); - room.SetMaterialFill(0,0,19,2,3); - room.SetMaterialFill(0,9,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 8 : Top Corridor, Entance to Map Room - Room room = (Room) rooms.elementAt(8); - room.SetMaterialFill(0,0,19,2,3); - room.SetMaterialFill(0,9,7,11,3); - room.SetMaterialFill(12,9,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 9 : Top Corridor - Room room = (Room) rooms.elementAt(9); - room.SetMaterialFill(0,0,19,2,3); - room.SetMaterialFill(0,9,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 10 : Top Corridor - Room room = (Room) rooms.elementAt(10); - room.SetMaterialFill(0,0,19,2,3); - room.SetMaterialFill(0,9,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 11 : Top Right Corridor - Room room = (Room) rooms.elementAt(11); - room.SetMaterialFill(0,0,19,2,3); - room.SetMaterialFill(15,0,19,11,3); - room.SetMaterialFill(0,9,4,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 12 : Right Corridor, Exit from Map Room - Room room = (Room) rooms.elementAt(12); - int[][] table = { - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 13 : Right Corridor - Room room = (Room) rooms.elementAt(13); - int[][] table = { - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3} - }; - room.RoomArray = table; - ((Room) rooms.elementAt(15)).RoomArray = table; - ((Room) rooms.elementAt(33)).RoomArray = table; - ((Room) rooms.elementAt(35)).RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 14 : Right Corridor, Key Tunnel - Room room = (Room) rooms.elementAt(14); - int[][] table = { - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3} - }; - room.RoomArray = table; - ((Room) rooms.elementAt(16)).RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 15 : Right Corridor - Room room = (Room) rooms.elementAt(15); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 16 : Right Corridor, Main Office - Room room = (Room) rooms.elementAt(16); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 17 : Bottom Right Corridor - Room room = (Room) rooms.elementAt(17); - int[][] table = { - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 18 : Bottom Corridor - Room room = (Room) rooms.elementAt(18); - room.SetMaterialFill(0,0,19,2,3); - room.SetMaterialFill(0,9,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 19 : Bottom Corridor, Entrance - Room room = (Room) rooms.elementAt(19); - room.SetMaterialFill(0,0,7,2,3); - room.SetMaterialFill(12,0,19,2,3); - room.SetMaterialFill(0,9,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - items.addElement(new TrashCollector(266,176,room)); - } - {// Room 20 : Ventilation Shaft Maze - Room room = (Room) rooms.elementAt(20); - int[][] table = { - {5,5,5,5,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,5}, - {0,0,0,0,0,5,0,0,0,0,0,0,0,5,5,0,0,0,0,5}, - {0,0,0,0,0,5,0,0,0,0,0,0,0,5,5,0,0,0,0,5}, - {5,5,0,0,0,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5}, - {0,0,0,0,0,5,0,0,0,5,5,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,5,0,0,0,5,5,0,0,0,0,0,0,0,0,0}, - {5,5,5,5,5,5,0,0,0,5,5,0,0,0,5,5,5,5,5,5}, - {5,5,5,5,5,5,0,0,0,5,5,0,0,0,5,5,5,5,5,5}, - {5,5,5,5,5,5,0,0,0,5,5,0,0,0,5,5,5,5,5,5}, - {5,5,5,5,5,5,0,0,0,5,5,0,0,0,5,5,0,0,0,0}, - {5,5,5,5,5,5,0,0,0,5,5,0,0,0,5,5,0,0,0,0}, - {5,5,5,5,5,5,0,0,0,5,5,0,0,0,5,5,0,0,0,5} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} VENTILATION SHAFT",126,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 21 : Ventilation Shaft Exit (Entrance to Master Chamber) - Room room = (Room) rooms.elementAt(21); - room.SetMaterialFill(0,0,19,1,3); - room.SetMaterialFill(0,0,2,11,3); - room.SetMaterialFill(17,0,19,4,3); - room.SetMaterialFill(17,8,19,11,3); - room.SetMaterialFill(7,10,19,11,3); - room.SetMaterialFill(19,5,19,8,17); - room.AddTextBox("{BIG} {000,204,000} NORTH CHAMBER", 98,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 22 : Key Tunnel, Bottom Right - Room room = (Room) rooms.elementAt(22); - room.SetMaterialFill(0,0,14,1,3); - room.SetMaterialFill(18,0,19,11,3); - room.SetMaterialFill(0,10,19,11,3); - room.AddTextBox("{BIG} {000,204,000} TUNNEL BYPASS",104,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 23 : Key Tunnel, Bottom Left - Room room = (Room) rooms.elementAt(23); - room.SetMaterialFill(0,0,2,11,3); - room.SetMaterialFill(0,10,19,11,3); - room.SetMaterialFill(5,0,19,1,3); - room.AddTextBox("{BIG} {000,204,000} TUNNEL BYPASS",104,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 24 : Upper Library - Room room = (Room) rooms.elementAt(24); - room.SetMaterialFill(0,0,19,0,3); - room.SetMaterialFill(0,0,0,3,3); - room.SetMaterialFill(0,7,0,11,3); - room.SetMaterial(19,11,3); - room.AddTextBox("{BIG} {000,204,000} LIBRARY",185,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 25 : Library, entrance to Ventilation Shaft - Room room = (Room) rooms.elementAt(25); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialFill(0,1,0,10,0); - room.SetMaterialFill(19,5,19,6,17); - room.AddTextBox("{BIG} {000,204,000} LIBRARY",185,708, 560); - room.graphix.addElement(camGraphix); - items.addElement(new Disk(17*28,3*32,room,Color.blue,4)); - } - {// Room 26 : Lower Library - Room room = (Room) rooms.elementAt(26); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialFill(1,0,18,0,0); - room.SetMaterialFill(19,7,19,9,0); - room.AddTextBox("{BIG} {000,204,000} LIBRARY",185,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 27 : Computer Room - Room room = (Room) rooms.elementAt(27); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialFill(0,7,0,9,0); - room.SetMaterial(10,2,12); - room.AddTextBox("{BIG} {000,204,000} COMPUTER ROOM",104,708, 560); - room.AddGraphix("monitor.gif",8*28,2*32); - room.graphix.addElement(camGraphix); - items.addElement(new CamDisk(2*28,9*32,room)); - items.addElement(new SpyCam(room)); - } - {// Room 28 : Bottom Corridor, Entrance - Room room = (Room) rooms.elementAt(28); - room.SetMaterialFill(0,0,7,2,3); - room.SetMaterialFill(12,0,19,2,3); - room.SetMaterialFill(0,9,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 29 : Bottom Corridor - Room room = (Room) rooms.elementAt(29); - room.SetMaterialFill(0,0,19,2,3); - room.SetMaterialFill(0,9,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 30 : Bottom Corridor - Room room = (Room) rooms.elementAt(30); - room.SetMaterialFill(0,0,19,2,3); - room.SetMaterialFill(0,9,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 31 : Bottom Left Corridor - Room room = (Room) rooms.elementAt(31); - room.SetMaterialFill(0,0,4,11,3); - room.SetMaterialFill(0,9,19,11,3); - room.SetMaterialFill(15,0,19,2,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 32 : Left Corridor, Entrance to Elevator - Room room = (Room) rooms.elementAt(32); - room.SetMaterialFill(0,0,4,11,3); - room.SetMaterialFill(15,0,19,3,3); - room.SetMaterialFill(15,7,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 33 : Left Corridor - Room room = (Room) rooms.elementAt(33); - room.SetMaterialFill(0,0,4,11,3); - room.SetMaterialFill(15,0,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 34 : Left Corridor, Entrance to Minefield - Room room = (Room) rooms.elementAt(34); - room.SetMaterialFill(0,0,4,11,3); - room.SetMaterialFill(15,0,19,6,3); - room.SetMaterialFill(15,10,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 35 : Left Corridor - Room room = (Room) rooms.elementAt(35); - room.SetMaterialFill(0,0,4,11,3); - room.SetMaterialFill(15,0,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 36 : Master Chamber - Room room = (Room) rooms.elementAt(36); - int[][] table = { - {4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4,26, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 0, 0, 0,25, 0, 0, 4, 4, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 4}, - {4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4}, - {4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4}, - {4, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 4, 4, 0, 0,23, 0, 0, 0, 4}, - {0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 4}, - {0, 0, 0, 0, 0, 0, 0,24, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 4}, - {0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} MASTER COMPUTER", 37,708, 560); - room.graphix.addElement(camGraphix); - items.addElement(new MasterRobot(9*28,5*32+12,room)); - } - {// Room 37 : Left Corridor, Entrance to Library - Room room = (Room) rooms.elementAt(37); - room.SetMaterialFill(0,0,4,11,3); - room.SetMaterialFill(15,0,19,3,3); - room.SetMaterialFill(15,7,19,11,3); - room.AddTextBox("{BIG} {000,204,000} HALLWAY",180,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 38 : Map Antechamber - Room room = (Room) rooms.elementAt(38); - int[][] table = { - {6,6,6,6,6,6,6,6,0,0,0,0,6,6,6,6,6,6,6,6}, - {6,6,6,6,6,6,6,6,0,0,0,0,6,6,6,6,6,6,6,6}, - {6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6}, - {6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6}, - {6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6}, - {6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6}, - {6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6}, - {6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} MAP ANTEROOM",118,708, 560); - room.graphix.addElement(camGraphix); - items.addElement(new Disk(6*28,8*32,room,Color.yellow,2)); - } - {// Room 39 : Map Room, Top Left - Room room = (Room) rooms.elementAt(39); - int[][] table = { - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {6,0,0,0,6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,6,0,0,0,6,0,0,0,0,6,6,6,6,6,0,0}, - {6,0,0,0,0,0,0,0,6,0,0,0,0,6,6,6,6,6,0,0}, - {6,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,6,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0}, - {0,0,0,0,6,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0}, - {6,0,0,0,6,0,0,0,6,6,6,6,6,6,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,6,6,6,6,6,6,0,0,0,0,0,6} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} MINEFIELD MAP",104,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 40 : Main Office - Room room = (Room) rooms.elementAt(40); - int[][] table = { - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}, - {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} MAIN OFFICE",131,708, 560); - items.addElement(new Disk(17*28,2*32,room,Color.red,1)); - room.graphix.addElement(camGraphix); - } - {// Room 41 : Map Room, Top Right - Room room = (Room) rooms.elementAt(41); - int[][] table = { - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,6}, - {0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,6,6,6,6,6,6,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,6,0,0,0,0,6,6,6,6,6,0,0,0,0,0,0}, - {0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} MINEFIELD MAP",104,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 42 : Minefield, Bottom Left - Room room = (Room) rooms.elementAt(42); - int[][] table = { - {8,0,0,0,0,0,0,0,8,8,8,8,8,8,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {8,0,0,0,8,8,8,8,8,8,0,0,0,0,0,0,0,8,0,0}, - {8,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0}, - {8,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0}, - {8,0,0,0,0,0,0,0,0,0,8,8,0,0,0,0,0,8,0,0}, - {8,0,0,0,0,0,0,0,0,0,8,8,0,0,0,0,0,8,0,0}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} MINEFIELD",159,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 43 : Minefield, Bottom Right - Room room = (Room) rooms.elementAt(43); - int[][] table = { - {8,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {0,0,0,0,8,0,0,0,0,8,0,0,0,0,0,0,0,0,0,8}, - {0,0,0,0,0,0,0,0,0,8,8,8,8,8,0,0,0,0,0,8}, - {0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,8}, - {0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,8}, - {0,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {0,8,8,8,8,0,0,0,0,0,0,0,0,0,8,0,0,0,0,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,8}, - {0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,8}, - {0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} MINEFIELD",159,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 44 : Minefield, Top Left - Room room = (Room) rooms.elementAt(44); - int[][] table = { - { 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - { 8,0,0,0,8,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0}, - { 8,0,0,0,8,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0}, - { 8,0,0,0,8,0,0,0,8,0,0,0,0,8,8,8,8,8,0,0}, - { 8,0,0,0,0,0,0,0,8,0,0,0,0,8,8,8,8,8,0,0}, - { 8,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0}, - { 8,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0}, - {16,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {16,0,0,0,8,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0}, - {16,0,0,0,8,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0}, - { 8,0,0,0,8,0,0,0,8,8,8,8,8,8,0,0,0,0,0,8}, - { 8,0,0,0,0,0,0,0,8,8,8,8,8,8,0,0,0,0,0,8} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} MINEFIELD",159,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 45 : Minefield, Top Right - Room room = (Room) rooms.elementAt(45); - int[][] table = { - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,8}, - {0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {0,0,0,0,8,8,8,8,8,8,0,0,0,0,0,0,0,0,0,8}, - {0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {0,0,0,0,8,0,0,0,0,8,8,8,8,8,0,0,0,0,0,0}, - {0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {8,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {8,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} MINEFIELD",159,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 46 : Key Tunnel, Top Left - Room room = (Room) rooms.elementAt(46); - int[][] table = { - {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, - {9, 9, 9, 0, 0, 0, 0, 0,20, 0, 0, 0,21, 0, 0, 0,21, 0, 0, 0}, - {9, 9, 9, 0, 0, 0, 0, 0,20, 0, 0, 0,21, 0, 0, 0,21, 0, 0, 0}, - {0, 0, 9, 0, 0, 0, 0, 0,20, 0, 0, 0,21, 0, 0, 0,21, 0, 0, 0}, - {9, 9, 9, 0, 0, 0, 0, 0,20, 0, 0, 0,21, 0, 0, 0,21, 0, 0, 0}, - {9, 9, 9, 0, 0, 0, 0, 0,20, 0, 0, 0,21, 0, 0, 0,21, 0, 0, 0}, - {9, 9, 9, 0, 0, 0, 0, 0,20, 0, 0, 0,21, 0, 0, 0,21, 0, 0, 0}, - {9, 9, 9, 0, 0, 0, 0, 0,20, 0, 0, 0,21, 0, 0, 0,21, 0, 0, 0}, - {9, 9, 9, 0, 0, 0, 0, 0,20, 0, 0, 0,21, 0, 0, 0,21, 0, 0, 0}, - {9, 9, 9, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, - {9, 9, 9, 0, 0,19, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, - {9, 9, 9, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} FORCE FIELD TUNNEL",132,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 47 : Key Tunnel, Top Right - Room room = (Room) rooms.elementAt(47); - int[][] table = { - {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, - {0, 0, 0,22, 0, 0, 0,22, 0, 0, 0,20, 0, 0, 0, 0, 0, 0, 9, 9}, - {0, 0, 0,22, 0, 0, 0,22, 0, 0, 0,20, 0, 0, 0, 0, 0, 0,18, 9}, - {0, 0, 0,22, 0, 0, 0,22, 0, 0, 0,20, 0, 0, 0, 0, 0, 0, 9, 9}, - {0, 0, 0,22, 0, 0, 0,22, 0, 0, 0,20, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0,22, 0, 0, 0,22, 0, 0, 0,20, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0,22, 0, 0, 0,22, 0, 0, 0,20, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0,22, 0, 0, 0,22, 0, 0, 0,20, 0, 0, 0, 0, 0, 0, 9, 9}, - {0, 0, 0,22, 0, 0, 0,22, 0, 0, 0,20, 0, 0, 0, 0, 0, 0, 9, 9}, - {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, - {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, - {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 9, 9} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} FORCE FIELD TUNNEL",132,708, 560); - room.graphix.addElement(camGraphix); - items.addElement(new Disk(16*28,2*32,room,Color.green,3)); - } - {// Room 48 : Ventilation Shaft Left - Room room = (Room) rooms.elementAt(48); - int[][] table = { - {5,5,5,5,5,5,0,0,0,5,5,0,0,0,5,5,0,0,0,5}, - {5,5,5,5,5,5,0,0,0,5,5,0,0,0,5,5,0,0,0,5}, - {5,5,5,5,5,5,0,0,0,5,5,0,0,0,5,5,0,0,0,5}, - {5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,5,5,5,5,5,0,0,0,5,5,0,0,0,5,5,0,0,0,5}, - {5,5,5,5,5,5,0,0,0,5,5,0,0,0,5,5,0,0,0,5}, - {5,5,5,5,5,5,0,0,0,5,5,0,0,0,5,5,0,0,0,5} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} VENTILATION SHAFT",126,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 49 : Ventilation Shaft Right - Room room = (Room) rooms.elementAt(49); - int[][] table = { - {5,5,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {5,5,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {5,5,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5}, - {5,5,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {5,5,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {5,5,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} VENTILATION SHAFT",126,708, 560); - room.graphix.addElement(camGraphix); - String[] fanlist = { - "fan0.gif", - "fan1.gif", - "fan2.gif", - "fan3.gif", - "fan2.gif", - "fan1.gif"}; - room.graphix.addElement(new Graphix(fanlist,17*28,5*32)); - } - {// Room 50 : Ventilation Shaft Maze - Room room = (Room) rooms.elementAt(50); - int[][] table = { - {5,5,5,5,5,5,0,0,0,5,5,0,0,0,5,5,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,5,5,0,0,0,5,5,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,5,5,0,0,0,5,5,0,0,0,0}, - {5,0,0,0,5,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5}, - {0,0,0,0,5,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5}, - {0,0,0,0,5,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5}, - {5,5,5,5,5,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5}, - {5,5,5,5,5,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5}, - {5,5,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5}, - {0,0,0,0,0,0,0,0,5,5,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,5,5,0,0,0,0,0,0,0,0,0,0}, - {5,5,5,5,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,5} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} VENTILATION SHAFT",126,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 51 : Ventilation Shaft Maze - Room room = (Room) rooms.elementAt(51); - int[][] table = { - {5,5,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {5,5,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {5,5,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {5,5,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {5,5,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {0,0,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {0,0,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {0,0,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {5,5,5,5,5,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {5,5,5,5,5,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {5,5,5,5,5,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {5,5,5,5,5,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} VENTILATION SHAFT",126,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 52 : Ventilation Shaft Maze - Room room = (Room) rooms.elementAt(52); - int[][] table = { - {5,5,5,5,5,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {0,0,0,0,0,5,5,5,0,0,0,0,5,5,0,0,0,0,0,0}, - {0,0,0,0,0,5,5,5,0,0,0,0,0,5,0,0,0,0,0,0}, - {5,5,0,0,0,5,5,5,5,0,0,0,0,5,5,5,5,5,5,5}, - {5,5,0,0,0,0,0,0,5,5,0,0,0,0,0,0,0,0,0,0}, - {5,5,0,0,0,0,0,0,5,5,0,0,0,0,0,0,0,0,0,0}, - {5,5,5,5,5,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5}, - {5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5}, - {5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,5,5,5}, - {0,0,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {0,0,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5}, - {5,5,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} VENTILATION SHAFT",126,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 53 : Map Room, Bottom Left - Room room = (Room) rooms.elementAt(53); - int[][] table = { - {6,0,0,0,0,0,0,0,6,6,6,6,6,6,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,6,6,6,6,6,6,0,0,0,0,0,0,0,6,0,0}, - {6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0}, - {6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0}, - {6,0,0,0,0,0,0,0,0,0,6,6,0,0,0,0,0,6,0,0}, - {6,0,0,0,0,0,0,0,0,0,6,6,0,0,0,0,0,6,0,0}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} MINEFIELD MAP",104,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 54 : Map Room, Bottom Right - Room room = (Room) rooms.elementAt(54); - int[][] table = { - {6,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,6,0,0,0,0,6,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,6}, - {0,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,6,6,6,6,0,0,0,0,0,0,0,0,0,6,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,6}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} MINEFIELD MAP",104,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 55 : Energy Chamber, Upper - Room room = (Room) rooms.elementAt(55); - int[][] table5 = { - {10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10} - }; - room.RoomArray = table5; - - room.AddTextBox("{BIG} {000,204,000} HIGH VOLTAGE ROOM",118,708, 560); - room.graphix.addElement(camGraphix); - items.addElement(new NotAButton(10*28, 6*32, room)); - items.addElement(new EnergyButton()); - } - {// Room 56 : Elevator, Left - Room room = (Room) rooms.elementAt(56); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} LOBBY",212,708, 560); - room.graphix.addElement(camGraphix); - } - {// Room 57 : Energy Chamber, Lower - Room room = (Room) rooms.elementAt(57); - int[][] table = { - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10,10,10}, - {10,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,10}, - {10,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10,10,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10,10,10,10,10,10,10,10, 0, 0, 0, 0,10,10,10,10,10,10,10,10} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} SAFETY ROOM",131,708, 560); - room.graphix.addElement(camGraphix); - room.AddGraphix("FFleft.gif",30,4*32+3); - room.AddGraphix("FFright.gif",18*28-2,4*32+3); - room.AddTextBox("..........................................",28,4*32+16, 560); - } - {// Room 58 : Trash Dump - Room room = (Room) rooms.elementAt(58); - int[][] table = { - {11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11}, - {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11}, - {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11}, - {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11}, - {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11}, - {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11}, - {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11}, - {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11}, - {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11}, - {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11}, - {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11}, - {11,11,11,11,11,11,11,11, 0, 0, 0, 0,11,11,11,11,11,11,11,11} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} TRASH DUMP",145,708, 560); - room.graphix.addElement(camGraphix); - items.addElement(new SmallChip(3*28, 9*32, room, "7")); - } - {// Room 59 : Elevator, Right - Room room = (Room) rooms.elementAt(59); - int[][] table = { - { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, - {15,15,15,15,15,15,15,15,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {15,15,15,15,15,15,15,15,15, 0, 0, 0, 0, 0, 0, 0, 0,27, 0, 2}, - {15,15,15,15,15,15,15,15,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {15,15,15,15,15,15,15,15,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {15,15,15,15,15,15,15,15,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {15,15,15,15,15,15,15,15,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {15,15,15,15,15,15,15,15,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {15,15,15,15,15,15,15,15,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {15,15,15,15,15,15,15,15,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {15,15,15,15,15,15,15,15,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {000,204,000} ELEVATOR",172,708, 560); - room.AddTextBox("\"Hold, please!\"",84,54, 560); - room.AddTextBox("HOLD",480,350, 560); - room.graphix.addElement(camGraphix); - room.AddGraphix("hold.gif",18*28,10*32-4); - items.addElement(new SmallChip(3*28, 9*32, room, "8")); - } +class RO4 extends Level { + public RO4(RoomDisplay rd) { + super(rd); - {// Room 60 : Purgatorium - Room room = (Room) rooms.elementAt(60); - int[][] table = { - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,5}, - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}}; - room.RoomArray = table; - room.AddTextBox("{BIG} {255,000,000} PURGATORIUM",131,64,500); - room.AddTextBox("(Please wait for Trash Room)",112,11*32,500); - } - {// Room 61 : Secret Room - Room room = (Room) rooms.elementAt(61); - int[][] table = { - {5,5,5,5,5,5,5,5,0,0,0,0,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}}; - room.RoomArray = table; - room.AddTextBox("Hello again, organic dude!",2*28,4*32,500); - room.AddTextBox("To find secret #5, you must enter a Zen state of mind... To open a door is to close a door, and to close a door is to open a door.", - 2*28,6*32,500); - String[] helperlist = { - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper1.gif","helper4.gif","helper2.gif","helper3.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper5.gif","helper5.gif","helper5.gif","helper5.gif", - }; - Graphix helper = new Graphix(helperlist,15*28, 8*32); - room.graphix.addElement(helper); - items.addElement(new Key(16*28,3*32,room,new Color(255,128,0))); - } - - // Main area map - int[][] roomgrid = - { - { 5, 6, 7, 8, 9,10,11}, - {37,24,25,38,39,41,12}, - {35,26,27,21,53,54,13}, - {34,44,45,36,46,47,14}, - {33,42,43,55,23,22,15}, - {32,56,59,57,58,40,16}, - {31,30,29,28,19,18,17} - }; - LinkRoomsGrid(roomgrid); - - // Ventilation shaft map - // - // 20 52 - // | | - //(25)- 48 ----- 49 -(38) - // | | - // | (21)- 51 -(53) - // | | - // 20 - 50 ----- 52 - 20 - // | - // 20 - - int[] roomlist1 = {25,48,49,38}; - int[] roomlist2 = {21,51,53}; - int[] roomlist3 = {20,50,52,20}; - int[] roomlist4 = {20,48,50,20}; - int[] roomlist5 = {52,49,51,52}; - - LinkRoomsHorizontally(roomlist1); - LinkRoomsHorizontally(roomlist2); - LinkRoomsHorizontally(roomlist3); - LinkRoomsVertically(roomlist4); - LinkRoomsVertically(roomlist5); - - LinkRoomsUpDown(60,61); - - gameCursor = new GameCursor(6*28,8*32,(Room) rooms.elementAt(40)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - solderingPen = new SolderingPen(); - remote = new Remote(); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - player = gameCursor; - currentViewer = player; - - } + materials.addElement(new Material(true, false)); // 0=Empty Space + materials.addElement(new Material(new Color(0, 204, 0), false, true)); // 1=green + materials.addElement(new Material(new Color(128, 128, 128), false, true)); // 2=grey + materials.addElement(new Material(new Color(0, 0, 255), false, true)); // 3=blue + materials.addElement(new Material(new Color(255, 128, 0), false, true)); // 4=orange + materials.addElement(new Material(new Color(255, 255, 255), false, true)); // 5=white + materials.addElement(new Material(new Color(0, 0, 128), false, true)); // 6=dk blue + materials.addElement(new Material(new Color(192, 192, 255), false, true)); // 7=grey-blue + materials.addElement(new MineField()); // 8=Minefield + materials.addElement(new Material(new Color(255, 224, 192), false, true)); // 9= + materials.addElement(new Material(new Color(63, 32, 0), false, true)); // 10=dk orange + materials.addElement(new Material(new Color(128, 128, 128), false, true)); // 11=grey + materials.addElement(new Monitor()); // 12=monitor + materials.addElement(new CrystalRecharger()); // 13=Recharger + materials.addElement(new PlayerBlocker(Color.black)); // 14=FF (Energy) + materials.addElement(new ElevatorDoor()); // 15=ElevatorDoor + materials.addElement(new AntiPlayer()); // 16=AntiPlayer + String[] grillwork = {"ventgrill.gif"}; + materials.addElement(new PlayerBlocker(grillwork)); // 17=VentGrill + int[][] lockProgram1 = { + {Lock.WIDE}, + {17, 9, 0, 17, 10, 0}, + {16, 9, 0, 16, 10, 0}, + {15, 9, 0, 15, 10, 0}, + {Lock.REMOVE}, + {15, 9, 9, 15, 10, 9}, + {16, 9, 9, 16, 10, 9}, + {17, 9, 9, 17, 10, 9} + }; + materials.addElement(new Lock(new Color(255, 128, 0), + Color.blue, lockProgram1)); // 18= Lock1 + int[][] lockProgram2 = { + {Lock.NARROW}, + {2, 3, 0}, + {Lock.REMOVE}, + {2, 3, 9} + }; + materials.addElement(new Lock(new Color(255, 128, 0), + Color.blue, lockProgram2)); // 19= Lock1 + materials.addElement(new ForceField("OrangeRobot", + new Color(255, 128, 0))); // 20=OrangeFF + materials.addElement(new ForceField("WhiteRobot", Color.white)); // 21=WhiteFF + materials.addElement(new ForceField("BlueRobot", Color.blue)); // 22=BlueFF + materials.addElement(new Switch4A()); // 23=Switch + materials.addElement(new Switch4B()); // 24=Switch + materials.addElement(new Switch4C()); // 25=Switch + materials.addElement(new Switch4D()); // 26=Switch + materials.addElement(new Portal("RO5.lvl", true, true)); // 27=Portal + + int[][] lockProgram3 = { + {Lock.NARROW}, + {9, 11, 0, 10, 11, 0}, + {8, 11, 0, 11, 11, 0}, + {Lock.NARROW}, + {8, 11, 5, 11, 11, 5}, + {9, 11, 5, 10, 11, 5}, + }; + materials.addElement(new Lock(Color.red, Color.red, lockProgram3)); // 28= Lock1 + + for (int a = 0; a < 62; a++) { + rooms.addElement(new Room()); + } + + String[] camFiles = { + "cam0.gif", + "cam0.gif", + "cam1.gif", + "cam1.gif", + "cam2.gif", + "cam2.gif", + "cam1.gif", + "cam1.gif" + }; + Graphix camGraphix = new Graphix(camFiles, 28, 32); + + + {// Room 0 : Help Screen + Room room = rooms.elementAt(0); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.AddTextBox("MASTER COMPUTER CENTER", 136, 64, 560); + room.AddTextBox("HINTS:", 2 * 28, 3 * 32, 560); + room.AddTextBox("A central robot can become your friend.", 4 * 28, 4 * 32, 400); + room.AddTextBox("The Sweeper 'Bot likes to keep the hallways clean.", 4 * 28, 6 * 32 + 16, 400); + room.AddTextBox("Chips 7 & 8 are blank.", 4 * 28, 9 * 32, 400); + room.AddTextBox("(To continue, press RETURN.)", 4 * 28, 11 * 32, 560); + } + {// Room 1 : Master Computer Help + Room room = rooms.elementAt(1); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.AddTextBox("THE MASTER COMPUTER", 6 * 28, 2 * 32, 500); + room.AddTextBox("The master computer controls many of the features of Robotropolis.", + 72, 4 * 32, 480); + room.AddTextBox("Use the cameras to monitor robot progress.", + 72, 6 * 32, 500); + room.AddTextBox("The computer can be turned off and the robot released by pressing the four buttons.", + 72, 8 * 32, 450); + room.AddTextBox("(To continue, press RETURN.)", 4 * 28, 11 * 32, 560); + + } + {// Room 2 : Minefield Help + Room room = rooms.elementAt(2); + room.SetMaterialFromRoom(1); + room.AddTextBox("THE MINEFIELD", 6 * 28, 2 * 32, 450); + room.AddTextBox("The walls in the map room are in the same position as the mines in the minefield.", + 2 * 28, 3 * 32, 500); + room.AddTextBox("Mines are set off when a robot thrusts against them for more than an instant.", + 2 * 28, 6 * 32, 500); + room.AddTextBox("Additional mines keep out non-robots.", 2 * 28, 8 * 32, 500); + room.AddTextBox("Robot communication is helpful.", 2 * 28, 9 * 32, 500); + room.AddTextBox("(To continue, press RETURN.)", 4 * 28, 11 * 32, 560); + } + {// Room 3 : Force Field Help + Room room = rooms.elementAt(3); + room.SetMaterialFromRoom(1); + room.AddTextBox("THE FORCE FIELD TUNNEL", 6 * 28, 2 * 32, 500); + room.AddTextBox("Robot relays pass key items along.", 2 * 28, 4 * 32, 500); + room.AddTextBox("Plan ahead for the return journey.", 2 * 28, 6 * 32, 500); + room.AddTextBox("(To continue, press RETURN.)", 4 * 28, 11 * 32, 560); + } + {// Room 4 : Ventilation Shaft Help + Room room = rooms.elementAt(4); + room.SetMaterialFromRoom(1); + room.AddTextBox("THE VENTILATION SHAFT", 6 * 28, 2 * 32, 500); + room.AddTextBox("Counting chips can pick out air tubes.", 2 * 28, 4 * 32, 500); + room.AddTextBox("Be sure to pick the right tube.", 2 * 28, 6 * 32, 560); + room.AddTextBox("(To continue, press RETURN.)", 4 * 28, 11 * 32, 560); + } + {// Room 5 : Top Left Corridor + Room room = rooms.elementAt(5); + room.SetMaterialFill(0, 0, 19, 2, 3); + room.SetMaterialFill(0, 0, 4, 11, 3); + room.SetMaterialFill(15, 9, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 6 : Top Corridor + Room room = rooms.elementAt(6); + room.SetMaterialFill(0, 0, 19, 2, 3); + room.SetMaterialFill(0, 9, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 7 : Top Corridor + Room room = rooms.elementAt(7); + room.SetMaterialFill(0, 0, 19, 2, 3); + room.SetMaterialFill(0, 9, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 8 : Top Corridor, Entance to Map Room + Room room = rooms.elementAt(8); + room.SetMaterialFill(0, 0, 19, 2, 3); + room.SetMaterialFill(0, 9, 7, 11, 3); + room.SetMaterialFill(12, 9, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 9 : Top Corridor + Room room = rooms.elementAt(9); + room.SetMaterialFill(0, 0, 19, 2, 3); + room.SetMaterialFill(0, 9, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 10 : Top Corridor + Room room = rooms.elementAt(10); + room.SetMaterialFill(0, 0, 19, 2, 3); + room.SetMaterialFill(0, 9, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 11 : Top Right Corridor + Room room = rooms.elementAt(11); + room.SetMaterialFill(0, 0, 19, 2, 3); + room.SetMaterialFill(15, 0, 19, 11, 3); + room.SetMaterialFill(0, 9, 4, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 12 : Right Corridor, Exit from Map Room + Room room = rooms.elementAt(12); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3} + }; + + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 13 : Right Corridor + Room room = rooms.elementAt(13); + int[][] table = { + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3} + }; + room.RoomArray = table; + rooms.elementAt(15).RoomArray = table; + rooms.elementAt(33).RoomArray = table; + rooms.elementAt(35).RoomArray = table; + + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 14 : Right Corridor, Key Tunnel + Room room = rooms.elementAt(14); + int[][] table = { + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3} + }; + room.RoomArray = table; + rooms.elementAt(16).RoomArray = table; + + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 15 : Right Corridor + Room room = rooms.elementAt(15); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 16 : Right Corridor, Main Office + Room room = rooms.elementAt(16); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 17 : Bottom Right Corridor + Room room = rooms.elementAt(17); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 18 : Bottom Corridor + Room room = rooms.elementAt(18); + room.SetMaterialFill(0, 0, 19, 2, 3); + room.SetMaterialFill(0, 9, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 19 : Bottom Corridor, Entrance + Room room = rooms.elementAt(19); + room.SetMaterialFill(0, 0, 7, 2, 3); + room.SetMaterialFill(12, 0, 19, 2, 3); + room.SetMaterialFill(0, 9, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + items.addElement(new TrashCollector(266, 176, room)); + } + {// Room 20 : Ventilation Shaft Maze + Room room = rooms.elementAt(20); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5}, + {0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 5}, + {5, 5, 0, 0, 0, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {0, 0, 0, 0, 0, 5, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 5, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5}, + {5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5}, + {5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5}, + {5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 0}, + {5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 0}, + {5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5} + }; + + room.AddTextBox("{BIG} {000,204,000} VENTILATION SHAFT", 126, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 21 : Ventilation Shaft Exit (Entrance to Master Chamber) + Room room = rooms.elementAt(21); + room.SetMaterialFill(0, 0, 19, 1, 3); + room.SetMaterialFill(0, 0, 2, 11, 3); + room.SetMaterialFill(17, 0, 19, 4, 3); + room.SetMaterialFill(17, 8, 19, 11, 3); + room.SetMaterialFill(7, 10, 19, 11, 3); + room.SetMaterialFill(19, 5, 19, 8, 17); + room.AddTextBox("{BIG} {000,204,000} NORTH CHAMBER", 98, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 22 : Key Tunnel, Bottom Right + Room room = rooms.elementAt(22); + room.SetMaterialFill(0, 0, 14, 1, 3); + room.SetMaterialFill(18, 0, 19, 11, 3); + room.SetMaterialFill(0, 10, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} TUNNEL BYPASS", 104, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 23 : Key Tunnel, Bottom Left + Room room = rooms.elementAt(23); + room.SetMaterialFill(0, 0, 2, 11, 3); + room.SetMaterialFill(0, 10, 19, 11, 3); + room.SetMaterialFill(5, 0, 19, 1, 3); + room.AddTextBox("{BIG} {000,204,000} TUNNEL BYPASS", 104, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 24 : Upper Library + Room room = rooms.elementAt(24); + room.SetMaterialFill(0, 0, 19, 0, 3); + room.SetMaterialFill(0, 0, 0, 3, 3); + room.SetMaterialFill(0, 7, 0, 11, 3); + room.SetMaterial(19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} LIBRARY", 185, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 25 : Library, entrance to Ventilation Shaft + Room room = rooms.elementAt(25); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialFill(0, 1, 0, 10, 0); + room.SetMaterialFill(19, 5, 19, 6, 17); + room.AddTextBox("{BIG} {000,204,000} LIBRARY", 185, 708, 560); + room.graphix.addElement(camGraphix); + items.addElement(new Disk(17 * 28, 3 * 32, room, Color.blue, 4)); + } + {// Room 26 : Lower Library + Room room = rooms.elementAt(26); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialFill(1, 0, 18, 0, 0); + room.SetMaterialFill(19, 7, 19, 9, 0); + room.AddTextBox("{BIG} {000,204,000} LIBRARY", 185, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 27 : Computer Room + Room room = rooms.elementAt(27); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialFill(0, 7, 0, 9, 0); + room.SetMaterial(10, 2, 12); + room.AddTextBox("{BIG} {000,204,000} COMPUTER ROOM", 104, 708, 560); + room.AddGraphix("monitor.gif", 8 * 28, 2 * 32); + room.graphix.addElement(camGraphix); + items.addElement(new CamDisk(2 * 28, 9 * 32, room)); + items.addElement(new SpyCam(room)); + } + {// Room 28 : Bottom Corridor, Entrance + Room room = rooms.elementAt(28); + room.SetMaterialFill(0, 0, 7, 2, 3); + room.SetMaterialFill(12, 0, 19, 2, 3); + room.SetMaterialFill(0, 9, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 29 : Bottom Corridor + Room room = rooms.elementAt(29); + room.SetMaterialFill(0, 0, 19, 2, 3); + room.SetMaterialFill(0, 9, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 30 : Bottom Corridor + Room room = rooms.elementAt(30); + room.SetMaterialFill(0, 0, 19, 2, 3); + room.SetMaterialFill(0, 9, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 31 : Bottom Left Corridor + Room room = rooms.elementAt(31); + room.SetMaterialFill(0, 0, 4, 11, 3); + room.SetMaterialFill(0, 9, 19, 11, 3); + room.SetMaterialFill(15, 0, 19, 2, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 32 : Left Corridor, Entrance to Elevator + Room room = rooms.elementAt(32); + room.SetMaterialFill(0, 0, 4, 11, 3); + room.SetMaterialFill(15, 0, 19, 3, 3); + room.SetMaterialFill(15, 7, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 33 : Left Corridor + Room room = rooms.elementAt(33); + room.SetMaterialFill(0, 0, 4, 11, 3); + room.SetMaterialFill(15, 0, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 34 : Left Corridor, Entrance to Minefield + Room room = rooms.elementAt(34); + room.SetMaterialFill(0, 0, 4, 11, 3); + room.SetMaterialFill(15, 0, 19, 6, 3); + room.SetMaterialFill(15, 10, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 35 : Left Corridor + Room room = rooms.elementAt(35); + room.SetMaterialFill(0, 0, 4, 11, 3); + room.SetMaterialFill(15, 0, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 36 : Master Chamber + Room room = rooms.elementAt(36); + room.RoomArray = new int[][]{ + {4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 26, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 25, 0, 0, 4, 4, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 4, 4, 0, 0, 23, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 24, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4} + }; + + room.AddTextBox("{BIG} {000,204,000} MASTER COMPUTER", 37, 708, 560); + room.graphix.addElement(camGraphix); + items.addElement(new MasterRobot(9 * 28, 5 * 32 + 12, room)); + } + {// Room 37 : Left Corridor, Entrance to Library + Room room = rooms.elementAt(37); + room.SetMaterialFill(0, 0, 4, 11, 3); + room.SetMaterialFill(15, 0, 19, 3, 3); + room.SetMaterialFill(15, 7, 19, 11, 3); + room.AddTextBox("{BIG} {000,204,000} HALLWAY", 180, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 38 : Map Antechamber + Room room = rooms.elementAt(38); + room.RoomArray = new int[][]{ + {6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6} + }; + + room.AddTextBox("{BIG} {000,204,000} MAP ANTEROOM", 118, 708, 560); + room.graphix.addElement(camGraphix); + items.addElement(new Disk(6 * 28, 8 * 32, room, Color.yellow, 2)); + } + {// Room 39 : Map Room, Top Left + Room room = rooms.elementAt(39); + room.RoomArray = new int[][]{ + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 0, 0, 0, 6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 6, 0, 0, 0, 6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 6, 0, 0, 0, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 6} + }; + + room.AddTextBox("{BIG} {000,204,000} MINEFIELD MAP", 104, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 40 : Main Office + Room room = rooms.elementAt(40); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + + room.AddTextBox("{BIG} {000,204,000} MAIN OFFICE", 131, 708, 560); + items.addElement(new Disk(17 * 28, 2 * 32, room, Color.red, 1)); + room.graphix.addElement(camGraphix); + } + {// Room 41 : Map Room, Top Right + Room room = rooms.elementAt(41); + room.RoomArray = new int[][]{ + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6} + }; + + room.AddTextBox("{BIG} {000,204,000} MINEFIELD MAP", 104, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 42 : Minefield, Bottom Left + Room room = rooms.elementAt(42); + room.RoomArray = new int[][]{ + {8, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 0, 0, 0, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 8, 0, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 8, 0, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8} + }; + + room.AddTextBox("{BIG} {000,204,000} MINEFIELD", 159, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 43 : Minefield, Bottom Right + Room room = rooms.elementAt(43); + room.RoomArray = new int[][]{ + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 8, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8} + }; + + room.AddTextBox("{BIG} {000,204,000} MINEFIELD", 159, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 44 : Minefield, Top Left + Room room = rooms.elementAt(44); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 0, 8, 8, 8, 8, 8, 0, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 8, 8, 8, 8, 8, 0, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {16, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {16, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0}, + {16, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0}, + {8, 0, 0, 0, 8, 0, 0, 0, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 8} + }; + + room.AddTextBox("{BIG} {000,204,000} MINEFIELD", 159, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 45 : Minefield, Top Right + Room room = rooms.elementAt(45); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 8, 0, 0, 0, 0, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8} + }; + + room.AddTextBox("{BIG} {000,204,000} MINEFIELD", 159, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 46 : Key Tunnel, Top Left + Room room = rooms.elementAt(46); + room.RoomArray = new int[][]{ + {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, + {9, 9, 9, 0, 0, 0, 0, 0, 20, 0, 0, 0, 21, 0, 0, 0, 21, 0, 0, 0}, + {9, 9, 9, 0, 0, 0, 0, 0, 20, 0, 0, 0, 21, 0, 0, 0, 21, 0, 0, 0}, + {0, 0, 9, 0, 0, 0, 0, 0, 20, 0, 0, 0, 21, 0, 0, 0, 21, 0, 0, 0}, + {9, 9, 9, 0, 0, 0, 0, 0, 20, 0, 0, 0, 21, 0, 0, 0, 21, 0, 0, 0}, + {9, 9, 9, 0, 0, 0, 0, 0, 20, 0, 0, 0, 21, 0, 0, 0, 21, 0, 0, 0}, + {9, 9, 9, 0, 0, 0, 0, 0, 20, 0, 0, 0, 21, 0, 0, 0, 21, 0, 0, 0}, + {9, 9, 9, 0, 0, 0, 0, 0, 20, 0, 0, 0, 21, 0, 0, 0, 21, 0, 0, 0}, + {9, 9, 9, 0, 0, 0, 0, 0, 20, 0, 0, 0, 21, 0, 0, 0, 21, 0, 0, 0}, + {9, 9, 9, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, + {9, 9, 9, 0, 0, 19, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, + {9, 9, 9, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9} + }; + + room.AddTextBox("{BIG} {000,204,000} FORCE FIELD TUNNEL", 132, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 47 : Key Tunnel, Top Right + Room room = rooms.elementAt(47); + room.RoomArray = new int[][]{ + {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, + {0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 9, 9}, + {0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 18, 9}, + {0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 9, 9}, + {0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 9, 9}, + {0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 9, 9}, + {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, + {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, + {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 9, 9} + }; + + room.AddTextBox("{BIG} {000,204,000} FORCE FIELD TUNNEL", 132, 708, 560); + room.graphix.addElement(camGraphix); + items.addElement(new Disk(16 * 28, 2 * 32, room, Color.green, 3)); + } + {// Room 48 : Ventilation Shaft Left + Room room = rooms.elementAt(48); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5}, + {5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5}, + {5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5}, + {5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5}, + {5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5}, + {5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5} + }; + + room.AddTextBox("{BIG} {000,204,000} VENTILATION SHAFT", 126, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 49 : Ventilation Shaft Right + Room room = rooms.elementAt(49); + room.RoomArray = new int[][]{ + {5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5}, + {5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5} + }; + + room.AddTextBox("{BIG} {000,204,000} VENTILATION SHAFT", 126, 708, 560); + room.graphix.addElement(camGraphix); + String[] fanlist = { + "fan0.gif", + "fan1.gif", + "fan2.gif", + "fan3.gif", + "fan2.gif", + "fan1.gif"}; + room.graphix.addElement(new Graphix(fanlist, 17 * 28, 5 * 32)); + } + {// Room 50 : Ventilation Shaft Maze + Room room = rooms.elementAt(50); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 0}, + {5, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5}, + {0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5}, + {0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5}, + {5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5}, + {5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5}, + {5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5} + }; + + room.AddTextBox("{BIG} {000,204,000} VENTILATION SHAFT", 126, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 51 : Ventilation Shaft Maze + Room room = rooms.elementAt(51); + room.RoomArray = new int[][]{ + {5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {0, 0, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {0, 0, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {0, 0, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5} + }; + + room.AddTextBox("{BIG} {000,204,000} VENTILATION SHAFT", 126, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 52 : Ventilation Shaft Maze + Room room = rooms.elementAt(52); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {0, 0, 0, 0, 0, 5, 5, 5, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 5, 5, 5, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}, + {5, 5, 0, 0, 0, 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5}, + {5, 5, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 5, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5}, + {5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5}, + {0, 0, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {0, 0, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5}, + {5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5, 0, 0, 0, 5, 5, 5} + }; + + room.AddTextBox("{BIG} {000,204,000} VENTILATION SHAFT", 126, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 53 : Map Room, Bottom Left + Room room = rooms.elementAt(53); + room.RoomArray = new int[][]{ + {6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0}, + {6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0}, + {6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 6, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 6, 0, 0}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6} + }; + + room.AddTextBox("{BIG} {000,204,000} MINEFIELD MAP", 104, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 54 : Map Room, Bottom Right + Room room = rooms.elementAt(54); + room.RoomArray = new int[][]{ + {6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 6, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6} + }; + + room.AddTextBox("{BIG} {000,204,000} MINEFIELD MAP", 104, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 55 : Energy Chamber, Upper + Room room = rooms.elementAt(55); + room.RoomArray = new int[][]{ + {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10} + }; + + room.AddTextBox("{BIG} {000,204,000} HIGH VOLTAGE ROOM", 118, 708, 560); + room.graphix.addElement(camGraphix); + items.addElement(new NotAButton(10 * 28, 6 * 32, room)); + items.addElement(new EnergyButton()); + } + {// Room 56 : Elevator, Left + Room room = rooms.elementAt(56); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + + room.AddTextBox("{BIG} {000,204,000} LOBBY", 212, 708, 560); + room.graphix.addElement(camGraphix); + } + {// Room 57 : Energy Chamber, Lower + Room room = rooms.elementAt(57); + room.RoomArray = new int[][]{ + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10}, + {10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 10}, + {10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 10} + }; + + room.AddTextBox("{BIG} {000,204,000} SAFETY ROOM", 131, 708, 560); + room.graphix.addElement(camGraphix); + room.AddGraphix("FFleft.gif", 30, 4 * 32 + 3); + room.AddGraphix("FFright.gif", 18 * 28 - 2, 4 * 32 + 3); + room.AddTextBox("..........................................", 28, 4 * 32 + 16, 560); + } + {// Room 58 : Trash Dump + Room room = rooms.elementAt(58); + room.RoomArray = new int[][]{ + {11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11}, + {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11}, + {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11}, + {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11}, + {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11}, + {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11}, + {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11}, + {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11}, + {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11}, + {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11}, + {11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11}, + {11, 11, 11, 11, 11, 11, 11, 11, 0, 0, 0, 0, 11, 11, 11, 11, 11, 11, 11, 11} + }; + + room.AddTextBox("{BIG} {000,204,000} TRASH DUMP", 145, 708, 560); + room.graphix.addElement(camGraphix); + items.addElement(new SmallChip(3 * 28, 9 * 32, room, "7")); + } + {// Room 59 : Elevator, Right + Room room = rooms.elementAt(59); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 2}, + {15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + + room.AddTextBox("{BIG} {000,204,000} ELEVATOR", 172, 708, 560); + room.AddTextBox("\"Hold, please!\"", 84, 54, 560); + room.AddTextBox("HOLD", 480, 350, 560); + room.graphix.addElement(camGraphix); + room.AddGraphix("hold.gif", 18 * 28, 10 * 32 - 4); + items.addElement(new SmallChip(3 * 28, 9 * 32, room, "8")); + } + + {// Room 60 : Purgatorium + Room room = rooms.elementAt(60); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 5}, + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}}; + room.AddTextBox("{BIG} {255,000,000} PURGATORIUM", 131, 64, 500); + room.AddTextBox("(Please wait for Trash Room)", 112, 11 * 32, 500); + } + {// Room 61 : Secret Room + Room room = rooms.elementAt(61); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}}; + room.AddTextBox("Hello again, organic dude!", 2 * 28, 4 * 32, 500); + room.AddTextBox("To find secret #5, you must enter a Zen state of mind... To open a door is to close a door, and to close a door is to open a door.", + 2 * 28, 6 * 32, 500); + String[] helperlist = { + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper1.gif", "helper4.gif", "helper2.gif", "helper3.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper5.gif", "helper5.gif", "helper5.gif", "helper5.gif", + }; + Graphix helper = new Graphix(helperlist, 15 * 28, 8 * 32); + room.graphix.addElement(helper); + items.addElement(new Key(16 * 28, 3 * 32, room, new Color(255, 128, 0))); + } + + // Main area map + int[][] roomgrid = + { + {5, 6, 7, 8, 9, 10, 11}, + {37, 24, 25, 38, 39, 41, 12}, + {35, 26, 27, 21, 53, 54, 13}, + {34, 44, 45, 36, 46, 47, 14}, + {33, 42, 43, 55, 23, 22, 15}, + {32, 56, 59, 57, 58, 40, 16}, + {31, 30, 29, 28, 19, 18, 17} + }; + LinkRoomsGrid(roomgrid); + + // Ventilation shaft map + // + // 20 52 + // | | + //(25)- 48 ----- 49 -(38) + // | | + // | (21)- 51 -(53) + // | | + // 20 - 50 ----- 52 - 20 + // | + // 20 + + int[] roomlist1 = {25, 48, 49, 38}; + int[] roomlist2 = {21, 51, 53}; + int[] roomlist3 = {20, 50, 52, 20}; + int[] roomlist4 = {20, 48, 50, 20}; + int[] roomlist5 = {52, 49, 51, 52}; + + LinkRoomsHorizontally(roomlist1); + LinkRoomsHorizontally(roomlist2); + LinkRoomsHorizontally(roomlist3); + LinkRoomsVertically(roomlist4); + LinkRoomsVertically(roomlist5); + + LinkRoomsUpDown(60, 61); + + gameCursor = new GameCursor(6 * 28, 8 * 32, rooms.elementAt(40)); + helpCam = new HelpCam(rooms.elementAt(0)); + solderingPen = new SolderingPen(); + remote = new Remote(); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + player = gameCursor; + currentViewer = player; + + } } \ No newline at end of file diff --git a/src/com/droidquest/levels/RO5.java b/src/com/droidquest/levels/RO5.java index 374676b..64f10a4 100644 --- a/src/com/droidquest/levels/RO5.java +++ b/src/com/droidquest/levels/RO5.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.avatars.GameCursor; @@ -10,1160 +8,1105 @@ import com.droidquest.avatars.Remote; import com.droidquest.avatars.SolderingPen; import com.droidquest.decorations.Arrow; import com.droidquest.decorations.Graphix; -import com.droidquest.items.BinaryKey; -import com.droidquest.items.HiddenCamera; -import com.droidquest.items.Key; -import com.droidquest.items.Sentry; -import com.droidquest.items.SkyGuard; -import com.droidquest.items.SkywayFlyer; -import com.droidquest.items.SonicLock; -import com.droidquest.materials.AutoRunner; -import com.droidquest.materials.BinaryLock; -import com.droidquest.materials.BlueGridSwitch; -import com.droidquest.materials.CameraDisable; -import com.droidquest.materials.CameraEnable; -import com.droidquest.materials.CrystalRecharger; -import com.droidquest.materials.DeactivatorSwitch; -import com.droidquest.materials.HotWires; -import com.droidquest.materials.Lock; -import com.droidquest.materials.Material; -import com.droidquest.materials.MultiButton; -import com.droidquest.materials.MultiSwitch; -import com.droidquest.materials.SkyGuardMat; -import com.droidquest.materials.Switch; +import com.droidquest.items.*; +import com.droidquest.materials.*; -class RO5 extends Level -{ -public RO5 (RoomDisplay rd) - { - super(rd); - - materials.addElement(new Material(true, false)); // 0 = Empty Space - materials.addElement(new Material(new Color(0,204,0),false, true)); // 1 = Green - materials.addElement(new Material(new Color(192,192,255),false, true)); // 2 = Light Blue - materials.addElement(new Material(new Color(63,32,0),false, true)); // 3 = Brown - materials.addElement(new Material(new Color(128,128,128),false, true)); // 4 = Grey - materials.addElement(new Material(new Color(255,128,0),false, true)); // 5 = Orange - materials.addElement(new Material(new Color(255,255,255),false, true)); // 6 = White - materials.addElement(new Material(new Color(0,0,255),false, true)); // 7 = Blue - materials.addElement(new Material(new Color(0,0,128),false,true)); // 8 = DarkBlue - materials.addElement(new Material(new Color(255,224,192),false, true)); // 9 = Tan Flesh +import java.awt.*; + +class RO5 extends Level { + public RO5(RoomDisplay rd) { + super(rd); + + materials.addElement(new Material(true, false)); // 0 = Empty Space + materials.addElement(new Material(new Color(0, 204, 0), false, true)); // 1 = Green + materials.addElement(new Material(new Color(192, 192, 255), false, true)); // 2 = Light Blue + materials.addElement(new Material(new Color(63, 32, 0), false, true)); // 3 = Brown + materials.addElement(new Material(new Color(128, 128, 128), false, true)); // 4 = Grey + materials.addElement(new Material(new Color(255, 128, 0), false, true)); // 5 = Orange + materials.addElement(new Material(new Color(255, 255, 255), false, true)); // 6 = White + materials.addElement(new Material(new Color(0, 0, 255), false, true)); // 7 = Blue + materials.addElement(new Material(new Color(0, 0, 128), false, true)); // 8 = DarkBlue + materials.addElement(new Material(new Color(255, 224, 192), false, true)); // 9 = Tan Flesh // materials.addElement(new Material(new Color(128,0,0),false, true)); // 10 = Black Wall - materials.addElement(new Material(Color.black,false, true)); // 10 = Black Wall - int[][] program1 = { - {Lock.NARROW}, - {15,4,0, 15,5,0, 15,6,0, 15,7,0, 16,4,2, 17,5,2, 17,6,2, 16,7,2}, - {16,4,0, 17,5,0, 17,6,0, 16,7,0, 16,3,2, 17,3,2, 16,8,2, 17,8,2}, - {Lock.NARROW}, - {16,4,2, 17,5,2, 17,6,2, 16,7,2, 16,3,0, 17,3,0, 16,8,0, 17,8,0}, - {15,4,2, 15,5,2, 15,6,2, 15,7,2, 16,4,0, 17,5,0, 17,6,0, 16,7,0} - }; - materials.addElement(new Lock(Color.blue, Color.blue, program1)); // 11= 1st lock - materials.addElement(new AutoRunner(AutoRunner.UP)); // 12= UP - materials.addElement(new AutoRunner(AutoRunner.RIGHTUP)); // 13= RIGHTUP - materials.addElement(new AutoRunner(AutoRunner.RIGHT)); // 14= RIGHT - materials.addElement(new AutoRunner(AutoRunner.RIGHTDOWN)); // 15= RIGHTDOWN - materials.addElement(new AutoRunner(AutoRunner.DOWN)); // 16= DOWN - materials.addElement(new AutoRunner(AutoRunner.LEFTDOWN)); // 17= LEFTDOWN - materials.addElement(new AutoRunner(AutoRunner.LEFT)); // 18= LEFT - materials.addElement(new AutoRunner(AutoRunner.LEFTUP)); // 19= LEFTUP - materials.addElement(new AutoRunner(AutoRunner.STOP)); // 20= STOP - int[][] program2 = { - {BinaryLock.NARROW}, - {2,10,0, 3,10,0, 4,10,0, 5,10,0, 2,9,2, 3,8,2, 4,8,2, 5,9,2}, - {2,9,0, 3,8,0, 4,8,0, 5,9,0, 1,9,2, 1,8,2, 6,9,2, 6,8,2}, - {BinaryLock.NARROW}, - {2,9,2, 3,8,2, 4,8,2, 5,9,2, 1,9,0, 1,8,0, 6,9,0, 6,8,0}, - {2,10,2, 3,10,2, 4,10,2, 5,10,2, 2,9,0, 3,8,0, 4,8,0, 5,9,0}, - }; - materials.addElement(new BinaryLock(Color.blue, program2)); // 21=Lock - materials.addElement(new HotWires(HotWires.LEFT+HotWires.RIGHT,true)); // 22=HotWire - materials.addElement(new HotWires(HotWires.LEFT+HotWires.DOWN,true)); // 23=HotWire - materials.addElement(new HotWires(HotWires.UP+HotWires.DOWN,true)); // 24=HotWire - materials.addElement(new DeactivatorSwitch()); // 25=Deactivator - materials.addElement(new CrystalRecharger()); // 26=Recharger - int[][] program3 = { - {BinaryLock.NARROW} - }; - materials.addElement(new BinaryLock(Color.white, program3)); // 27=BinaryLock2 - materials.addElement(new MultiSwitch(0,0)); // 28=Starter - materials.addElement(new MultiSwitch(1,0)); // 29=1 - materials.addElement(new MultiSwitch(2,0)); // 30=2 - materials.addElement(new MultiSwitch(3,0)); // 31=3 - materials.addElement(new MultiSwitch(4,0)); // 32=4 - materials.addElement(new HotWires(0,true)); // 33=BlueGrid - materials.addElement(new CameraEnable()); // 34=CameraEnable - materials.addElement(new CameraDisable()); // 35=Cam Disable - materials.addElement(new BlueGridSwitch()); // 36=BlueGridOff - int[][] program4 = { - {-12}, // {Switch.WAIT4PLAYERCONTACT}, + materials.addElement(new Material(Color.black, false, true)); // 10 = Black Wall + int[][] program1 = { + {Lock.NARROW}, + {15, 4, 0, 15, 5, 0, 15, 6, 0, 15, 7, 0, 16, 4, 2, 17, 5, 2, 17, 6, 2, 16, 7, 2}, + {16, 4, 0, 17, 5, 0, 17, 6, 0, 16, 7, 0, 16, 3, 2, 17, 3, 2, 16, 8, 2, 17, 8, 2}, + {Lock.NARROW}, + {16, 4, 2, 17, 5, 2, 17, 6, 2, 16, 7, 2, 16, 3, 0, 17, 3, 0, 16, 8, 0, 17, 8, 0}, + {15, 4, 2, 15, 5, 2, 15, 6, 2, 15, 7, 2, 16, 4, 0, 17, 5, 0, 17, 6, 0, 16, 7, 0} + }; + materials.addElement(new Lock(Color.blue, Color.blue, program1)); // 11= 1st lock + materials.addElement(new AutoRunner(AutoRunner.UP)); // 12= UP + materials.addElement(new AutoRunner(AutoRunner.RIGHTUP)); // 13= RIGHTUP + materials.addElement(new AutoRunner(AutoRunner.RIGHT)); // 14= RIGHT + materials.addElement(new AutoRunner(AutoRunner.RIGHTDOWN)); // 15= RIGHTDOWN + materials.addElement(new AutoRunner(AutoRunner.DOWN)); // 16= DOWN + materials.addElement(new AutoRunner(AutoRunner.LEFTDOWN)); // 17= LEFTDOWN + materials.addElement(new AutoRunner(AutoRunner.LEFT)); // 18= LEFT + materials.addElement(new AutoRunner(AutoRunner.LEFTUP)); // 19= LEFTUP + materials.addElement(new AutoRunner(AutoRunner.STOP)); // 20= STOP + int[][] program2 = { + {BinaryLock.NARROW}, + {2, 10, 0, 3, 10, 0, 4, 10, 0, 5, 10, 0, 2, 9, 2, 3, 8, 2, 4, 8, 2, 5, 9, 2}, + {2, 9, 0, 3, 8, 0, 4, 8, 0, 5, 9, 0, 1, 9, 2, 1, 8, 2, 6, 9, 2, 6, 8, 2}, + {BinaryLock.NARROW}, + {2, 9, 2, 3, 8, 2, 4, 8, 2, 5, 9, 2, 1, 9, 0, 1, 8, 0, 6, 9, 0, 6, 8, 0}, + {2, 10, 2, 3, 10, 2, 4, 10, 2, 5, 10, 2, 2, 9, 0, 3, 8, 0, 4, 8, 0, 5, 9, 0}, + }; + materials.addElement(new BinaryLock(Color.blue, program2)); // 21=Lock + materials.addElement(new HotWires(HotWires.LEFT + HotWires.RIGHT, true)); // 22=HotWire + materials.addElement(new HotWires(HotWires.LEFT + HotWires.DOWN, true)); // 23=HotWire + materials.addElement(new HotWires(HotWires.UP + HotWires.DOWN, true)); // 24=HotWire + materials.addElement(new DeactivatorSwitch()); // 25=Deactivator + materials.addElement(new CrystalRecharger()); // 26=Recharger + int[][] program3 = { + {BinaryLock.NARROW} + }; + materials.addElement(new BinaryLock(Color.white, program3)); // 27=BinaryLock2 + materials.addElement(new MultiSwitch(0, 0)); // 28=Starter + materials.addElement(new MultiSwitch(1, 0)); // 29=1 + materials.addElement(new MultiSwitch(2, 0)); // 30=2 + materials.addElement(new MultiSwitch(3, 0)); // 31=3 + materials.addElement(new MultiSwitch(4, 0)); // 32=4 + materials.addElement(new HotWires(0, true)); // 33=BlueGrid + materials.addElement(new CameraEnable()); // 34=CameraEnable + materials.addElement(new CameraDisable()); // 35=Cam Disable + materials.addElement(new BlueGridSwitch()); // 36=BlueGridOff + int[][] program4 = { + {-12}, // {Switch.WAIT4PLAYERCONTACT}, // {Switch.WAIT4CONTACT}, - {Switch.SETVALUEHIGH}, - {Switch.REPLACE, 2,11,0}, - {Switch.REPLACE, 3,11,0}, - {Switch.REPLACE, 4,11,0}, - {Switch.REPLACE, 5,11,0}, - {Switch.DOWNROOM}, - {Switch.REPLACE, 2,0,0, 3,0,0, 4,0,0, 5,0,0}, - {Switch.WAIT4REMOVAL}, - {Switch.REPLACE, 5,11,9}, - {Switch.REPLACE, 4,11,9}, - {Switch.REPLACE, 3,11,9}, - {Switch.REPLACE, 2,11,9}, - {Switch.DOWNROOM}, - {Switch.REPLACE, 2,0,9, 3,0,9, 4,0,9, 5,0,9}, - {Switch.SETVALUELOW} - }; - materials.addElement(new Switch(Switch.ROT_RIGHT, program4)); //37=Grid door Switch - int[][] program5 = { - {BinaryLock.NARROW}, - {6,2,2, 9,2,0, 10,2,0, 13,2,2}, - {5,2,2, 8,2,0, 11,2,0, 14,2,2}, - {BinaryLock.NARROW}, - {5,2,0, 8,2,2, 11,2,2, 14,2,0}, - {6,2,0, 9,2,2, 10,2,2, 13,2,0} - }; - materials.addElement(new BinaryLock(Color.blue,program5)); //38=Binary Lock - materials.addElement(new MultiButton(0,1)); // 39= MultiButton Starter - materials.addElement(new MultiButton(1,0)); // 40= Multibutton 1 - materials.addElement(new MultiButton(2,0)); // 41= Multibutton 2 - materials.addElement(new MultiButton(3,0)); // 42= Multibutton 3 - materials.addElement(new MultiButton(4,0)); // 43= Multibutton 4 - materials.addElement(new MultiButton(5,0)); // 44= Multibutton 5 - materials.addElement(new MultiButton(6,0)); // 45= Multibutton 6 - materials.addElement(new MultiButton(7,0)); // 46= Multibutton 7 - materials.addElement(new MultiButton(8,0)); // 47= Multibutton 8 - materials.addElement(new MultiButton(9,0)); // 48= Multibutton 9 - materials.addElement(new SkyGuardMat()); // 49= SkyGuard - - materials.addElement(new Material(new Color(192,192,255),true,true)); // 50=False wall - - for (int a=0; a<38; a++) - rooms.addElement(new Room()); - - String[] skyway0 = {"skyway00.gif","skyway01.gif","skyway02.gif"}; - String[] skyway1 = {"skyway03.gif","skyway04.gif"}; - String[] skyway2 = {"skyway05.gif","skyway06.gif","skyway07.gif","skyway08.gif"}; - String[] skyway3 = {"skyway09.gif","skyway10.gif","skyway11.gif"}; - String[] skyway4 = {"skyway12.gif","skyway13.gif"}; - String[] skyway5 = {"skyway14.gif","skyway15.gif"}; - String[] skyway6 = {"skyway16.gif","skyway17.gif"}; - String[] skyway7 = {"skyway18.gif","skyway19.gif","skyway20.gif"}; - String[] skyguard = {"skyguard0.gif","skyguard1.gif","skyguard2.gif","skyguard3.gif","skyguard4.gif"}; - - {// Room 0 Help - Room room = (Room) rooms.elementAt(0); - int[][] table0 = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table0; - - room.AddTextBox("Travel the Skyways to freedom!",80,64, 560); - room.AddTextBox("HINTS:", - 56,3*32, 560); - room.AddTextBox("Beware of Skyway traffic!", - 56,4*32, 560); - room.AddTextBox("Timing is critical for many locks.", - 56,5*32, 500); - room.AddTextBox("The Disk-O-Tek key is a sonic pattern. Read it from left to right. Repeat it once.", - 56,6*32, 500); - room.AddTextBox("Don't linger on the buttons.", - 56,8*32, 500); - room.AddTextBox("Arrows show the path through the blue grid. Your 'bot must ride it alone.", - 56,9*32, 500); - room.AddTextBox("(To continue, press RETURN.)", - 96,346, 500); - } - {// Room 1 Entrance: Locked Door - Room room = (Room) rooms.elementAt(1); - int[][] table1 = { - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11, 2, 0, 0, 2, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,50, 2, 2, 2} - }; - room.RoomArray = table1; - - } - {// Room 2 Entrance Chamber - Room room = (Room) rooms.elementAt(2); - int[][] table2 = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2}, - {2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table2; - - } - {// Room 3 Skyway - Room room = (Room) rooms.elementAt(3); - int[][] table3 = { - {0, 0, 0, 4,49,49,49,49,49,49,49,49,49,49,49,49, 4, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 4,49,49,49,49,49,49,49,49,49,49,49,49, 4, 0, 0, 0} - }; - room.RoomArray = table3; - - room.AddTextBox("The Skyways of Robotropolis",118,86, 560); - items.addElement(new SkywayFlyer(5*28+2,2*32,room,skyway0,-4)); - items.addElement(new SkywayFlyer(5*28+2,5*32,room,skyway1,-4)); - items.addElement(new SkywayFlyer(5*28+2,8*32,room,skyway2,-4)); - items.addElement(new SkywayFlyer(8*28+2,2*32,room,skyway3,2)); - items.addElement(new SkywayFlyer(8*28+2,5*32,room,skyway4,2)); - items.addElement(new SkywayFlyer(8*28+2,8*32,room,skyway5,2)); - items.addElement(new SkywayFlyer(11*28+2,2*32,room,skyway6,-2)); - items.addElement(new SkywayFlyer(11*28+2,5*32,room,skyway7,-2)); - items.addElement(new SkywayFlyer(11*28+2,8*32,room,skyway0,-2)); - items.addElement(new SkywayFlyer(14*28+2,2*32,room,skyway1,4)); - items.addElement(new SkywayFlyer(14*28+2,5*32,room,skyway2,4)); - items.addElement(new SkywayFlyer(14*28+2,8*32,room,skyway3,4)); - items.addElement(new SkyGuard(4*28,0,room,4)); - items.addElement(new SkyGuard(10*28,11*32,room,4)); - } - {// Room 4 Skyway - Room room = (Room) rooms.elementAt(4); - int[][] table4 = { - {0, 0, 0, 4,49,49,49,49,49,49,49,49,49,49,49,49, 4, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 4,49,49,49,49,49,49,49,49,49,49,49,49, 4, 0, 0, 0} - }; - room.RoomArray = table4; - - items.addElement(new SkywayFlyer(5*28+2,2*32,room,skyway4,-4)); - items.addElement(new SkywayFlyer(5*28+2,5*32,room,skyway5,-4)); - items.addElement(new SkywayFlyer(5*28+2,8*32,room,skyway6,-4)); - items.addElement(new SkywayFlyer(8*28+2,2*32,room,skyway7,2)); - items.addElement(new SkywayFlyer(8*28+2,5*32,room,skyway0,2)); - items.addElement(new SkywayFlyer(8*28+2,8*32,room,skyway1,2)); - items.addElement(new SkywayFlyer(11*28+2,2*32,room,skyway2,-2)); - items.addElement(new SkywayFlyer(11*28+2,5*32,room,skyway3,-2)); - items.addElement(new SkywayFlyer(11*28+2,8*32,room,skyway4,-2)); - items.addElement(new SkywayFlyer(14*28+2,2*32,room,skyway5,4)); - items.addElement(new SkywayFlyer(14*28+2,5*32,room,skyway6,4)); - items.addElement(new SkywayFlyer(14*28+2,8*32,room,skyway7,4)); - items.addElement(new SkyGuard(4*28,0,room,4)); - items.addElement(new SkyGuard(10*28,11*32,room,4)); - } - {// Room 5 Skyway - Room room = (Room) rooms.elementAt(5); - int[][] table5 = { - {0, 0, 0, 4,49,49,49,49,49,49,49,49,49,49,49,49, 4, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 4,49,49,49,49,49,49,49,49,49,49,49,49, 4, 0, 0, 0} - }; - room.RoomArray = table5; - - room.AddTextBox("I left my nodes in Robotropolis.",160,98, 250); - items.addElement(new SkywayFlyer(5*28+2,2*32,room,skyway0,-4)); - items.addElement(new SkywayFlyer(5*28+2,5*32,room,skyway2,-4)); - items.addElement(new SkywayFlyer(5*28+2,8*32,room,skyway4,-4)); - items.addElement(new SkywayFlyer(8*28+2,2*32,room,skyway6,2)); - items.addElement(new SkywayFlyer(8*28+2,5*32,room,skyway1,2)); - items.addElement(new SkywayFlyer(8*28+2,8*32,room,skyway3,2)); - items.addElement(new SkywayFlyer(11*28+2,2*32,room,skyway5,-2)); - items.addElement(new SkywayFlyer(11*28+2,5*32,room,skyway7,-2)); - items.addElement(new SkywayFlyer(11*28+2,8*32,room,skyway0,-2)); - items.addElement(new SkywayFlyer(14*28+2,2*32,room,skyway3,4)); - items.addElement(new SkywayFlyer(14*28+2,5*32,room,skyway6,4)); - items.addElement(new SkywayFlyer(14*28+2,8*32,room,skyway1,4)); - items.addElement(new SkyGuard(4*28,0,room,4)); - items.addElement(new SkyGuard(10*28,11*32,room,4)); - } - {// Room 6 Skyway - Room room = (Room) rooms.elementAt(6); - int[][] table6 = { - {0, 0, 0, 4,49,49,49,49,49,49,49,49,49,49,49,49, 4, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 4,49,49,49,49,49,49,49,49,49,49,49,49, 4, 0, 0, 0} - }; - room.RoomArray = table6; - - items.addElement(new SkywayFlyer(5*28+2,2*32,room,skyway4,-4)); - items.addElement(new SkywayFlyer(5*28+2,5*32,room,skyway7,-4)); - items.addElement(new SkywayFlyer(5*28+2,8*32,room,skyway2,-4)); - items.addElement(new SkywayFlyer(8*28+2,2*32,room,skyway5,2)); - items.addElement(new SkywayFlyer(8*28+2,5*32,room,skyway0,2)); - items.addElement(new SkywayFlyer(8*28+2,8*32,room,skyway4,2)); - items.addElement(new SkywayFlyer(11*28+2,2*32,room,skyway1,-2)); - items.addElement(new SkywayFlyer(11*28+2,5*32,room,skyway5,-2)); - items.addElement(new SkywayFlyer(11*28+2,8*32,room,skyway2,-2)); - items.addElement(new SkywayFlyer(14*28+2,2*32,room,skyway6,4)); - items.addElement(new SkywayFlyer(14*28+2,5*32,room,skyway3,4)); - items.addElement(new SkywayFlyer(14*28+2,8*32,room,skyway7,4)); - items.addElement(new SkyGuard(4*28,0,room,4)); - items.addElement(new SkyGuard(10*28,11*32,room,4)); - } - {// Room 7 Skyway - Room room = (Room) rooms.elementAt(7); - int[][] table7 = { - {0, 0, 0, 4,49,49,49,49,49,49,49,49,49,49,49,49, 4, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 4,49,49,49,49,49,49,49,49,49,49,49,49, 4, 0, 0, 0} - }; - room.RoomArray = table7; - - room.AddTextBox("I'll have a ramburger and chips to go.",160,96, 300); - items.addElement(new SkywayFlyer(5*28+2,2*32,room,skyway0,-4)); - items.addElement(new SkywayFlyer(5*28+2,5*32,room,skyway5,-4)); - items.addElement(new SkywayFlyer(5*28+2,8*32,room,skyway2,-4)); - items.addElement(new SkywayFlyer(8*28+2,2*32,room,skyway7,2)); - items.addElement(new SkywayFlyer(8*28+2,5*32,room,skyway4,2)); - items.addElement(new SkywayFlyer(8*28+2,8*32,room,skyway1,2)); - items.addElement(new SkywayFlyer(11*28+2,2*32,room,skyway6,-2)); - items.addElement(new SkywayFlyer(11*28+2,5*32,room,skyway3,-2)); - items.addElement(new SkywayFlyer(11*28+2,8*32,room,skyway0,-2)); - items.addElement(new SkywayFlyer(14*28+2,2*32,room,skyway6,4)); - items.addElement(new SkywayFlyer(14*28+2,5*32,room,skyway4,4)); - items.addElement(new SkywayFlyer(14*28+2,8*32,room,skyway2,4)); - items.addElement(new SkyGuard(4*28,0,room,4)); - items.addElement(new SkyGuard(10*28,11*32,room,4)); - } - {// Room 8 Skyway - Room room = (Room) rooms.elementAt(8); - int[][] table8 = { - {0, 0, 0, 4,49,49,49,49,49,49,49,49,49,49,49,49, 4, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, - {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, - {0, 0, 0, 4,49,49,49,49,49,49,49,49,49,49,49,49, 4, 0, 0, 0} - }; - room.RoomArray = table8; - - items.addElement(new SkywayFlyer(5*28+2,2*32,room,skyway7,-4)); - items.addElement(new SkywayFlyer(5*28+2,5*32,room,skyway5,-4)); - items.addElement(new SkywayFlyer(5*28+2,8*32,room,skyway3,-4)); - items.addElement(new SkywayFlyer(8*28+2,2*32,room,skyway1,2)); - items.addElement(new SkywayFlyer(8*28+2,5*32,room,skyway0,2)); - items.addElement(new SkywayFlyer(8*28+2,8*32,room,skyway7,2)); - items.addElement(new SkywayFlyer(11*28+2,2*32,room,skyway6,-2)); - items.addElement(new SkywayFlyer(11*28+2,5*32,room,skyway5,-2)); - items.addElement(new SkywayFlyer(11*28+2,8*32,room,skyway4,-2)); - items.addElement(new SkywayFlyer(14*28+2,2*32,room,skyway3,4)); - items.addElement(new SkywayFlyer(14*28+2,5*32,room,skyway2,4)); - items.addElement(new SkywayFlyer(14*28+2,8*32,room,skyway1,4)); - items.addElement(new SkyGuard(4*28,0,room,4)); - items.addElement(new SkyGuard(10*28,11*32,room,4)); - } - {// Room 9 Pinto Puzzle - Room room = (Room) rooms.elementAt(9); - int[][] table9 = { - {4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0,29, 4, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0,31, 4, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0,30, 4, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0,32, 4, 4}, - {4, 4, 4, 4, 4, 4, 4,27, 0, 0, 0,28, 4, 4, 4, 4, 4, 4, 4, 4}, - {4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} - }; - room.RoomArray = table9; - - room.AddTextBox("{BIG} {255,255,255} 1",506,94, 560); - room.AddTextBox("{BIG} {255,255,255} 2",506,158, 560); - room.AddTextBox("{BIG} {255,255,255} 3",506,222, 560); - room.AddTextBox("{BIG} {255,255,255} 4",506,286, 560); - room.AddTextBox("Based on the 1973 Ford Pinto... What an engine-ous lock!", - 44,64, 350); - room.AddTextBox("STARTER",252,288, 560); - room.AddArrow(11*28+14,10*32,Arrow.DIR_DOWN, 32, Color.white); - room.AddGraphix("whiteVertical.gif",14*28,2*32); - int[] pace = {14*28,3*32, 14*28,9*32}; - int[] protect = {14*28,2*32,19*28,10*32, 10*28,0}; - items.addElement(new Sentry(14*28,3*32,room,pace,protect, false)); - } - {// Room 10 First Sentry, Upper - Room room = (Room) rooms.elementAt(10); - int[][] table10 = { - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,0,0,0,0,8,8,0,0,8,0,0,0,0,8,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,8}, - {0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,8}, - {0,0,0,0,8,8,0,0,0,8,0,0,0,8,8,8,0,0,0,8}, - {8,8,8,8,8,0,0,0,0,8,0,0,0,8,8,8,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,8,0,0,0,8,8,8,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,8,0,0,0,8,8,8,0,0,0,8}, - {8,0,0,0,0,0,0,0,8,0,0,0,0,8,8,8,0,0,0,0}, - {8,0,0,0,8,8,8,8,8,0,0,0,0,8,8,8,0,0,0,0}, - {8,0,0,0,8,8,8,8,8,0,0,0,0,8,8,8,8,8,8,8}, - {8,0,0,0,8,8,8,8,8,0,0,0,8,8,8,8,8,8,8,8} - }; - room.RoomArray = table10; - - int[] pace = {11*28,3*32, 11*28,10*32}; - int[] program={4*28,0,13*28,11*32,0,3*32, 13*28,0,18*28,11*32,19*28,8*32}; - items.addElement(new Sentry(11*28,3*32,room,pace,program,false)); - } - {// Room 11 Sound Lock - Room room = (Room) rooms.elementAt(11); - int[][] table11 = { - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,8,0,0,8,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,8,0,0,8,0,0,0,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8,0,0,0,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8,0,0,0,0}, - {8,0,0,0,0,0,0,0,0,0,0,0,8,0,0,8,0,0,0,0}, - {8,0,0,0,0,0,0,0,0,0,0,0,8,0,0,8,0,0,0,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8} - }; - room.RoomArray = table11; - - room.AddTextBox("This lock is wired for sound. ",76,80, 240); - room.AddTextBox("Beep in time to the flashing receiver.",76,304, 240); - int[][] program = { - {SonicLock.BINARY, 1,0,0,1,1,0,1,0,0,1,1,0}, - {SonicLock.MODIFY, 15,4,0, 15,5,0, 15,6,0, 15,7,0, 16,4,8, 17,5,8, 17,6,8, 16,7,8}, - {SonicLock.MODIFY, 16,4,0, 17,5,0, 17,6,0, 16,7,0, 16,3,8, 17,3,8, 16,8,8, 17,8,8}, - {SonicLock.BINARY, 1,0,0,1,1,0,1,0,0,1,1,0}, - {SonicLock.MODIFY, 16,4,8, 17,5,8, 17,6,8, 16,7,8, 16,3,0, 17,3,0, 16,8,0, 17,8,0}, - {SonicLock.MODIFY, 15,4,8, 15,5,8, 15,6,8, 15,7,8, 16,4,0, 17,5,0, 17,6,0, 16,7,0} - }; - items.addElement(new SonicLock(18*28, 5*32+15, room, program)); - } - {// Room 12 Path after Disk Drive - Room room = (Room) rooms.elementAt(12); - int[][] table12 = { - {8,8,0,0,0,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,0,0,0,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {8,8,0,0,0,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8} - }; - room.RoomArray = table12; - - } - {// Room 13 Chamber before Hot Wires - Room room = (Room) rooms.elementAt(13); - int[][] table13 = { - {9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9}, - {9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9}, - {9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9}, - {9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9}, - {9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9}, - {9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,0,0,9} - }; - room.RoomArray = table13; - - } - {// Room 14 Dark Maze - Room room = (Room) rooms.elementAt(14); - int[][] table14 = { - {10, 0, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0,10,10, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0,10,10, 0, 0, 0,10}, - {10,10,10,10,10, 0, 0, 0, 0,10, 0, 0, 0, 0,10,10, 0, 0, 0,10}, - { 0, 0, 0, 0,10, 0, 0, 0, 0,10, 0, 0, 0, 0,10,10, 0, 0, 0,10}, - { 0, 0, 0, 0,10, 0, 0, 0, 0,10, 0, 0, 0, 0,10,10, 0, 0, 0,10}, - {10, 0, 0, 0,10, 0, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0,10}, - {10, 0, 0, 0,10, 0, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0,10}, - {10, 0, 0, 0,10, 0, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0,10}, - {10, 0, 0, 0,10,10,10,10,10,10,10,10,10,10,10,10, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10} - }; - room.RoomArray = table14; - - room.AddTextBox("?",274,6*32+6,100); - room.AddArrow(280,112,Arrow.DIR_UP, 30, Color.white); - room.AddArrow(280,272,Arrow.DIR_DOWN, 30, Color.white); - room.AddArrow(200,192,Arrow.DIR_LEFT, 30, Color.white); - room.AddArrow(360,192,Arrow.DIR_RIGHT, 30, Color.white); - } - {// Room 15 First Sentry, Lower - Room room = (Room) rooms.elementAt(15); - int[][] table15 = { - {8,0,0,0,8,8,8,8,8,0,0,0,8,8,8,8,8,8,8,8}, - {8,0,0,0,8,0,0,0,0,0,0,0,8,0,0,0,0,0,0,8}, - {8,0,0,0,8,0,0,0,0,0,0,0,8,0,0,0,0,0,0,8}, - {8,0,0,0,8,0,0,0,0,0,0,0,8,0,0,0,0,0,0,8}, - {8,0,0,0,8,0,0,0,8,8,8,8,8,0,0,0,0,0,0,8}, - {8,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,8,8,8,8,8,8,8,8,8,8,8,8,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8} - }; - room.RoomArray = table15; - - } - {// Room 16 Rest Stop - Room room = (Room) rooms.elementAt(16); - int[][] table16 = { - {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, - {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,26, 0, 8}, - {8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8} - }; - room.RoomArray = table16; - - room.AddTextBox("SKYWAY REST STOP",184,2*28, 500); - room.AddTextBox("Next Rest Stop 50 Klicks.",130,4*28, 500); - } - {// Room 17 Timer Sentry Button - Room room = (Room) rooms.elementAt(17); - int[][] table17 = { - {3, 3, 0, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3}, - {0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3,25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, - {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} - }; - room.RoomArray = table17; - - room.AddTextBox("00",32,344, 560); - room.AddTextBox("Deactivate Guard Switch",140,246, 560); - room.AddTextBox("Timer",140,344, 560); - room.AddArrow(3*28,7*32+16,Arrow.DIR_LEFT,28,Color.white); - room.AddArrow(3*28,10*32+16,Arrow.DIR_LEFT,28,Color.white); - } - {// Room 18 Hot Wire Room - Room room = (Room) rooms.elementAt(18); - int[][] table18 = { - {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, - {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, - {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, - {5,22,22,22,22,22,22,22,22,22,22,22,22,23, 0, 0, 0, 0, 0, 5}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24, 0, 0, 0, 0, 0, 5}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24, 0, 0, 0, 0, 0, 5}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24, 0, 0, 0, 0, 0, 5}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24, 0, 0, 0, 0, 0, 5}, - {5,22,22,22,22,22,22,22,23, 0, 0, 0, 0,24, 0, 0, 0, 0, 0, 5}, - {5, 0, 0, 0, 0, 0, 0, 0,24, 0, 0, 0, 0,24, 0, 0, 0, 0, 0, 5}, - {5, 5, 5, 5, 0, 0, 0, 0,24, 0, 0, 0, 0,24, 0, 0, 0, 0, 0, 5}, - {5, 5, 0, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5} - }; - room.RoomArray = table18; - - room.AddTextBox("Hot wires burn batteries...",80,60, 560); - int[] pace = {2*28,5*32, 11*28,5*32}; - int[] program = {4*28,0,12*28,11*32,0,5*32}; - items.addElement(new Sentry(2*28,5*32,room,pace,program,true)); - } - {// Room 19 Chamber before Disk Drive - Room room = (Room) rooms.elementAt(19); - int[][] table19 = { - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 2, 2, 2, 2, 2, 2,21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} - }; - room.RoomArray = table19; - - room.AddTextBox("To Robotropolis Disk-O-Tek",316,182,325); - room.AddArrow(18*28,6*32+8,Arrow.DIR_RIGHT,2*28,Color.white); - } - {// Room 20 Path after Disk Drive - Room room = (Room) rooms.elementAt(20); - int[][] table20 = { - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,0,0,0,0,8,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8}, - {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8} - }; - room.RoomArray = table20; - - } - {// Room 21 Dark Maze - Room room = (Room) rooms.elementAt(21); - int[][] table21 = { - {10, 0, 0, 0, 0,10,10,10,10,10,10, 0, 0, 0,10,10, 0, 0, 0,10}, - {10, 0, 0, 0, 0,10, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0,10}, - {10, 0, 0, 0, 0,10, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0,10}, - {10, 0, 0, 0, 0,10, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0,10}, - {10, 0, 0, 0, 0,10, 0, 0, 0,10,10, 0, 0, 0,10,10, 0, 0, 0,10}, - {10, 0, 0, 0, 0,10, 0, 0, 0,10,10, 0, 0, 0,10,10, 0, 0, 0,10}, - {10, 0, 0, 0, 0,10, 0, 0, 0,10,10, 0, 0, 0,10,10, 0, 0, 0,10}, - {10, 0, 0, 0, 0,10, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0,10}, - {10, 0, 0, 0, 0,10, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0}, - {10, 0, 0, 0, 0,10,10,10,10,10, 0, 0, 0, 0,10,10, 0, 0, 0, 0}, - {10, 0, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0,10,10, 0, 0, 0, 0}, - {10, 0, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0,10,10, 0, 0, 0,10} - }; - room.RoomArray = table21; - - room.AddTextBox("?",274,6*32+6,100); - room.AddArrow(280,112,Arrow.DIR_UP, 30, Color.white); - room.AddArrow(280,272,Arrow.DIR_DOWN, 30, Color.white); - room.AddArrow(200,192,Arrow.DIR_LEFT, 30, Color.white); - room.AddArrow(360,192,Arrow.DIR_RIGHT, 30, Color.white); - } - {// Room 22 Dark Maze - Room room = (Room) rooms.elementAt(22); - int[][] table22 = { - {10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {10, 0, 0, 0, 0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {10,10,10,10,10,10,10, 0, 0, 0,10, 0, 0, 0,10,10,10,10,10,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0,10,10, 0, 0, 0, 0}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0,10,10, 0, 0, 0, 0}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0,10,10, 0, 0, 0, 0}, - {10, 0, 0, 0, 0,10,10,10,10,10,10, 0, 0, 0,10,10, 0, 0, 0,10} - }; - room.RoomArray = table22; - - room.AddTextBox("?",274,6*32+6,100); - room.AddArrow(280,112,Arrow.DIR_UP, 30, Color.white); - room.AddArrow(280,272,Arrow.DIR_DOWN, 30, Color.white); - room.AddArrow(200,192,Arrow.DIR_LEFT, 30, Color.white); - room.AddArrow(360,192,Arrow.DIR_RIGHT, 30, Color.white); - } - {// Room 23 Dark Maze - Room room = (Room) rooms.elementAt(23); - int[][] table23 = { - {10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10}, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 0, 0, 0, 0,10}, - { 0, 0, 0, 0, 0,10, 0, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0,10}, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0,10}, - {10,10, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0,10, 0, 0, 0, 0,10}, - { 0, 0,10,10, 0, 0, 0, 0, 0,10,10, 0, 0, 0,10, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0,10}, - {10,10,10,10,10,10,10,10,10, 0,10,10,10,10,10,10,10,10, 0,10} - }; - room.RoomArray = table23; - - room.AddTextBox("?",274,6*32+6,100); - room.AddArrow(280,112,Arrow.DIR_UP, 30, Color.white); - room.AddArrow(280,272,Arrow.DIR_DOWN, 30, Color.white); - room.AddArrow(200,192,Arrow.DIR_LEFT, 30, Color.white); - room.AddArrow(360,192,Arrow.DIR_RIGHT, 30, Color.white); - } - {// Room 24 Dark Maze - Room room = (Room) rooms.elementAt(24); - int[][] table24 = { - {10,10,10,10,10,10,10,10,10, 0,10,10,10,10,10,10,10,10, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0,10, 0,10, 0, 0, 0, 0, 0, 0, 0, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0,10, 0,10,10,10,10, 0,10,10,10,10,10}, - {10, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0,10, 0,10, 0, 0, 0, 0}, - {10, 0, 0, 0,10,10,10,10,10, 0,10,10, 0,10, 0,10, 0,10, 0, 0}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 0,10, 0,10, 0,10, 0,10}, - {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 0,10, 0,10, 0,10, 0,10}, - {10,10,10,10,10,10,10, 0, 0, 0, 0,10, 0,10, 0,10, 0,10, 0,10}, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 0,10, 0, 0, 0,10, 0,10}, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 0,10,10,10,10,10, 0,10}, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0, 0, 0, 0,10}, - {10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10} - }; - room.RoomArray = table24; - - room.AddTextBox("?",274,6*32+6,100); - room.AddArrow(280,112,Arrow.DIR_UP, 30, Color.white); - room.AddArrow(280,272,Arrow.DIR_DOWN, 30, Color.white); - room.AddArrow(200,192,Arrow.DIR_LEFT, 30, Color.white); - room.AddArrow(360,192,Arrow.DIR_RIGHT, 30, Color.white); - } - {// Room 25 Grid Puzzle - Room room = (Room) rooms.elementAt(25); - int[][] table25 = { - {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, - {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,33,33,33,33, 9, 9}, - {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,33,33,33,33, 9, 9}, - {9, 9,33,33,33,33,33,33,33,33, 0, 0, 0, 0,33,33,33,33, 9, 9}, - {9, 9,33,33,33,33,33,33,33,33, 0, 0, 0, 0,33,33,33,33, 9, 9}, - {9, 9,33,33,33,33, 0, 0, 0, 0, 0, 0, 0, 0,33,33,33,33, 9, 9}, - {9, 9,33,33,33,33, 0, 0, 0, 0, 0, 0, 0, 0,33,33,33,33, 9, 9}, - {9, 9,33,33,33,33, 0, 0, 0, 0,33,33,33,33,33,33,33,33, 9, 9}, - {9, 9,33,33,33,33, 0, 0, 0, 0,33,33,33,33,33,33,33,33, 9, 9}, - {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, - {9, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,36, 9, 9}, - {9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9} - }; - room.RoomArray = table25; - - items.addElement(new HiddenCamera(room)); - room.AddTextBox("00",28,350,100); - room.AddTextBox("Timer",4*28,350,100); - room.AddArrow(3*28,10*32+16,Arrow.DIR_LEFT,28,Color.white); - room.AddTextBox("Blue Grid Switch",9*28,350, 560); - room.AddArrow(17*28,10*32+16,Arrow.DIR_RIGHT,28,Color.white); - room.AddGraphix("blueHorizontal.gif",2*28+2,1*32+2); - room.AddGraphix("blueHorizontal.gif",2*28+2,3*32); - room.AddGraphix("blueHorizontal.gif",2*28+2,5*32); - room.AddGraphix("blueHorizontal.gif",2*28+2,7*32); - room.AddGraphix("blueHorizontal.gif",2*28+2,9*32); - room.AddGraphix("blueVertical.gif",2*28+2,34); - room.AddGraphix("blueVertical.gif",6*28,34); - room.AddGraphix("blueVertical.gif",10*28,34); - room.AddGraphix("blueVertical.gif",14*28,34); - room.AddGraphix("blueVertical.gif",18*28-6,34); - } - {// Room 26 Grid puzzle map - Room room = (Room) rooms.elementAt(26); - int[][] table26 = { - {9, 9, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, - {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, - {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, - {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, - {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, - {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, - {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, - {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, - {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, - {9, 9,35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, - {9, 9,34,35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,37, 9, 9}, - {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9} - }; - room.RoomArray = table26; - - room.AddArrow( 4*28+22,2*32,Arrow.DIR_RIGHT,32,Color.white); - room.AddArrow( 8*28+22,2*32,Arrow.DIR_RIGHT,32,Color.white); - room.AddArrow(12*28+22,2*32,Arrow.DIR_RIGHT,32,Color.white); - room.AddTextBox("{BIG} {255,128,000} X",15*28+14, 1*32, 50); - room.AddTextBox("{BIG} {255,128,000} X", 3*28+14, 3*32, 50); - room.AddTextBox("{BIG} {255,128,000} X", 7*28+14, 3*32, 50); - room.AddArrow(12*28,5*32-18,Arrow.DIR_DOWN,32,Color.white); - room.AddTextBox("{BIG} {255,128,000} X",15*28+14, 3*32, 50); - room.AddTextBox("{BIG} {255,128,000} X", 3*28+14, 5*32, 50); - room.AddArrow( 8*28-18,6*32,Arrow.DIR_LEFT,32,Color.white); - room.AddArrow(12*28-18,6*32,Arrow.DIR_LEFT,32,Color.white); - room.AddTextBox("{BIG} {255,128,000} X",15*28+14, 5*32, 50); - room.AddTextBox("{BIG} {255,128,000} X", 3*28+14, 7*32, 50); - room.AddArrow( 8*28,9*32-18,Arrow.DIR_DOWN,32,Color.white); - room.AddTextBox("{BIG} {255,128,000} X",11*28+14, 7*32, 50); - room.AddTextBox("{BIG} {255,128,000} X",15*28+14, 7*32, 50); - - room.AddTextBox("Open Door",380,338, 560); - room.AddTextBox("View room below",104,320, 120); - room.AddArrow(104,10*32+16,Arrow.DIR_LEFT,28,Color.white); - room.AddGraphix("whiteHorizontal.gif",2*28+2,1*32+2); - room.AddGraphix("whiteHorizontal.gif",2*28+2,3*32); - room.AddGraphix("whiteHorizontal.gif",2*28+2,5*32); - room.AddGraphix("whiteHorizontal.gif",2*28+2,7*32); - room.AddGraphix("whiteHorizontal.gif",2*28+2,9*32); - room.AddGraphix("whiteVertical.gif",2*28+2,34); - room.AddGraphix("whiteVertical.gif",6*28,34); - room.AddGraphix("whiteVertical.gif",10*28,34); - room.AddGraphix("whiteVertical.gif",14*28,34); - room.AddGraphix("whiteVertical.gif",18*28-6,34); - - } - {// Room 27 Final Puzzle - Room room = (Room) rooms.elementAt(27); - int[][] table27 = { - {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, - {2, 0, 0, 0, 0, 0, 0, 2,38, 0, 0,39, 2, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 2}, - {2, 2,42, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,43, 2, 2}, - {2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2}, - {2, 2,40, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,41, 2, 2}, - {2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2}, - {2, 2,44, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0,45, 2, 2}, - {2, 0, 0, 0, 0,46, 0, 2, 0, 0, 0, 0, 2, 0,47, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 2, 0, 2,48, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} - }; - room.RoomArray = table27; - - room.AddTextBox("{BIG} {000,000,255} 3",28,94, 560); - room.AddTextBox("STARTER",412,52, 560); - room.AddArrow(13*28,32+16,Arrow.DIR_LEFT,28,Color.white); - room.AddTextBox("{BIG} {255,000,255} 2",504,158, 560); - room.AddTextBox("{BIG} {000,000,255} 1",28,158, 560); - room.AddTextBox("{BIG} {255,000,255} 4",504,94, 560); - room.AddTextBox("{BIG} {000,204,000} 5",28,318, 560); - room.AddTextBox("{BIG} {255,128,000} 6",504,318, 560); - room.AddTextBox("{BIG} {000,204,000} 7",112,350, 560); - room.AddTextBox("{BIG} {255,128,000} 8",420,350, 560); - room.AddTextBox("TRANSPORTER",216,134, 560); - room.AddTextBox("Press buttons in order.",196,166,170); - room.AddTextBox("Press last.",228,270,100); - room.AddArrow(8*28+14,10*32,Arrow.DIR_DOWN,32,Color.white); - } - {// Room 28 Disk Drive Entrance - Room room = (Room) rooms.elementAt(28); - int[][] table28 = { - {0, 8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 8, 0, 8, 0, 8, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, - {0, 8, 0, 8, 0, 8, 0, 8,14,14,14,14,14,14,14,14,14,14,14,14}, - {0, 8, 8, 8, 8, 8, 0, 8,14,14,14,14,14,14,14,14,14,14,14,14}, - {8, 8, 8, 8, 8, 8, 8, 8,12,12,12, 8, 8, 8, 8, 8, 8, 8, 8, 8}, - {0, 0, 0, 0, 0, 0, 0,20,12,12,12, 8, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0,20,12,12,12, 8, 0, 0, 0, 0, 0, 0, 0, 0}, - {8, 8, 8, 8, 8, 8, 8, 8,12,12,12, 8, 8, 8, 8, 8, 8, 8, 8, 8}, - {0, 8, 8, 8, 0, 0, 0, 8,12,12,18,18,18,18,18,18,18,18,18,18}, - {0, 8, 0, 0, 8, 0, 0, 8,12,18,18,18,18,18,18,18,18,18,18,18}, - {0, 8, 8, 8, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, - {0, 8, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - }; - room.RoomArray = table28; - - room.AddTextBox("{BIG} {255,255,255} Robart ",320,208, 560); - } - {// Room 29 Disk Drive Path - Room room = (Room) rooms.elementAt(29); - int[][] table29 = { - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,12,12,12, 8, 0, 0, 0}, - { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,12,12,12, 8, 0, 0, 0}, - {14,14,14,14,14,14,14,14,14,14,14,14,14,12,12,12, 8, 0, 0, 0}, - {14,14,14,14,14,14,14,14,14,14,14,14,14,12,12,12, 8, 0, 0, 0}, - { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0}, - {18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18, 8, 0, 0, 0}, - {18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18, 8, 0, 0, 0}, - { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,12,12,12, 8, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,12,12,12, 8, 0, 0, 0} - }; - room.RoomArray = table29; - - room.AddTextBox("{BIG} {255,255,255} RO400 Disk Drive",12,208, 560); - } - {// Room 30 Disk Drive Top Left - Room room = (Room) rooms.elementAt(30); - int[][] table30 = { - { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0,18,18}, - { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0,18,18,18,18,18,18,18,18}, - { 7, 7, 7, 7, 7, 7, 7, 7,16,18,18,18,18,18,18,18,18,18,18,18}, - { 7, 7, 7, 7, 7, 7,16,18,18,18,18,18,18,18,18,18,17,17,18,18}, - { 7, 7, 7, 7, 7,16,18,18,18,18,18,18,18,18,18,17,17,17,18,18}, - { 7, 7, 7, 7,16,18,18,18,18,18,18,18,18,16,17,17,17,17,18,18}, - { 7, 7, 7,16,18,18,18,18,18,18,18,18,17,17,17,17,17,17,18,18}, - { 7, 7, 7,16,18,18,18,18,18,18,18,17,16,17,17,17,17,18,18,18}, - {18,18,18,18,18,18,18,18,18,18,17,16,16,16,16,17,16,18,18, 7}, - {18,18,18,18,18,18,18, 7, 7, 0,16,16,16,16,16,16,18, 7, 7, 7}, - { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,16,16,16,16,16,16, 7, 7, 7, 7} - }; - room.RoomArray = table30; - - room.AddTextBox("On a clear disk you can seek forever...",200,188, 300); - } - {// Room 31 Disk Drive Top Right - Room room = (Room) rooms.elementAt(31); - int[][] table31 = { - { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - {18,18,18, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - {18,18,18,18,18,18,18,18,18, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - {18,18,18,18,18,18,18,18,18,18,18,18, 7, 7, 7, 7, 7, 7, 7, 7}, - {18,18,18,18,18,18,18,18,18,18,18,18,18,18, 7, 7, 7, 7, 7, 7}, - {18,18,18,18,18,18,18,19,18,18,12,12,12,12,18, 7, 7, 7, 7, 7}, - {18,18,18,18,18,18,19,19,19,19,12,12,12,12,12,18, 7, 7, 7, 7}, - {18,18,18,18,18,19,19,19,19,19,19,12,12,12,12,12,18, 7, 7, 7}, - {18,18,18,18,19,19,19,19,19,19,19,19,12,12,12,12,12, 7, 7, 7}, - { 7,12,18,19,19,19,19,19,19,19,19,19,19,12,12,12,12,18, 7, 7}, - { 7, 7, 7,19,12,12,12,12,19,19,19,19,19,19,12,12,12,12,18, 7}, - { 7, 7, 7, 7,12,12,12,12,19,19,19,19,19,19,19,12,12,12,12, 7} - }; - room.RoomArray = table31; - - } - {// Room 32 Disk Drive Bottom Right - Room room = (Room) rooms.elementAt(32); - int[][] table32 = { - { 7, 7, 7, 7,12,13,12,12,12,12,12,12,12,12,12,12,12,12,12, 7}, - { 7, 7, 7,14,13,13,13,13,13,13,13,13,13,12,12,12,12,12,12, 7}, - { 7,14,14,13,13,13,13,13,13,13,13,13,13,13,12,12,12,12, 7, 7}, - {14,14,14,14,14,14,13,13,13,13,13,13,13,13,13,12,12, 7, 7, 7}, - {14,14,14,14,14,14,14,13,13,13,13,13,13,13,13,12,12, 7, 7, 7}, - {14,14,14,14,14,14,14,14,13,13,13,13,13,13,12,12, 7, 7, 7, 7}, - {14,14,14,14,14,14,14,14,14,13,13,13,13,12,12, 7, 7, 7, 7, 7}, - {14,14,14,14,14,14,14,14,14,14,13,12,12,12, 7, 7, 7, 7, 7, 7}, - {14,14,14,14,14,14,14,14,14,14,14,12, 7, 7, 7, 7, 7, 7, 7, 7}, - {14,14,14,14,14,14,14,14,12, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - {14,14,12, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, - { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} - }; - room.RoomArray = table32; - - } - {// Room 33 Disk Drive Bottom Left - Room room = (Room) rooms.elementAt(33); - int[][] table33 = { - { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,16,16,16,16,16,16, 7, 7, 7, 7}, - {14,14,14,15,15,15,16, 7, 7,16,16,16,16,16,16,16, 0, 7, 7, 7}, - {14,14,14,14,15,15,14,14,14,16,16,16,16,16,16,16, 0, 0, 0, 7}, - { 7, 7, 7,14,14,15,15,14,14,14,15,15,15,15,15,14,14,14,14,14}, - { 7, 7, 7,14,14,14,15,15,15,15,14,15,15,15,14,14,14,14,14,14}, - { 7, 7, 7, 7,14,14,14,14,14,14,14,15,15,15,14,14,14,14,14,14}, - { 7, 7, 7, 7, 7,14,14,14,14,14,14,14,15,15,14,14,14,14,14,14}, - { 7, 7, 7, 7, 7, 7,14,14,14,14,14,14,14,15,14,14,14,14,14,14}, - { 7, 7, 7, 7, 7, 7, 7, 7,14,14,14,14,14,14,14,14,14,14,14,14}, - { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,14,14,14,14,14,14,14,14,14}, - { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,14,14,14}, - { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} - }; - room.RoomArray = table33; - - room.AddTextBox("Welcome to", 284,222, 250); - room.AddTextBox("The Robotropolis", 248,242, 250); - room.AddTextBox("Disk-O-Tek", 316,262, 250); - items.addElement(new BinaryKey(9*28,1*32,room)); - String[] disco1 = {"disco0.gif","disco1.gif"}; - String[] disco2 = {"disco2.gif","disco3.gif"}; - String[] disco3 = {"disco4.gif","disco5.gif"}; - room.AddGraphix(disco1,9*28,8*32); - room.AddGraphix(disco2,12*28,7*32); - room.AddGraphix(disco3,16*28,9*32); - } - {// Room 34 Disk Drive Path - Room room = (Room) rooms.elementAt(34); - int[][] table34 = { - {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,12,12,12, 9, 9, 9, 9}, - {9,14,14,14,14,14,14,14,14,14,14,14,14,12,12,12, 9, 0, 0, 0}, - {9,12,14,14,14,14,14,14,14,14,14,14,14,14,12,12, 9, 0, 0, 0}, - {9,12,12,12, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0}, - {9,12,12,12, 9, 0, 0, 9, 9, 9, 0, 0, 0, 9, 9, 9, 0, 0, 0, 0}, - {9,12,12,12, 9, 0, 0, 9, 0, 0, 9, 0, 0, 9, 0, 0, 9, 0, 0, 0}, - {9,12,12,12, 9, 0, 0, 9, 9, 9, 0, 0, 0, 9, 0, 0, 9, 0, 0, 0}, - {9,12,12,12, 9, 0, 0, 9, 0, 0, 9, 0, 0, 9, 9, 9, 0, 0, 0, 0}, - {9,12,12,12, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, - {9,12,12,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18}, - {9,12,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18}, - {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9} - }; - room.RoomArray = table34; - - } - {// Room 35 Disk Drive Path - Room room = (Room) rooms.elementAt(35); - int[][] table35 = { - {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, - {3,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14}, - {3,12,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14}, - {3,12,12,12, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, - {3,12,12,12, 3, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 3, 0, 0, 0}, - {3,12,12,12, 3, 0, 0, 3, 0, 3, 0, 3, 0, 0, 3, 0, 0, 3, 0, 0}, - {3,12,12,12, 3, 0, 0, 3, 0, 3, 0, 3, 0, 0, 3, 3, 3, 3, 0, 0}, - {3,12,12,12, 3, 0, 0, 3, 3, 3, 3, 3, 0, 0, 3, 0, 0, 3, 0, 0}, - {3,12,12,12, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0}, - {3,12,12,18,18,18,18,18,18,18,18,18,18,18,18,18, 3, 0, 0, 0}, - {3,12,18,18,18,18,18,18,18,18,18,18,18,18,12,12, 3, 0, 0, 0}, - {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,12,12,12, 3, 3, 3, 3} - }; - room.RoomArray = table35; - - } - {// Room 36 Chamber after Grid Puzzle - Room room = (Room) rooms.elementAt(36); - int[][] table36 = { - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2}, - {2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2}, - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table36; - - } + {Switch.SETVALUEHIGH}, + {Switch.REPLACE, 2, 11, 0}, + {Switch.REPLACE, 3, 11, 0}, + {Switch.REPLACE, 4, 11, 0}, + {Switch.REPLACE, 5, 11, 0}, + {Switch.DOWNROOM}, + {Switch.REPLACE, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0}, + {Switch.WAIT4REMOVAL}, + {Switch.REPLACE, 5, 11, 9}, + {Switch.REPLACE, 4, 11, 9}, + {Switch.REPLACE, 3, 11, 9}, + {Switch.REPLACE, 2, 11, 9}, + {Switch.DOWNROOM}, + {Switch.REPLACE, 2, 0, 9, 3, 0, 9, 4, 0, 9, 5, 0, 9}, + {Switch.SETVALUELOW} + }; + materials.addElement(new Switch(Switch.ROT_RIGHT, program4)); //37=Grid door Switch + int[][] program5 = { + {BinaryLock.NARROW}, + {6, 2, 2, 9, 2, 0, 10, 2, 0, 13, 2, 2}, + {5, 2, 2, 8, 2, 0, 11, 2, 0, 14, 2, 2}, + {BinaryLock.NARROW}, + {5, 2, 0, 8, 2, 2, 11, 2, 2, 14, 2, 0}, + {6, 2, 0, 9, 2, 2, 10, 2, 2, 13, 2, 0} + }; + materials.addElement(new BinaryLock(Color.blue, program5)); //38=Binary Lock + materials.addElement(new MultiButton(0, 1)); // 39= MultiButton Starter + materials.addElement(new MultiButton(1, 0)); // 40= Multibutton 1 + materials.addElement(new MultiButton(2, 0)); // 41= Multibutton 2 + materials.addElement(new MultiButton(3, 0)); // 42= Multibutton 3 + materials.addElement(new MultiButton(4, 0)); // 43= Multibutton 4 + materials.addElement(new MultiButton(5, 0)); // 44= Multibutton 5 + materials.addElement(new MultiButton(6, 0)); // 45= Multibutton 6 + materials.addElement(new MultiButton(7, 0)); // 46= Multibutton 7 + materials.addElement(new MultiButton(8, 0)); // 47= Multibutton 8 + materials.addElement(new MultiButton(9, 0)); // 48= Multibutton 9 + materials.addElement(new SkyGuardMat()); // 49= SkyGuard - {// Room 37 Secret Room - Room room = (Room) rooms.elementAt(37); - room.SetMaterialOutline(0,0,19,11,2); - room.SetMaterial(16,0,0); - room.AddTextBox("All right! You've found the fifth secret.",2*28,4*32,500); - room.AddTextBox("To find the Secret 6th Level, look for a hidden path to the right when you're declared a Robot Master.", - 2*28,6*32,500); - String[] helperlist = { - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper1.gif","helper4.gif","helper2.gif","helper3.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper5.gif","helper5.gif","helper5.gif","helper5.gif", - }; - Graphix helper = new Graphix(helperlist,15*28, 8*32); - room.graphix.addElement(helper); - items.addElement(new Key(16*28,3*32,room,new Color(255,0,255))); - } - - int[] skyways = {8,7,6,5,4,3,1}; - LinkRoomsVertically(skyways); - - int[] roomlist1 = {1,2,3,10,4,19,28,29}; - LinkRoomsHorizontally(roomlist1); - LinkRoomsUpDown(10,15); - LinkRoomsUpDown(1,37); - - LinkRoomsUpDown(19,12); - int[] roomlist2 = {12,20,5,11,6,13,18}; - LinkRoomsHorizontally(roomlist2); - - int[][] roomgrid1 = { - {34,30,31}, - {35,33,32}}; - LinkRoomsGrid(roomgrid1); - LinkRoomsUpDown(35,29); - LinkRoomsUpDown(29,34); - - LinkRoomsUpDown(18,17); - - int[] roomlist3 = {22,23,8,16,17,7,14}; - LinkRoomsHorizontally(roomlist3); - - LinkRoomsLeftRight(21,24); - LinkRoomsUpDown(22,21); - LinkRoomsUpDown(21,14); - LinkRoomsUpDown(23,24); - - ((Room) rooms.elementAt(24)).rightRoom = (Room) rooms.elementAt(14); // 1-way connection - - int[] roomlist4 = {13,16,9,26,25,36,27}; - LinkRoomsVertically(roomlist4); - - gameCursor = new GameCursor(6*28,8*32,(Room) rooms.elementAt(1)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - solderingPen = new SolderingPen(); - remote = new Remote(); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - player = gameCursor; - currentViewer = player; + materials.addElement(new Material(new Color(192, 192, 255), true, true)); // 50=False wall - } + for (int a = 0; a < 38; a++) { + rooms.addElement(new Room()); + } + + String[] skyway0 = {"skyway00.gif", "skyway01.gif", "skyway02.gif"}; + String[] skyway1 = {"skyway03.gif", "skyway04.gif"}; + String[] skyway2 = {"skyway05.gif", "skyway06.gif", "skyway07.gif", "skyway08.gif"}; + String[] skyway3 = {"skyway09.gif", "skyway10.gif", "skyway11.gif"}; + String[] skyway4 = {"skyway12.gif", "skyway13.gif"}; + String[] skyway5 = {"skyway14.gif", "skyway15.gif"}; + String[] skyway6 = {"skyway16.gif", "skyway17.gif"}; + String[] skyway7 = {"skyway18.gif", "skyway19.gif", "skyway20.gif"}; + String[] skyguard = {"skyguard0.gif", "skyguard1.gif", "skyguard2.gif", "skyguard3.gif", "skyguard4.gif"}; + + {// Room 0 Help + Room room = rooms.elementAt(0); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + + room.AddTextBox("Travel the Skyways to freedom!", 80, 64, 560); + room.AddTextBox("HINTS:", + 56, 3 * 32, 560); + room.AddTextBox("Beware of Skyway traffic!", + 56, 4 * 32, 560); + room.AddTextBox("Timing is critical for many locks.", + 56, 5 * 32, 500); + room.AddTextBox("The Disk-O-Tek key is a sonic pattern. Read it from left to right. Repeat it once.", + 56, 6 * 32, 500); + room.AddTextBox("Don't linger on the buttons.", + 56, 8 * 32, 500); + room.AddTextBox("Arrows show the path through the blue grid. Your 'bot must ride it alone.", + 56, 9 * 32, 500); + room.AddTextBox("(To continue, press RETURN.)", + 96, 346, 500); + } + {// Room 1 Entrance: Locked Door + Room room = rooms.elementAt(1); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 2, 0, 0, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 50, 2, 2, 2} + }; + + } + {// Room 2 Entrance Chamber + Room room = rooms.elementAt(2); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2}, + {2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + + } + {// Room 3 Skyway + Room room = rooms.elementAt(3); + room.RoomArray = new int[][]{ + {0, 0, 0, 4, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 4, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 4, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 4, 0, 0, 0} + }; + + room.AddTextBox("The Skyways of Robotropolis", 118, 86, 560); + items.addElement(new SkywayFlyer(5 * 28 + 2, 2 * 32, room, skyway0, -4)); + items.addElement(new SkywayFlyer(5 * 28 + 2, 5 * 32, room, skyway1, -4)); + items.addElement(new SkywayFlyer(5 * 28 + 2, 8 * 32, room, skyway2, -4)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 2 * 32, room, skyway3, 2)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 5 * 32, room, skyway4, 2)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 8 * 32, room, skyway5, 2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 2 * 32, room, skyway6, -2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 5 * 32, room, skyway7, -2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 8 * 32, room, skyway0, -2)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 2 * 32, room, skyway1, 4)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 5 * 32, room, skyway2, 4)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 8 * 32, room, skyway3, 4)); + items.addElement(new SkyGuard(4 * 28, 0, room, 4)); + items.addElement(new SkyGuard(10 * 28, 11 * 32, room, 4)); + } + {// Room 4 Skyway + Room room = rooms.elementAt(4); + room.RoomArray = new int[][]{ + {0, 0, 0, 4, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 4, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 4, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 4, 0, 0, 0} + }; + + items.addElement(new SkywayFlyer(5 * 28 + 2, 2 * 32, room, skyway4, -4)); + items.addElement(new SkywayFlyer(5 * 28 + 2, 5 * 32, room, skyway5, -4)); + items.addElement(new SkywayFlyer(5 * 28 + 2, 8 * 32, room, skyway6, -4)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 2 * 32, room, skyway7, 2)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 5 * 32, room, skyway0, 2)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 8 * 32, room, skyway1, 2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 2 * 32, room, skyway2, -2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 5 * 32, room, skyway3, -2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 8 * 32, room, skyway4, -2)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 2 * 32, room, skyway5, 4)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 5 * 32, room, skyway6, 4)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 8 * 32, room, skyway7, 4)); + items.addElement(new SkyGuard(4 * 28, 0, room, 4)); + items.addElement(new SkyGuard(10 * 28, 11 * 32, room, 4)); + } + {// Room 5 Skyway + Room room = rooms.elementAt(5); + room.RoomArray = new int[][]{ + {0, 0, 0, 4, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 4, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 4, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 4, 0, 0, 0} + }; + + room.AddTextBox("I left my nodes in Robotropolis.", 160, 98, 250); + items.addElement(new SkywayFlyer(5 * 28 + 2, 2 * 32, room, skyway0, -4)); + items.addElement(new SkywayFlyer(5 * 28 + 2, 5 * 32, room, skyway2, -4)); + items.addElement(new SkywayFlyer(5 * 28 + 2, 8 * 32, room, skyway4, -4)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 2 * 32, room, skyway6, 2)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 5 * 32, room, skyway1, 2)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 8 * 32, room, skyway3, 2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 2 * 32, room, skyway5, -2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 5 * 32, room, skyway7, -2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 8 * 32, room, skyway0, -2)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 2 * 32, room, skyway3, 4)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 5 * 32, room, skyway6, 4)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 8 * 32, room, skyway1, 4)); + items.addElement(new SkyGuard(4 * 28, 0, room, 4)); + items.addElement(new SkyGuard(10 * 28, 11 * 32, room, 4)); + } + {// Room 6 Skyway + Room room = rooms.elementAt(6); + room.RoomArray = new int[][]{ + {0, 0, 0, 4, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 4, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 4, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 4, 0, 0, 0} + }; + + items.addElement(new SkywayFlyer(5 * 28 + 2, 2 * 32, room, skyway4, -4)); + items.addElement(new SkywayFlyer(5 * 28 + 2, 5 * 32, room, skyway7, -4)); + items.addElement(new SkywayFlyer(5 * 28 + 2, 8 * 32, room, skyway2, -4)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 2 * 32, room, skyway5, 2)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 5 * 32, room, skyway0, 2)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 8 * 32, room, skyway4, 2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 2 * 32, room, skyway1, -2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 5 * 32, room, skyway5, -2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 8 * 32, room, skyway2, -2)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 2 * 32, room, skyway6, 4)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 5 * 32, room, skyway3, 4)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 8 * 32, room, skyway7, 4)); + items.addElement(new SkyGuard(4 * 28, 0, room, 4)); + items.addElement(new SkyGuard(10 * 28, 11 * 32, room, 4)); + } + {// Room 7 Skyway + Room room = rooms.elementAt(7); + room.RoomArray = new int[][]{ + {0, 0, 0, 4, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 4, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 4, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 4, 0, 0, 0} + }; + + room.AddTextBox("I'll have a ramburger and chips to go.", 160, 96, 300); + items.addElement(new SkywayFlyer(5 * 28 + 2, 2 * 32, room, skyway0, -4)); + items.addElement(new SkywayFlyer(5 * 28 + 2, 5 * 32, room, skyway5, -4)); + items.addElement(new SkywayFlyer(5 * 28 + 2, 8 * 32, room, skyway2, -4)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 2 * 32, room, skyway7, 2)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 5 * 32, room, skyway4, 2)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 8 * 32, room, skyway1, 2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 2 * 32, room, skyway6, -2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 5 * 32, room, skyway3, -2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 8 * 32, room, skyway0, -2)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 2 * 32, room, skyway6, 4)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 5 * 32, room, skyway4, 4)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 8 * 32, room, skyway2, 4)); + items.addElement(new SkyGuard(4 * 28, 0, room, 4)); + items.addElement(new SkyGuard(10 * 28, 11 * 32, room, 4)); + } + {// Room 8 Skyway + Room room = rooms.elementAt(8); + room.RoomArray = new int[][]{ + {0, 0, 0, 4, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 4, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, + {0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {0, 0, 0, 4, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 4, 0, 0, 0} + }; + + items.addElement(new SkywayFlyer(5 * 28 + 2, 2 * 32, room, skyway7, -4)); + items.addElement(new SkywayFlyer(5 * 28 + 2, 5 * 32, room, skyway5, -4)); + items.addElement(new SkywayFlyer(5 * 28 + 2, 8 * 32, room, skyway3, -4)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 2 * 32, room, skyway1, 2)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 5 * 32, room, skyway0, 2)); + items.addElement(new SkywayFlyer(8 * 28 + 2, 8 * 32, room, skyway7, 2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 2 * 32, room, skyway6, -2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 5 * 32, room, skyway5, -2)); + items.addElement(new SkywayFlyer(11 * 28 + 2, 8 * 32, room, skyway4, -2)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 2 * 32, room, skyway3, 4)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 5 * 32, room, skyway2, 4)); + items.addElement(new SkywayFlyer(14 * 28 + 2, 8 * 32, room, skyway1, 4)); + items.addElement(new SkyGuard(4 * 28, 0, room, 4)); + items.addElement(new SkyGuard(10 * 28, 11 * 32, room, 4)); + } + {// Room 9 Pinto Puzzle + Room room = rooms.elementAt(9); + room.RoomArray = new int[][]{ + {4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 29, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 31, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 30, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 32, 4, 4}, + {4, 4, 4, 4, 4, 4, 4, 27, 0, 0, 0, 28, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} + }; + + room.AddTextBox("{BIG} {255,255,255} 1", 506, 94, 560); + room.AddTextBox("{BIG} {255,255,255} 2", 506, 158, 560); + room.AddTextBox("{BIG} {255,255,255} 3", 506, 222, 560); + room.AddTextBox("{BIG} {255,255,255} 4", 506, 286, 560); + room.AddTextBox("Based on the 1973 Ford Pinto... What an engine-ous lock!", + 44, 64, 350); + room.AddTextBox("STARTER", 252, 288, 560); + room.AddArrow(11 * 28 + 14, 10 * 32, Arrow.DIR_DOWN, 32, Color.white); + room.AddGraphix("whiteVertical.gif", 14 * 28, 2 * 32); + int[] pace = {14 * 28, 3 * 32, 14 * 28, 9 * 32}; + int[] protect = {14 * 28, 2 * 32, 19 * 28, 10 * 32, 10 * 28, 0}; + items.addElement(new Sentry(14 * 28, 3 * 32, room, pace, protect, false)); + } + {// Room 10 First Sentry, Upper + Room room = rooms.elementAt(10); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 0, 0, 0, 0, 8, 8, 0, 0, 8, 0, 0, 0, 0, 8, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {0, 0, 0, 0, 8, 8, 0, 0, 0, 8, 0, 0, 0, 8, 8, 8, 0, 0, 0, 8}, + {8, 8, 8, 8, 8, 0, 0, 0, 0, 8, 0, 0, 0, 8, 8, 8, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 8, 8, 8, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 8, 8, 8, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 8, 8, 8, 0, 0, 0, 0}, + {8, 0, 0, 0, 8, 8, 8, 8, 8, 0, 0, 0, 0, 8, 8, 8, 0, 0, 0, 0}, + {8, 0, 0, 0, 8, 8, 8, 8, 8, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8}, + {8, 0, 0, 0, 8, 8, 8, 8, 8, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8} + }; + + int[] pace = {11 * 28, 3 * 32, 11 * 28, 10 * 32}; + int[] program = {4 * 28, 0, 13 * 28, 11 * 32, 0, 3 * 32, 13 * 28, 0, 18 * 28, 11 * 32, 19 * 28, 8 * 32}; + items.addElement(new Sentry(11 * 28, 3 * 32, room, pace, program, false)); + } + {// Room 11 Sound Lock + Room room = rooms.elementAt(11); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 8, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 8, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 0, 0, 0, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 0, 0, 0, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 8, 0, 0, 0, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 8, 0, 0, 0, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8} + }; + + room.AddTextBox("This lock is wired for sound. ", 76, 80, 240); + room.AddTextBox("Beep in time to the flashing receiver.", 76, 304, 240); + int[][] program = { + {SonicLock.BINARY, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0}, + {SonicLock.MODIFY, 15, 4, 0, 15, 5, 0, 15, 6, 0, 15, 7, 0, 16, 4, 8, 17, 5, 8, 17, 6, 8, 16, 7, 8}, + {SonicLock.MODIFY, 16, 4, 0, 17, 5, 0, 17, 6, 0, 16, 7, 0, 16, 3, 8, 17, 3, 8, 16, 8, 8, 17, 8, 8}, + {SonicLock.BINARY, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0}, + {SonicLock.MODIFY, 16, 4, 8, 17, 5, 8, 17, 6, 8, 16, 7, 8, 16, 3, 0, 17, 3, 0, 16, 8, 0, 17, 8, 0}, + {SonicLock.MODIFY, 15, 4, 8, 15, 5, 8, 15, 6, 8, 15, 7, 8, 16, 4, 0, 17, 5, 0, 17, 6, 0, 16, 7, 0} + }; + items.addElement(new SonicLock(18 * 28, 5 * 32 + 15, room, program)); + } + {// Room 12 Path after Disk Drive + Room room = rooms.elementAt(12); + room.RoomArray = new int[][]{ + {8, 8, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 8, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8} + }; + + } + {// Room 13 Chamber before Hot Wires + Room room = rooms.elementAt(13); + room.RoomArray = new int[][]{ + {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, + {9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 9} + }; + + } + {// Room 14 Dark Maze + Room room = rooms.elementAt(14); + room.RoomArray = new int[][]{ + {10, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {10, 10, 10, 10, 10, 0, 0, 0, 0, 10, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {0, 0, 0, 0, 10, 0, 0, 0, 0, 10, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {0, 0, 0, 0, 10, 0, 0, 0, 0, 10, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {10, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {10, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {10, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {10, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10} + }; + + room.AddTextBox("?", 274, 6 * 32 + 6, 100); + room.AddArrow(280, 112, Arrow.DIR_UP, 30, Color.white); + room.AddArrow(280, 272, Arrow.DIR_DOWN, 30, Color.white); + room.AddArrow(200, 192, Arrow.DIR_LEFT, 30, Color.white); + room.AddArrow(360, 192, Arrow.DIR_RIGHT, 30, Color.white); + } + {// Room 15 First Sentry, Lower + Room room = rooms.elementAt(15); + room.RoomArray = new int[][]{ + {8, 0, 0, 0, 8, 8, 8, 8, 8, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 8, 0, 0, 0, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8} + }; + + } + {// Room 16 Rest Stop + Room room = rooms.elementAt(16); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}, + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 8}, + {8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8} + }; + + room.AddTextBox("SKYWAY REST STOP", 184, 2 * 28, 500); + room.AddTextBox("Next Rest Stop 50 Klicks.", 130, 4 * 28, 500); + } + {// Room 17 Timer Sentry Button + Room room = rooms.elementAt(17); + room.RoomArray = new int[][]{ + {3, 3, 0, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + + room.AddTextBox("00", 32, 344, 560); + room.AddTextBox("Deactivate Guard Switch", 140, 246, 560); + room.AddTextBox("Timer", 140, 344, 560); + room.AddArrow(3 * 28, 7 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + room.AddArrow(3 * 28, 10 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + {// Room 18 Hot Wire Room + Room room = rooms.elementAt(18); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 5}, + {5, 22, 22, 22, 22, 22, 22, 22, 23, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 5}, + {5, 5, 5, 5, 0, 0, 0, 0, 24, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 5}, + {5, 5, 0, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5} + }; + + room.AddTextBox("Hot wires burn batteries...", 80, 60, 560); + int[] pace = {2 * 28, 5 * 32, 11 * 28, 5 * 32}; + int[] program = {4 * 28, 0, 12 * 28, 11 * 32, 0, 5 * 32}; + items.addElement(new Sentry(2 * 28, 5 * 32, room, pace, program, true)); + } + {// Room 19 Chamber before Disk Drive + Room room = rooms.elementAt(19); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + + room.AddTextBox("To Robotropolis Disk-O-Tek", 316, 182, 325); + room.AddArrow(18 * 28, 6 * 32 + 8, Arrow.DIR_RIGHT, 2 * 28, Color.white); + } + {// Room 20 Path after Disk Drive + Room room = rooms.elementAt(20); + room.RoomArray = new int[][]{ + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 8, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8} + }; + + } + {// Room 21 Dark Maze + Room room = rooms.elementAt(21); + room.RoomArray = new int[][]{ + {10, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 10, 0, 0, 0, 10, 10, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 10, 0, 0, 0, 10, 10, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 10, 0, 0, 0, 10, 10, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, 0}, + {10, 0, 0, 0, 0, 10, 10, 10, 10, 10, 0, 0, 0, 0, 10, 10, 0, 0, 0, 0}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 10, 10, 0, 0, 0, 0}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10} + }; + + room.AddTextBox("?", 274, 6 * 32 + 6, 100); + room.AddArrow(280, 112, Arrow.DIR_UP, 30, Color.white); + room.AddArrow(280, 272, Arrow.DIR_DOWN, 30, Color.white); + room.AddArrow(200, 192, Arrow.DIR_LEFT, 30, Color.white); + room.AddArrow(360, 192, Arrow.DIR_RIGHT, 30, Color.white); + } + {// Room 22 Dark Maze + Room room = rooms.elementAt(22); + room.RoomArray = new int[][]{ + {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {10, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 10, 0, 0, 0, 10, 10, 10, 10, 10, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, 10, 0, 0, 0, 0}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, 10, 0, 0, 0, 0}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, 10, 0, 0, 0, 0}, + {10, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, 0, 0, 0, 10, 10, 0, 0, 0, 10} + }; + + room.AddTextBox("?", 274, 6 * 32 + 6, 100); + room.AddArrow(280, 112, Arrow.DIR_UP, 30, Color.white); + room.AddArrow(280, 272, Arrow.DIR_DOWN, 30, Color.white); + room.AddArrow(200, 192, Arrow.DIR_LEFT, 30, Color.white); + room.AddArrow(360, 192, Arrow.DIR_RIGHT, 30, Color.white); + } + {// Room 23 Dark Maze + Room room = rooms.elementAt(23); + room.RoomArray = new int[][]{ + {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 10}, + {0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 10}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 10}, + {10, 10, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10, 0, 0, 0, 0, 10}, + {0, 0, 10, 10, 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, 10, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 10}, + {10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 10, 10, 0, 10} + }; + + room.AddTextBox("?", 274, 6 * 32 + 6, 100); + room.AddArrow(280, 112, Arrow.DIR_UP, 30, Color.white); + room.AddArrow(280, 272, Arrow.DIR_DOWN, 30, Color.white); + room.AddArrow(200, 192, Arrow.DIR_LEFT, 30, Color.white); + room.AddArrow(360, 192, Arrow.DIR_RIGHT, 30, Color.white); + } + {// Room 24 Dark Maze + Room room = rooms.elementAt(24); + room.RoomArray = new int[][]{ + {10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10, 10, 10, 10, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 10, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 10, 0, 10, 10, 10, 10, 0, 10, 10, 10, 10, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 10, 0, 10, 0, 0, 0, 0}, + {10, 0, 0, 0, 10, 10, 10, 10, 10, 0, 10, 10, 0, 10, 0, 10, 0, 10, 0, 0}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10}, + {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10}, + {10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 10, 0, 0, 0, 10, 0, 10}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 10, 10, 10, 10, 10, 0, 10}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 10}, + {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10} + }; + + room.AddTextBox("?", 274, 6 * 32 + 6, 100); + room.AddArrow(280, 112, Arrow.DIR_UP, 30, Color.white); + room.AddArrow(280, 272, Arrow.DIR_DOWN, 30, Color.white); + room.AddArrow(200, 192, Arrow.DIR_LEFT, 30, Color.white); + room.AddArrow(360, 192, Arrow.DIR_RIGHT, 30, Color.white); + } + {// Room 25 Grid Puzzle + Room room = rooms.elementAt(25); + room.RoomArray = new int[][]{ + {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, + {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 33, 33, 33, 9, 9}, + {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 33, 33, 33, 9, 9}, + {9, 9, 33, 33, 33, 33, 33, 33, 33, 33, 0, 0, 0, 0, 33, 33, 33, 33, 9, 9}, + {9, 9, 33, 33, 33, 33, 33, 33, 33, 33, 0, 0, 0, 0, 33, 33, 33, 33, 9, 9}, + {9, 9, 33, 33, 33, 33, 0, 0, 0, 0, 0, 0, 0, 0, 33, 33, 33, 33, 9, 9}, + {9, 9, 33, 33, 33, 33, 0, 0, 0, 0, 0, 0, 0, 0, 33, 33, 33, 33, 9, 9}, + {9, 9, 33, 33, 33, 33, 0, 0, 0, 0, 33, 33, 33, 33, 33, 33, 33, 33, 9, 9}, + {9, 9, 33, 33, 33, 33, 0, 0, 0, 0, 33, 33, 33, 33, 33, 33, 33, 33, 9, 9}, + {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, + {9, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 9, 9}, + {9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9} + }; + + items.addElement(new HiddenCamera(room)); + room.AddTextBox("00", 28, 350, 100); + room.AddTextBox("Timer", 4 * 28, 350, 100); + room.AddArrow(3 * 28, 10 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + room.AddTextBox("Blue Grid Switch", 9 * 28, 350, 560); + room.AddArrow(17 * 28, 10 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + room.AddGraphix("blueHorizontal.gif", 2 * 28 + 2, 1 * 32 + 2); + room.AddGraphix("blueHorizontal.gif", 2 * 28 + 2, 3 * 32); + room.AddGraphix("blueHorizontal.gif", 2 * 28 + 2, 5 * 32); + room.AddGraphix("blueHorizontal.gif", 2 * 28 + 2, 7 * 32); + room.AddGraphix("blueHorizontal.gif", 2 * 28 + 2, 9 * 32); + room.AddGraphix("blueVertical.gif", 2 * 28 + 2, 34); + room.AddGraphix("blueVertical.gif", 6 * 28, 34); + room.AddGraphix("blueVertical.gif", 10 * 28, 34); + room.AddGraphix("blueVertical.gif", 14 * 28, 34); + room.AddGraphix("blueVertical.gif", 18 * 28 - 6, 34); + } + {// Room 26 Grid puzzle map + Room room = rooms.elementAt(26); + room.RoomArray = new int[][]{ + {9, 9, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, + {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, + {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, + {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, + {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, + {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, + {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, + {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, + {9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, + {9, 9, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9}, + {9, 9, 34, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 9, 9}, + {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9} + }; + + room.AddArrow(4 * 28 + 22, 2 * 32, Arrow.DIR_RIGHT, 32, Color.white); + room.AddArrow(8 * 28 + 22, 2 * 32, Arrow.DIR_RIGHT, 32, Color.white); + room.AddArrow(12 * 28 + 22, 2 * 32, Arrow.DIR_RIGHT, 32, Color.white); + room.AddTextBox("{BIG} {255,128,000} X", 15 * 28 + 14, 1 * 32, 50); + room.AddTextBox("{BIG} {255,128,000} X", 3 * 28 + 14, 3 * 32, 50); + room.AddTextBox("{BIG} {255,128,000} X", 7 * 28 + 14, 3 * 32, 50); + room.AddArrow(12 * 28, 5 * 32 - 18, Arrow.DIR_DOWN, 32, Color.white); + room.AddTextBox("{BIG} {255,128,000} X", 15 * 28 + 14, 3 * 32, 50); + room.AddTextBox("{BIG} {255,128,000} X", 3 * 28 + 14, 5 * 32, 50); + room.AddArrow(8 * 28 - 18, 6 * 32, Arrow.DIR_LEFT, 32, Color.white); + room.AddArrow(12 * 28 - 18, 6 * 32, Arrow.DIR_LEFT, 32, Color.white); + room.AddTextBox("{BIG} {255,128,000} X", 15 * 28 + 14, 5 * 32, 50); + room.AddTextBox("{BIG} {255,128,000} X", 3 * 28 + 14, 7 * 32, 50); + room.AddArrow(8 * 28, 9 * 32 - 18, Arrow.DIR_DOWN, 32, Color.white); + room.AddTextBox("{BIG} {255,128,000} X", 11 * 28 + 14, 7 * 32, 50); + room.AddTextBox("{BIG} {255,128,000} X", 15 * 28 + 14, 7 * 32, 50); + + room.AddTextBox("Open Door", 380, 338, 560); + room.AddTextBox("View room below", 104, 320, 120); + room.AddArrow(104, 10 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + room.AddGraphix("whiteHorizontal.gif", 2 * 28 + 2, 1 * 32 + 2); + room.AddGraphix("whiteHorizontal.gif", 2 * 28 + 2, 3 * 32); + room.AddGraphix("whiteHorizontal.gif", 2 * 28 + 2, 5 * 32); + room.AddGraphix("whiteHorizontal.gif", 2 * 28 + 2, 7 * 32); + room.AddGraphix("whiteHorizontal.gif", 2 * 28 + 2, 9 * 32); + room.AddGraphix("whiteVertical.gif", 2 * 28 + 2, 34); + room.AddGraphix("whiteVertical.gif", 6 * 28, 34); + room.AddGraphix("whiteVertical.gif", 10 * 28, 34); + room.AddGraphix("whiteVertical.gif", 14 * 28, 34); + room.AddGraphix("whiteVertical.gif", 18 * 28 - 6, 34); + + } + {// Room 27 Final Puzzle + Room room = rooms.elementAt(27); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 2, 38, 0, 0, 39, 2, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 42, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 43, 2, 2}, + {2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2}, + {2, 2, 40, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 41, 2, 2}, + {2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 44, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 45, 2, 2}, + {2, 0, 0, 0, 0, 46, 0, 2, 0, 0, 0, 0, 2, 0, 47, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 2, 0, 2, 48, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + + room.AddTextBox("{BIG} {000,000,255} 3", 28, 94, 560); + room.AddTextBox("STARTER", 412, 52, 560); + room.AddArrow(13 * 28, 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + room.AddTextBox("{BIG} {255,000,255} 2", 504, 158, 560); + room.AddTextBox("{BIG} {000,000,255} 1", 28, 158, 560); + room.AddTextBox("{BIG} {255,000,255} 4", 504, 94, 560); + room.AddTextBox("{BIG} {000,204,000} 5", 28, 318, 560); + room.AddTextBox("{BIG} {255,128,000} 6", 504, 318, 560); + room.AddTextBox("{BIG} {000,204,000} 7", 112, 350, 560); + room.AddTextBox("{BIG} {255,128,000} 8", 420, 350, 560); + room.AddTextBox("TRANSPORTER", 216, 134, 560); + room.AddTextBox("Press buttons in order.", 196, 166, 170); + room.AddTextBox("Press last.", 228, 270, 100); + room.AddArrow(8 * 28 + 14, 10 * 32, Arrow.DIR_DOWN, 32, Color.white); + } + {// Room 28 Disk Drive Entrance + Room room = rooms.elementAt(28); + room.RoomArray = new int[][]{ + {0, 8, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 8, 0, 8, 0, 8, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {0, 8, 0, 8, 0, 8, 0, 8, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14}, + {0, 8, 8, 8, 8, 8, 0, 8, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14}, + {8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {0, 0, 0, 0, 0, 0, 0, 20, 12, 12, 12, 8, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 20, 12, 12, 12, 8, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {0, 8, 8, 8, 0, 0, 0, 8, 12, 12, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18}, + {0, 8, 0, 0, 8, 0, 0, 8, 12, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18}, + {0, 8, 8, 8, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {0, 8, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + }; + + room.AddTextBox("{BIG} {255,255,255} Robart ", 320, 208, 560); + } + {// Room 29 Disk Drive Path + Room room = rooms.elementAt(29); + room.RoomArray = new int[][]{ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 12, 12, 12, 8, 0, 0, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 8, 0, 0, 0}, + {14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 12, 12, 12, 8, 0, 0, 0}, + {14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 12, 12, 12, 8, 0, 0, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0}, + {18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 8, 0, 0, 0}, + {18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 8, 0, 0, 0}, + {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 8, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 12, 12, 12, 8, 0, 0, 0} + }; + + room.AddTextBox("{BIG} {255,255,255} RO400 Disk Drive", 12, 208, 560); + } + {// Room 30 Disk Drive Top Left + Room room = rooms.elementAt(30); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 18, 18}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 18, 18, 18, 18, 18, 18, 18, 18}, + {7, 7, 7, 7, 7, 7, 7, 7, 16, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18}, + {7, 7, 7, 7, 7, 7, 16, 18, 18, 18, 18, 18, 18, 18, 18, 18, 17, 17, 18, 18}, + {7, 7, 7, 7, 7, 16, 18, 18, 18, 18, 18, 18, 18, 18, 18, 17, 17, 17, 18, 18}, + {7, 7, 7, 7, 16, 18, 18, 18, 18, 18, 18, 18, 18, 16, 17, 17, 17, 17, 18, 18}, + {7, 7, 7, 16, 18, 18, 18, 18, 18, 18, 18, 18, 17, 17, 17, 17, 17, 17, 18, 18}, + {7, 7, 7, 16, 18, 18, 18, 18, 18, 18, 18, 17, 16, 17, 17, 17, 17, 18, 18, 18}, + {18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 17, 16, 16, 16, 16, 17, 16, 18, 18, 7}, + {18, 18, 18, 18, 18, 18, 18, 7, 7, 0, 16, 16, 16, 16, 16, 16, 18, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 16, 16, 16, 16, 16, 16, 7, 7, 7, 7} + }; + + room.AddTextBox("On a clear disk you can seek forever...", 200, 188, 300); + } + {// Room 31 Disk Drive Top Right + Room room = rooms.elementAt(31); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {18, 18, 18, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {18, 18, 18, 18, 18, 18, 18, 18, 18, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 7, 7, 7, 7, 7, 7, 7, 7}, + {18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 7, 7, 7, 7, 7, 7}, + {18, 18, 18, 18, 18, 18, 18, 19, 18, 18, 12, 12, 12, 12, 18, 7, 7, 7, 7, 7}, + {18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 12, 12, 12, 12, 12, 18, 7, 7, 7, 7}, + {18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 12, 12, 12, 12, 12, 18, 7, 7, 7}, + {18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 12, 12, 12, 12, 12, 7, 7, 7}, + {7, 12, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 12, 12, 12, 12, 18, 7, 7}, + {7, 7, 7, 19, 12, 12, 12, 12, 19, 19, 19, 19, 19, 19, 12, 12, 12, 12, 18, 7}, + {7, 7, 7, 7, 12, 12, 12, 12, 19, 19, 19, 19, 19, 19, 19, 12, 12, 12, 12, 7} + }; + + } + {// Room 32 Disk Drive Bottom Right + Room room = rooms.elementAt(32); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 12, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 7}, + {7, 7, 7, 14, 13, 13, 13, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 7}, + {7, 14, 14, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 7, 7}, + {14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 13, 13, 13, 12, 12, 7, 7, 7}, + {14, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 13, 13, 12, 12, 7, 7, 7}, + {14, 14, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 12, 12, 7, 7, 7, 7}, + {14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 12, 12, 7, 7, 7, 7, 7}, + {14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 12, 12, 12, 7, 7, 7, 7, 7, 7}, + {14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 12, 7, 7, 7, 7, 7, 7, 7, 7}, + {14, 14, 14, 14, 14, 14, 14, 14, 12, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {14, 14, 12, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + + } + {// Room 33 Disk Drive Bottom Left + Room room = rooms.elementAt(33); + room.RoomArray = new int[][]{ + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 16, 16, 16, 16, 16, 16, 7, 7, 7, 7}, + {14, 14, 14, 15, 15, 15, 16, 7, 7, 16, 16, 16, 16, 16, 16, 16, 0, 7, 7, 7}, + {14, 14, 14, 14, 15, 15, 14, 14, 14, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 7}, + {7, 7, 7, 14, 14, 15, 15, 14, 14, 14, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14}, + {7, 7, 7, 14, 14, 14, 15, 15, 15, 15, 14, 15, 15, 15, 14, 14, 14, 14, 14, 14}, + {7, 7, 7, 7, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 14, 14, 14, 14, 14, 14}, + {7, 7, 7, 7, 7, 14, 14, 14, 14, 14, 14, 14, 15, 15, 14, 14, 14, 14, 14, 14}, + {7, 7, 7, 7, 7, 7, 14, 14, 14, 14, 14, 14, 14, 15, 14, 14, 14, 14, 14, 14}, + {7, 7, 7, 7, 7, 7, 7, 7, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 14, 14, 14, 14, 14, 14, 14, 14, 14}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 14, 14, 14}, + {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7} + }; + + room.AddTextBox("Welcome to", 284, 222, 250); + room.AddTextBox("The Robotropolis", 248, 242, 250); + room.AddTextBox("Disk-O-Tek", 316, 262, 250); + items.addElement(new BinaryKey(9 * 28, 1 * 32, room)); + String[] disco1 = {"disco0.gif", "disco1.gif"}; + String[] disco2 = {"disco2.gif", "disco3.gif"}; + String[] disco3 = {"disco4.gif", "disco5.gif"}; + room.AddGraphix(disco1, 9 * 28, 8 * 32); + room.AddGraphix(disco2, 12 * 28, 7 * 32); + room.AddGraphix(disco3, 16 * 28, 9 * 32); + } + {// Room 34 Disk Drive Path + Room room = rooms.elementAt(34); + room.RoomArray = new int[][]{ + {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 12, 12, 12, 9, 9, 9, 9}, + {9, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 12, 12, 12, 9, 0, 0, 0}, + {9, 12, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 12, 12, 9, 0, 0, 0}, + {9, 12, 12, 12, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0}, + {9, 12, 12, 12, 9, 0, 0, 9, 9, 9, 0, 0, 0, 9, 9, 9, 0, 0, 0, 0}, + {9, 12, 12, 12, 9, 0, 0, 9, 0, 0, 9, 0, 0, 9, 0, 0, 9, 0, 0, 0}, + {9, 12, 12, 12, 9, 0, 0, 9, 9, 9, 0, 0, 0, 9, 0, 0, 9, 0, 0, 0}, + {9, 12, 12, 12, 9, 0, 0, 9, 0, 0, 9, 0, 0, 9, 9, 9, 0, 0, 0, 0}, + {9, 12, 12, 12, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, + {9, 12, 12, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18}, + {9, 12, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18}, + {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9} + }; + + } + {// Room 35 Disk Drive Path + Room room = rooms.elementAt(35); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14}, + {3, 12, 12, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14}, + {3, 12, 12, 12, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 12, 12, 12, 3, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 3, 0, 0, 0}, + {3, 12, 12, 12, 3, 0, 0, 3, 0, 3, 0, 3, 0, 0, 3, 0, 0, 3, 0, 0}, + {3, 12, 12, 12, 3, 0, 0, 3, 0, 3, 0, 3, 0, 0, 3, 3, 3, 3, 0, 0}, + {3, 12, 12, 12, 3, 0, 0, 3, 3, 3, 3, 3, 0, 0, 3, 0, 0, 3, 0, 0}, + {3, 12, 12, 12, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0}, + {3, 12, 12, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 3, 0, 0, 0}, + {3, 12, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 12, 12, 3, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 12, 12, 12, 3, 3, 3, 3} + }; + + } + {// Room 36 Chamber after Grid Puzzle + Room room = rooms.elementAt(36); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2} + }; + + } + + {// Room 37 Secret Room + Room room = rooms.elementAt(37); + room.SetMaterialOutline(0, 0, 19, 11, 2); + room.SetMaterial(16, 0, 0); + room.AddTextBox("All right! You've found the fifth secret.", 2 * 28, 4 * 32, 500); + room.AddTextBox("To find the Secret 6th Level, look for a hidden path to the right when you're declared a Robot Master.", + 2 * 28, 6 * 32, 500); + String[] helperlist = { + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper1.gif", "helper4.gif", "helper2.gif", "helper3.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper5.gif", "helper5.gif", "helper5.gif", "helper5.gif", + }; + Graphix helper = new Graphix(helperlist, 15 * 28, 8 * 32); + room.graphix.addElement(helper); + items.addElement(new Key(16 * 28, 3 * 32, room, new Color(255, 0, 255))); + } + + int[] skyways = {8, 7, 6, 5, 4, 3, 1}; + LinkRoomsVertically(skyways); + + int[] roomlist1 = {1, 2, 3, 10, 4, 19, 28, 29}; + LinkRoomsHorizontally(roomlist1); + LinkRoomsUpDown(10, 15); + LinkRoomsUpDown(1, 37); + + LinkRoomsUpDown(19, 12); + int[] roomlist2 = {12, 20, 5, 11, 6, 13, 18}; + LinkRoomsHorizontally(roomlist2); + + int[][] roomgrid1 = { + {34, 30, 31}, + {35, 33, 32}}; + LinkRoomsGrid(roomgrid1); + LinkRoomsUpDown(35, 29); + LinkRoomsUpDown(29, 34); + + LinkRoomsUpDown(18, 17); + + int[] roomlist3 = {22, 23, 8, 16, 17, 7, 14}; + LinkRoomsHorizontally(roomlist3); + + LinkRoomsLeftRight(21, 24); + LinkRoomsUpDown(22, 21); + LinkRoomsUpDown(21, 14); + LinkRoomsUpDown(23, 24); + + rooms.elementAt(24).rightRoom = rooms.elementAt(14); // 1-way connection + + int[] roomlist4 = {13, 16, 9, 26, 25, 36, 27}; + LinkRoomsVertically(roomlist4); + + gameCursor = new GameCursor(6 * 28, 8 * 32, rooms.elementAt(1)); + helpCam = new HelpCam(rooms.elementAt(0)); + solderingPen = new SolderingPen(); + remote = new Remote(); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + player = gameCursor; + currentViewer = player; + + } } diff --git a/src/com/droidquest/levels/RO6.java b/src/com/droidquest/levels/RO6.java index a1dc7be..a10c45d 100644 --- a/src/com/droidquest/levels/RO6.java +++ b/src/com/droidquest/levels/RO6.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.avatars.GameCursor; @@ -11,751 +9,732 @@ import com.droidquest.avatars.SolderingPen; import com.droidquest.decorations.Arrow; import com.droidquest.decorations.Graphix; import com.droidquest.devices.DirectionalSensor; -import com.droidquest.items.Ghost; -import com.droidquest.items.Pellet; -import com.droidquest.items.Sentry; -import com.droidquest.items.Turbine; -import com.droidquest.items.WallHandle; -import com.droidquest.items.Wave; -import com.droidquest.materials.CrystalRecharger; -import com.droidquest.materials.HotWires; -import com.droidquest.materials.Lock; -import com.droidquest.materials.Material; -import com.droidquest.materials.PlayerBlocker; -import com.droidquest.materials.Portal; -import com.droidquest.materials.Switch; +import com.droidquest.items.*; +import com.droidquest.materials.*; -class RO6 extends Level -{ -public RO6 (RoomDisplay rd) - { - super(rd); - - materials.addElement(new Material(true, false)); // 0 = Empty Space - materials.addElement(new Material(Color.blue, false, true)); // 1 = Blue - materials.addElement(new Material(Color.white, false, true)); // 2 = White - materials.addElement(new Material(Color.red, false, true)); // 3 = Red - materials.addElement(new Material(new Color(255,128,0), false, true)); // 4 = Orange - materials.addElement(new Material(Color.yellow, false, true)); // 5 = Yellow - materials.addElement(new Material(Color.green, false, true)); // 6 = Green - materials.addElement(new Material(new Color(255,0,255), false, true)); // 7 = Purple - - materials.addElement(new HotWires( HotWires.UP - + HotWires.DOWN - + HotWires.LEFT - + HotWires.RIGHT, - true)); // 8=HotWire cross - materials.addElement(new HotWires( HotWires.UP - + HotWires.DOWN, - true)); // 9=HotWire Vertical - materials.addElement(new HotWires( HotWires.LEFT - + HotWires.RIGHT, - true)); // 10=HotWire Horizontal - materials.addElement(new HotWires( HotWires.UP - + HotWires.LEFT, - true)); // 11=HotWire J - materials.addElement(new HotWires( HotWires.UP - + HotWires.RIGHT, - true)); // 12=HotWire L - materials.addElement(new HotWires(+ HotWires.DOWN - + HotWires.LEFT, - true)); // 13=HotWire 7 - materials.addElement(new HotWires(+ HotWires.DOWN - + HotWires.RIGHT, - true)); // 14=HotWire r - materials.addElement(new HotWires( HotWires.DOWN - + HotWires.LEFT - + HotWires.RIGHT, - true)); // 15=HotWire T - materials.addElement(new HotWires( HotWires.UP - + HotWires.LEFT - + HotWires.RIGHT, - true)); // 16=HotWire _|_ - materials.addElement(new HotWires( HotWires.UP - + HotWires.DOWN - + HotWires.RIGHT, - true)); // 17=HotWire |- - materials.addElement(new HotWires( HotWires.UP - + HotWires.DOWN - + HotWires.LEFT, - true)); // 18=HotWire -| - - int[][] redlock = { - {Lock.WIDE}, - {Lock.LEFT}, - {Lock.DOWN}, - {Lock.DOWN}, - {Lock.RIGHT}, - {1,5,0, 1,6,0, 1,2,3, 1,9,3}, - {1,4,0, 1,7,0, 1,1,3, 1,10,3, 2,5,0, 2,6,0, 2,2,3, 2,9,3}, - {2,4,0, 2,7,0, 2,1,3, 2,10,3, 3,5,0, 3,6,0, 3,2,3, 3,9,3}, - {3,4,0, 3,7,0, 3,1,3, 3,10,3}, - {Lock.REMOVE}, - {Lock.LEFT}, - {Lock.DOWN}, - {Lock.DOWN}, - {Lock.RIGHT}, - {3,4,3, 3,7,3, 3,1,0, 3,10,0}, - {2,4,3, 2,7,3, 2,1,0, 2,10,0, 3,5,3, 3,6,3, 3,2,0, 3,9,0}, - {1,4,3, 1,7,3, 1,1,0, 1,10,0, 2,5,3, 2,6,3, 2,2,0, 2,9,0}, - {1,5,3, 1,6,3, 1,2,0, 1,9,0} - }; - materials.addElement(new Lock(Color.red, Color.red, redlock)); // 19=RedLock - - int[][] orangelock = { - {Lock.WIDE}, - {Lock.RIGHT}, - {Lock.DOWN}, - {Lock.RIGHT}, - {4,5,0, 4,6,0, 4,2,4, 4,9,4}, - {4,4,0, 4,7,0, 4,1,4, 4,10,4, 5,5,0, 5,6,0, 5,2,4, 5,9,4}, - {5,4,0, 5,7,0, 5,1,4, 5,10,4, 6,5,0, 6,6,0, 6,2,4, 6,9,4}, - {6,4,0, 6,7,0, 6,1,4, 6,10,4}, - {Lock.REMOVE}, - {Lock.RIGHT}, - {Lock.DOWN}, - {Lock.RIGHT}, - {6,4,4, 6,7,4, 6,1,0, 6,10,0}, - {5,4,4, 5,7,4, 5,1,0, 5,10,0, 6,5,4, 6,6,4, 6,2,0, 6,9,0}, - {4,4,4, 4,7,4, 4,1,0, 4,10,0, 5,5,4, 5,6,4, 5,2,0, 5,9,0}, - {4,5,4, 4,6,4, 4,2,0, 4,9,0} - }; - materials.addElement(new Lock(new Color(255,128,0), - new Color(255,128,0), orangelock)); // 20=OrangeLock +import java.awt.*; - int[][] yellowlock = { - {Lock.WIDE}, - {Lock.LEFT}, - {Lock.DOWN}, - {Lock.RIGHT}, - {7,5,0, 7,6,0, 7,2,5, 7,9,5}, - {7,4,0, 7,7,0, 7,1,5, 7,10,5, 8,5,0, 8,6,0, 8,2,5, 8,9,5}, - {8,4,0, 8,7,0, 8,1,5, 8,10,5, 9,5,0, 9,6,0, 9,2,5, 9,9,5}, - {9,4,0, 9,7,0, 9,1,5, 9,10,5}, - {Lock.REMOVE}, - {Lock.LEFT}, - {Lock.DOWN}, - {Lock.RIGHT}, - {9,4,5, 9,7,5, 9,1,0, 9,10,0}, - {8,4,5, 8,7,5, 8,1,0, 8,10,0, 9,5,5, 9,6,5, 9,2,0, 9,9,0}, - {7,4,5, 7,7,5, 7,1,0, 7,10,0, 8,5,5, 8,6,5, 8,2,0, 8,9,0}, - {7,5,5, 7,6,5, 7,2,0, 7,9,0} - }; - materials.addElement(new Lock(Color.yellow, - Color.yellow, yellowlock)); // 21=YellowLock - - int[][] greenlock = { - {Lock.WIDE}, - {Lock.RIGHT}, - {Lock.UP}, - {Lock.RIGHT}, - {10,5,0, 10,6,0, 10,2,6, 10,9,6}, - {10,4,0, 10,7,0, 10,1,6, 10,10,6, 11,5,0, 11,6,0, 11,2,6, 11,9,6}, - {11,4,0, 11,7,0, 11,1,6, 11,10,6, 12,5,0, 12,6,0, 12,2,6, 12,9,6}, - {12,4,0, 12,7,0, 12,1,6, 12,10,6}, - {Lock.REMOVE}, - {Lock.RIGHT}, - {Lock.UP}, - {Lock.RIGHT}, - {12,4,6, 12,7,6, 12,1,0, 12,10,0}, - {11,4,6, 11,7,6, 11,1,0, 11,10,0, 12,5,6, 12,6,6, 12,2,0, 12,9,0}, - {10,4,6, 10,7,6, 10,1,0, 10,10,0, 11,5,6, 11,6,6, 11,2,0, 11,9,0}, - {10,5,6, 10,6,6, 10,2,0, 10,9,0} - }; - materials.addElement(new Lock(Color.green, - Color.green, greenlock)); // 22=GreenLock - - int[][] bluelock = { - {Lock.WIDE}, - {Lock.LEFT}, - {Lock.UP}, - {Lock.RIGHT}, - {13,5,0, 13,6,0, 13,2,1, 13,9,1}, - {13,4,0, 13,7,0, 13,1,1, 13,10,1, 14,5,0, 14,6,0, 14,2,1, 14,9,1}, - {14,4,0, 14,7,0, 14,1,1, 14,10,1, 15,5,0, 15,6,0, 15,2,1, 15,9,1}, - {15,4,0, 15,7,0, 15,1,1, 15,10,1}, - {Lock.REMOVE}, - {Lock.LEFT}, - {Lock.UP}, - {Lock.RIGHT}, - {15,4,1, 15,7,1, 15,1,0, 15,10,0}, - {14,4,1, 14,7,1, 14,1,0, 14,10,0, 15,5,1, 15,6,1, 15,2,0, 15,9,0}, - {13,4,1, 13,7,1, 13,1,0, 13,10,0, 14,5,1, 14,6,1, 14,2,0, 14,9,0}, - {13,5,1, 13,6,1, 13,2,0, 13,9,0} - }; - materials.addElement(new Lock(Color.blue, - Color.blue, bluelock)); // 23=BlueLock - - int[][] purplelock = { - {Lock.WIDE}, - {Lock.LEFT}, // Positioning is not set right yet. - {Lock.UP}, - {Lock.UP}, - {Lock.RIGHT}, - {16,5,0, 16,6,0, 16,2,7, 16,9,7}, - {16,4,0, 16,7,0, 16,1,7, 16,10,7, 17,5,0, 17,6,0, 17,2,7, 17,9,7}, - {17,4,0, 17,7,0, 17,1,7, 17,10,7, 18,5,0, 18,6,0, 18,2,7, 18,9,7}, - {18,4,0, 18,7,0, 18,1,7, 18,10,7}, - {Lock.REMOVE}, - {Lock.LEFT}, - {Lock.UP}, - {Lock.UP}, - {Lock.RIGHT}, - {18,4,7, 18,7,7, 18,1,0, 18,10,0}, - {17,4,7, 17,7,7, 17,1,0, 17,10,0, 18,5,7, 18,6,7, 18,2,0, 18,9,0}, - {16,4,7, 16,7,7, 16,1,0, 16,10,0, 17,5,7, 17,6,7, 17,2,0, 17,9,0}, - {16,5,7, 16,6,7, 16,2,0, 16,9,0} - }; - materials.addElement(new Lock(new Color(255,0,255), - new Color(255,0,255), purplelock)); // 24=PurpleLock +class RO6 extends Level { + public RO6(RoomDisplay rd) { + super(rd); - String[] files = {"field0.jpg","field1.jpg"}; - materials.addElement(new PlayerBlocker(files)); // 25= Blue FF + materials.addElement(new Material(true, false)); // 0 = Empty Space + materials.addElement(new Material(Color.blue, false, true)); // 1 = Blue + materials.addElement(new Material(Color.white, false, true)); // 2 = White + materials.addElement(new Material(Color.red, false, true)); // 3 = Red + materials.addElement(new Material(new Color(255, 128, 0), false, true)); // 4 = Orange + materials.addElement(new Material(Color.yellow, false, true)); // 5 = Yellow + materials.addElement(new Material(Color.green, false, true)); // 6 = Green + materials.addElement(new Material(new Color(255, 0, 255), false, true)); // 7 = Purple - int flipswitch[][] = { - {Switch.WAIT4CONTACT}, - {Switch.SETVALUEHIGH}, - {Switch.REPLACE, 7,1,0, 8,1,0, 7,2,0, 8,2,0, 5,3,1, 6,3,1, 5,4,1, 6,4,1}, - {Switch.REPLACE, 11,1,0, 12,1,0, 11,2,0, 12,2,0, 9,3,1, 10,3,1, 9,4,1, 10,4,1}, - {Switch.REPLACE, 15,5,0, 16,5,0, 15,6,0, 16,6,0, 13,3,1, 14,3,1, 13,4,1, 14,4,1}, - {Switch.REPLACE, 3,9,0, 4,9,0, 3,10,0, 4,10,0, 1,7,1, 2,7,1, 1,8,1, 2,8,1}, - {Switch.REPLACE, 7,9,0, 8,9,0, 7,10,0, 8,10,0, 9,7,1, 10,7,1, 9,8,1, 10,8,1}, - {Switch.REPLACE, 11,5,0, 12,5,0, 11,6,0, 12,6,0, 13,7,1, 14,7,1, 13,8,1, 14,8,1}, - {Switch.REPLACE, 15,9,0, 16,9,0, 15,10,0, 16,10,0, 17,7,1, 18,7,1, 17,8,1, 18,8,1}, - {Switch.REPLACE, 18,10,0} - }; - materials.addElement(new Switch(Switch.ROT_DOWN, flipswitch)); // 26= FlipSwitch - - materials.addElement(new CrystalRecharger()); // 27 = Recharger - materials.addElement(new Portal("ROEndGame2.lvl", true, true)); // 28= Portal - - for (int a=0; a<=22; a++) - rooms.addElement(new Room()); - - {// Room 0 Help - Room room = (Room) rooms.elementAt(0); - room.AddTextBox("You're on your own here!", - 136,6*32, 560); - room.AddTextBox("(To continue, press RETURN.)", - 96,346, 500); - } - {// Room 1 Maze - Room room = (Room) rooms.elementAt(1); - int[][] table1 = { - {1,1,1,1,1,1,0,1,0,0,0,0,1,0,1,1,1,1,1,1}, - {1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1,1}, - {0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0}, - {1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1}, - {0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0}, - {1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1,1}, - {1,1,1,1,1,1,0,1,0,0,0,0,1,0,1,1,1,1,1,1} - }; - room.RoomArray = table1; - - } - {// Room 1 Maze - Room room = (Room) rooms.elementAt(1); - int[][] table1 = { - {1,1,1,1,1,1,0,1,0,0,0,0,1,0,1,1,1,1,1,1}, - {1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1,1}, - {0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0}, - {1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1}, - {0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0}, - {1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1,1}, - {1,1,1,1,1,1,0,1,0,0,0,0,1,0,1,1,1,1,1,1} - }; - room.RoomArray = table1; - - } - {// Room 2 Maze - Room room = (Room) rooms.elementAt(2); - room.SetMaterialFromRoom(1); - } - {// Room 3 Maze - Room room = (Room) rooms.elementAt(3); - room.SetMaterialFromRoom(1); - } - {// Room 4 Maze - Room room = (Room) rooms.elementAt(4); - room.SetMaterialFromRoom(1); - } - {// Room 5 Maze - Room room = (Room) rooms.elementAt(5); - room.SetMaterialFromRoom(1); - } - {// Room 6 Maze exit - Room room = (Room) rooms.elementAt(6); - int[][] table = { - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - - room.AddTextBox("Welcome to the Super Secret 6th level!",52,64, 560); - room.AddTextBox("{255,000,000} Cross {255,128,000} the {255,255,000} rainbow {000,255,000} bridge {000,000,255} to {255,000,255} freedom!", - 64,9*32, 560); + materials.addElement(new HotWires(HotWires.UP + + HotWires.DOWN + + HotWires.LEFT + + HotWires.RIGHT, + true + )); // 8=HotWire cross + materials.addElement(new HotWires(HotWires.UP + + HotWires.DOWN, + true + )); // 9=HotWire Vertical + materials.addElement(new HotWires(HotWires.LEFT + + HotWires.RIGHT, + true + )); // 10=HotWire Horizontal + materials.addElement(new HotWires(HotWires.UP + + HotWires.LEFT, + true + )); // 11=HotWire J + materials.addElement(new HotWires(HotWires.UP + + HotWires.RIGHT, + true + )); // 12=HotWire L + materials.addElement(new HotWires(+HotWires.DOWN + + HotWires.LEFT, + true + )); // 13=HotWire 7 + materials.addElement(new HotWires(+HotWires.DOWN + + HotWires.RIGHT, + true + )); // 14=HotWire r + materials.addElement(new HotWires(HotWires.DOWN + + HotWires.LEFT + + HotWires.RIGHT, + true + )); // 15=HotWire T + materials.addElement(new HotWires(HotWires.UP + + HotWires.LEFT + + HotWires.RIGHT, + true + )); // 16=HotWire _|_ + materials.addElement(new HotWires(HotWires.UP + + HotWires.DOWN + + HotWires.RIGHT, + true + )); // 17=HotWire |- + materials.addElement(new HotWires(HotWires.UP + + HotWires.DOWN + + HotWires.LEFT, + true + )); // 18=HotWire -| + + int[][] redlock = { + {Lock.WIDE}, + {Lock.LEFT}, + {Lock.DOWN}, + {Lock.DOWN}, + {Lock.RIGHT}, + {1, 5, 0, 1, 6, 0, 1, 2, 3, 1, 9, 3}, + {1, 4, 0, 1, 7, 0, 1, 1, 3, 1, 10, 3, 2, 5, 0, 2, 6, 0, 2, 2, 3, 2, 9, 3}, + {2, 4, 0, 2, 7, 0, 2, 1, 3, 2, 10, 3, 3, 5, 0, 3, 6, 0, 3, 2, 3, 3, 9, 3}, + {3, 4, 0, 3, 7, 0, 3, 1, 3, 3, 10, 3}, + {Lock.REMOVE}, + {Lock.LEFT}, + {Lock.DOWN}, + {Lock.DOWN}, + {Lock.RIGHT}, + {3, 4, 3, 3, 7, 3, 3, 1, 0, 3, 10, 0}, + {2, 4, 3, 2, 7, 3, 2, 1, 0, 2, 10, 0, 3, 5, 3, 3, 6, 3, 3, 2, 0, 3, 9, 0}, + {1, 4, 3, 1, 7, 3, 1, 1, 0, 1, 10, 0, 2, 5, 3, 2, 6, 3, 2, 2, 0, 2, 9, 0}, + {1, 5, 3, 1, 6, 3, 1, 2, 0, 1, 9, 0} + }; + materials.addElement(new Lock(Color.red, Color.red, redlock)); // 19=RedLock + + int[][] orangelock = { + {Lock.WIDE}, + {Lock.RIGHT}, + {Lock.DOWN}, + {Lock.RIGHT}, + {4, 5, 0, 4, 6, 0, 4, 2, 4, 4, 9, 4}, + {4, 4, 0, 4, 7, 0, 4, 1, 4, 4, 10, 4, 5, 5, 0, 5, 6, 0, 5, 2, 4, 5, 9, 4}, + {5, 4, 0, 5, 7, 0, 5, 1, 4, 5, 10, 4, 6, 5, 0, 6, 6, 0, 6, 2, 4, 6, 9, 4}, + {6, 4, 0, 6, 7, 0, 6, 1, 4, 6, 10, 4}, + {Lock.REMOVE}, + {Lock.RIGHT}, + {Lock.DOWN}, + {Lock.RIGHT}, + {6, 4, 4, 6, 7, 4, 6, 1, 0, 6, 10, 0}, + {5, 4, 4, 5, 7, 4, 5, 1, 0, 5, 10, 0, 6, 5, 4, 6, 6, 4, 6, 2, 0, 6, 9, 0}, + {4, 4, 4, 4, 7, 4, 4, 1, 0, 4, 10, 0, 5, 5, 4, 5, 6, 4, 5, 2, 0, 5, 9, 0}, + {4, 5, 4, 4, 6, 4, 4, 2, 0, 4, 9, 0} + }; + materials.addElement(new Lock(new Color(255, 128, 0), + new Color(255, 128, 0), orangelock)); // 20=OrangeLock + + int[][] yellowlock = { + {Lock.WIDE}, + {Lock.LEFT}, + {Lock.DOWN}, + {Lock.RIGHT}, + {7, 5, 0, 7, 6, 0, 7, 2, 5, 7, 9, 5}, + {7, 4, 0, 7, 7, 0, 7, 1, 5, 7, 10, 5, 8, 5, 0, 8, 6, 0, 8, 2, 5, 8, 9, 5}, + {8, 4, 0, 8, 7, 0, 8, 1, 5, 8, 10, 5, 9, 5, 0, 9, 6, 0, 9, 2, 5, 9, 9, 5}, + {9, 4, 0, 9, 7, 0, 9, 1, 5, 9, 10, 5}, + {Lock.REMOVE}, + {Lock.LEFT}, + {Lock.DOWN}, + {Lock.RIGHT}, + {9, 4, 5, 9, 7, 5, 9, 1, 0, 9, 10, 0}, + {8, 4, 5, 8, 7, 5, 8, 1, 0, 8, 10, 0, 9, 5, 5, 9, 6, 5, 9, 2, 0, 9, 9, 0}, + {7, 4, 5, 7, 7, 5, 7, 1, 0, 7, 10, 0, 8, 5, 5, 8, 6, 5, 8, 2, 0, 8, 9, 0}, + {7, 5, 5, 7, 6, 5, 7, 2, 0, 7, 9, 0} + }; + materials.addElement(new Lock(Color.yellow, + Color.yellow, yellowlock)); // 21=YellowLock + + int[][] greenlock = { + {Lock.WIDE}, + {Lock.RIGHT}, + {Lock.UP}, + {Lock.RIGHT}, + {10, 5, 0, 10, 6, 0, 10, 2, 6, 10, 9, 6}, + {10, 4, 0, 10, 7, 0, 10, 1, 6, 10, 10, 6, 11, 5, 0, 11, 6, 0, 11, 2, 6, 11, 9, 6}, + {11, 4, 0, 11, 7, 0, 11, 1, 6, 11, 10, 6, 12, 5, 0, 12, 6, 0, 12, 2, 6, 12, 9, 6}, + {12, 4, 0, 12, 7, 0, 12, 1, 6, 12, 10, 6}, + {Lock.REMOVE}, + {Lock.RIGHT}, + {Lock.UP}, + {Lock.RIGHT}, + {12, 4, 6, 12, 7, 6, 12, 1, 0, 12, 10, 0}, + {11, 4, 6, 11, 7, 6, 11, 1, 0, 11, 10, 0, 12, 5, 6, 12, 6, 6, 12, 2, 0, 12, 9, 0}, + {10, 4, 6, 10, 7, 6, 10, 1, 0, 10, 10, 0, 11, 5, 6, 11, 6, 6, 11, 2, 0, 11, 9, 0}, + {10, 5, 6, 10, 6, 6, 10, 2, 0, 10, 9, 0} + }; + materials.addElement(new Lock(Color.green, + Color.green, greenlock)); // 22=GreenLock + + int[][] bluelock = { + {Lock.WIDE}, + {Lock.LEFT}, + {Lock.UP}, + {Lock.RIGHT}, + {13, 5, 0, 13, 6, 0, 13, 2, 1, 13, 9, 1}, + {13, 4, 0, 13, 7, 0, 13, 1, 1, 13, 10, 1, 14, 5, 0, 14, 6, 0, 14, 2, 1, 14, 9, 1}, + {14, 4, 0, 14, 7, 0, 14, 1, 1, 14, 10, 1, 15, 5, 0, 15, 6, 0, 15, 2, 1, 15, 9, 1}, + {15, 4, 0, 15, 7, 0, 15, 1, 1, 15, 10, 1}, + {Lock.REMOVE}, + {Lock.LEFT}, + {Lock.UP}, + {Lock.RIGHT}, + {15, 4, 1, 15, 7, 1, 15, 1, 0, 15, 10, 0}, + {14, 4, 1, 14, 7, 1, 14, 1, 0, 14, 10, 0, 15, 5, 1, 15, 6, 1, 15, 2, 0, 15, 9, 0}, + {13, 4, 1, 13, 7, 1, 13, 1, 0, 13, 10, 0, 14, 5, 1, 14, 6, 1, 14, 2, 0, 14, 9, 0}, + {13, 5, 1, 13, 6, 1, 13, 2, 0, 13, 9, 0} + }; + materials.addElement(new Lock(Color.blue, + Color.blue, bluelock)); // 23=BlueLock + + int[][] purplelock = { + {Lock.WIDE}, + {Lock.LEFT}, // Positioning is not set right yet. + {Lock.UP}, + {Lock.UP}, + {Lock.RIGHT}, + {16, 5, 0, 16, 6, 0, 16, 2, 7, 16, 9, 7}, + {16, 4, 0, 16, 7, 0, 16, 1, 7, 16, 10, 7, 17, 5, 0, 17, 6, 0, 17, 2, 7, 17, 9, 7}, + {17, 4, 0, 17, 7, 0, 17, 1, 7, 17, 10, 7, 18, 5, 0, 18, 6, 0, 18, 2, 7, 18, 9, 7}, + {18, 4, 0, 18, 7, 0, 18, 1, 7, 18, 10, 7}, + {Lock.REMOVE}, + {Lock.LEFT}, + {Lock.UP}, + {Lock.UP}, + {Lock.RIGHT}, + {18, 4, 7, 18, 7, 7, 18, 1, 0, 18, 10, 0}, + {17, 4, 7, 17, 7, 7, 17, 1, 0, 17, 10, 0, 18, 5, 7, 18, 6, 7, 18, 2, 0, 18, 9, 0}, + {16, 4, 7, 16, 7, 7, 16, 1, 0, 16, 10, 0, 17, 5, 7, 17, 6, 7, 17, 2, 0, 17, 9, 0}, + {16, 5, 7, 16, 6, 7, 16, 2, 0, 16, 9, 0} + }; + materials.addElement(new Lock(new Color(255, 0, 255), + new Color(255, 0, 255), purplelock)); // 24=PurpleLock + + String[] files = {"field0.jpg", "field1.jpg"}; + materials.addElement(new PlayerBlocker(files)); // 25= Blue FF + + int flipswitch[][] = { + {Switch.WAIT4CONTACT}, + {Switch.SETVALUEHIGH}, + {Switch.REPLACE, 7, 1, 0, 8, 1, 0, 7, 2, 0, 8, 2, 0, 5, 3, 1, 6, 3, 1, 5, 4, 1, 6, 4, 1}, + {Switch.REPLACE, 11, 1, 0, 12, 1, 0, 11, 2, 0, 12, 2, 0, 9, 3, 1, 10, 3, 1, 9, 4, 1, 10, 4, 1}, + {Switch.REPLACE, 15, 5, 0, 16, 5, 0, 15, 6, 0, 16, 6, 0, 13, 3, 1, 14, 3, 1, 13, 4, 1, 14, 4, 1}, + {Switch.REPLACE, 3, 9, 0, 4, 9, 0, 3, 10, 0, 4, 10, 0, 1, 7, 1, 2, 7, 1, 1, 8, 1, 2, 8, 1}, + {Switch.REPLACE, 7, 9, 0, 8, 9, 0, 7, 10, 0, 8, 10, 0, 9, 7, 1, 10, 7, 1, 9, 8, 1, 10, 8, 1}, + {Switch.REPLACE, 11, 5, 0, 12, 5, 0, 11, 6, 0, 12, 6, 0, 13, 7, 1, 14, 7, 1, 13, 8, 1, 14, 8, 1}, + {Switch.REPLACE, 15, 9, 0, 16, 9, 0, 15, 10, 0, 16, 10, 0, 17, 7, 1, 18, 7, 1, 17, 8, 1, 18, 8, 1}, + {Switch.REPLACE, 18, 10, 0} + }; + materials.addElement(new Switch(Switch.ROT_DOWN, flipswitch)); // 26= FlipSwitch + + materials.addElement(new CrystalRecharger()); // 27 = Recharger + materials.addElement(new Portal("ROEndGame2.lvl", true, true)); // 28= Portal + + for (int a = 0; a <= 22; a++) { + rooms.addElement(new Room()); + } + + {// Room 0 Help + Room room = rooms.elementAt(0); + room.AddTextBox("You're on your own here!", + 136, 6 * 32, 560); + room.AddTextBox("(To continue, press RETURN.)", + 96, 346, 500); + } + {// Room 1 Maze + Room room = rooms.elementAt(1); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1}, + {0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, + {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}, + {0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, + {1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1} + }; + + } + {// Room 1 Maze + Room room = rooms.elementAt(1); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1}, + {0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, + {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}, + {0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, + {1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1} + }; + + } + {// Room 2 Maze + Room room = rooms.elementAt(2); + room.SetMaterialFromRoom(1); + } + {// Room 3 Maze + Room room = rooms.elementAt(3); + room.SetMaterialFromRoom(1); + } + {// Room 4 Maze + Room room = rooms.elementAt(4); + room.SetMaterialFromRoom(1); + } + {// Room 5 Maze + Room room = rooms.elementAt(5); + room.SetMaterialFromRoom(1); + } + {// Room 6 Maze exit + Room room = rooms.elementAt(6); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + + room.AddTextBox("Welcome to the Super Secret 6th level!", 52, 64, 560); + room.AddTextBox("{255,000,000} Cross {255,128,000} the {255,255,000} rainbow {000,255,000} bridge {000,000,255} to {255,000,255} freedom!", + 64, 9 * 32, 560); // items.addElement(new Key(2*28,3*32,room,Color.red)); // items.addElement(new Key(2*28,4*32,room,new Color(255,128,0))); // items.addElement(new Key(2*28,5*32,room,Color.yellow)); // items.addElement(new Key(2*28,6*32,room,Color.green)); // items.addElement(new Key(2*28,7*32,room,Color.blue)); // items.addElement(new Key(2*28,8*32,room,new Color(255,0,255))); - } + } - {// Room 7 Hallway - Room room = (Room) rooms.elementAt(7); - int[][] table = { - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Rainbow bridge",364, 6*32, 560); - room.AddArrow(559,6*32,Arrow.DIR_RIGHT,28,Color.white); - } - {// Room 8 Rainbow Bridge - Room room = (Room) rooms.elementAt(8); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,3,3,3,4,4,4,5,5,5,6,6,6,1,1,1,7,7,7,2}, - {0,3,3,3,4,4,4,5,5,5,6,6,6,1,1,1,7,7,7,0}, - {0,3,3,3,4,4,4,5,5,5,6,6,6,1,1,1,7,7,7,0}, - {0,3,3,3,4,4,4,5,5,5,6,6,6,1,1,1,7,7,7,0}, - {0,3,3,3,4,4,4,5,5,5,6,6,6,1,1,1,7,7,7,0}, - {2,3,3,3,4,4,4,5,5,5,6,6,6,1,1,1,7,7,7,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - - } - {// Room 9 Hallway - Room room = (Room) rooms.elementAt(9); - int[][] table = { - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2} - }; - room.RoomArray = table; - - room.AddTextBox("Orange Lock", 28, 6*32, 560); - room.AddArrow(0, 6*32,Arrow.DIR_LEFT,28,Color.white); - room.AddTextBox("Yellow Lock", 400, 6*32, 560); - room.AddArrow(559,6*32,Arrow.DIR_RIGHT,28,Color.white); - } - {// Room 10 Hallway - Room room = (Room) rooms.elementAt(10); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2} - }; - room.RoomArray = table; - - room.AddTextBox("Red Lock Map", 28, 9*32, 560); - room.AddArrow(0,9*32+16,Arrow.DIR_LEFT,28,Color.white); - room.AddTextBox("Red Lock", 436, 2*32, 560); - room.AddArrow(559,2*32+16,Arrow.DIR_RIGHT,28,Color.white); - } - {// Room 11 Hallway - Room room = (Room) rooms.elementAt(11); - int[][] table = { - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2} - }; - room.RoomArray = table; - - room.AddTextBox("Green Lock", 28, 6*32, 560); - room.AddArrow(0, 6*32,Arrow.DIR_LEFT,28,Color.white); - room.AddTextBox("Blue Lock", 424, 6*32, 560); - room.AddArrow(559,6*32,Arrow.DIR_RIGHT,28,Color.white); - } - {// Room 12 Hallway - Room room = (Room) rooms.elementAt(12); - int[][] table = { - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - - room.AddTextBox("Purple Lock", 400, 6*32, 560); - room.AddArrow(559,6*32,Arrow.DIR_RIGHT,28,Color.white); - } + {// Room 7 Hallway + Room room = rooms.elementAt(7); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2} + }; + room.AddTextBox("Rainbow bridge", 364, 6 * 32, 560); + room.AddArrow(559, 6 * 32, Arrow.DIR_RIGHT, 28, Color.white); + } + {// Room 8 Rainbow Bridge + Room room = rooms.elementAt(8); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 1, 1, 1, 7, 7, 7, 2}, + {0, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 1, 1, 1, 7, 7, 7, 0}, + {0, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 1, 1, 1, 7, 7, 7, 0}, + {0, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 1, 1, 1, 7, 7, 7, 0}, + {0, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 1, 1, 1, 7, 7, 7, 0}, + {2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 1, 1, 1, 7, 7, 7, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; - {// Room 13 Red Lock upper - Room room = (Room) rooms.elementAt(13); - int[][] table = { - {10,10,10,10,10,10,10,15,10,10,10,10,10,10,10,10,10,10,10,13}, - { 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, - { 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, - { 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,19, 9}, - {14,10,10,13, 0, 0, 0, 9, 0, 0, 0,14,10,10,10,10,10,10,10,18}, - { 9, 0, 0, 9, 0, 0, 0, 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 9}, - { 9, 0, 0, 9, 0, 0, 0, 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 9}, - { 9, 0, 0, 9, 0, 0, 0, 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 9}, - { 9, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 9}, - { 9, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 9}, - { 9, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 9}, - { 9, 0, 0, 0,14,10,10,16,10,10,10,10,10,10,10,18, 0, 0, 0, 9} - }; - room.RoomArray = table; - int[] pace = {2*28,2*32, 2*28, 9*32}; - int[] program = {4*28,0, 18*28,11*32, 0,2*32}; - items.addElement(new Sentry(5*28,2*32,room,pace,program,true)); - } - {// Room 14 Red Lock lower - Room room = (Room) rooms.elementAt(14); - int[][] table = { - { 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, - { 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, - { 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, - { 9, 0, 0, 0, 9, 0, 0, 0,10,10,10,10,10,10,10,10,10,10,10,18}, - { 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, - { 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, - { 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, - { 9, 0, 0, 0,12,10,10,10,10,10,10,10,10,10,10,10, 0, 0, 0, 9}, - { 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, - { 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, - { 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, - {12,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11} - }; - room.RoomArray = table; - - } - {// Room 15 Red Lock map upper (lower) - Room room = (Room) rooms.elementAt(15); - int[][] table = { - {1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1}, - {1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1}, - {1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1}, - {1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1}, - {1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1}, - {1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1}, - {1,1,1,1,1,1,1,1,1,0,0,0,1,0,0,0,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, - {1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, - {1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table; - } - {// Room 16 Red Lock map lower (upper) - Room room = (Room) rooms.elementAt(16); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1} - }; - room.RoomArray = table; - - } - {// Room 17 Orange Lock (pac-man) - Room room = (Room) rooms.elementAt(17); - int[][] table = { - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, - {1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1}, - {1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,25, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,25, 0, 0, 0, 0}, - {1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0}, - {1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,20, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} - }; - room.RoomArray = table; - items.addElement(new Pellet(2*28-14,2*32-14,room)); - items.addElement(new Pellet(4*28-14,2*32-14,room)); - items.addElement(new Pellet(6*28-14,2*32-14,room)); - items.addElement(new Pellet(8*28-14,2*32-14,room)); - items.addElement(new Pellet(10*28-14,2*32-14,room)); - items.addElement(new Pellet(12*28-14,2*32-14,room)); - items.addElement(new Pellet(14*28-14,2*32-14,room)); - items.addElement(new Pellet(2*28-14,4*32-14,room)); - items.addElement(new Pellet(6*28-14,4*32-14,room)); - items.addElement(new Pellet(10*28-14,4*32-14,room)); - items.addElement(new Pellet(14*28-14,4*32-14,room)); - items.addElement(new Pellet(2*28-14,6*32-14,room)); - items.addElement(new Pellet(4*28-14,6*32-14,room)); - items.addElement(new Pellet(6*28-14,6*32-14,room)); - items.addElement(new Pellet(8*28-14,6*32-14,room)); - items.addElement(new Pellet(10*28-14,6*32-14,room)); - items.addElement(new Pellet(12*28-14,6*32-14,room)); - items.addElement(new Pellet(14*28-14,6*32-14,room)); - items.addElement(new Pellet(2*28-14,8*32-14,room)); - items.addElement(new Pellet(6*28-14,8*32-14,room)); - items.addElement(new Pellet(10*28-14,8*32-14,room)); - items.addElement(new Pellet(14*28-14,8*32-14,room)); - items.addElement(new Pellet(2*28-14,10*32-14,room)); - items.addElement(new Pellet(4*28-14,10*32-14,room)); - items.addElement(new Pellet(6*28-14,10*32-14,room)); - items.addElement(new Pellet(8*28-14,10*32-14,room)); - items.addElement(new Pellet(10*28-14,10*32-14,room)); - items.addElement(new Pellet(12*28-14,10*32-14,room)); - items.addElement(new Pellet(14*28-14,10*32-14,room)); - items.addElement(new Ghost(42,48,room)); - items.addElement(new DirectionalSensor(16*28+8,4*32+16,room, - new Ghost(0,0,null))); - } - {// Room 18 Yellow Lock (Hot tunnel) - Room room = (Room) rooms.elementAt(18); - int[][] table = { - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,21, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} - }; - room.RoomArray = table; - items.addElement(new Wave(room)); - - int[] pace = {2*28,2*32, 2*28, 9*32}; - int[] program = {4*28,0, 18*28,11*32, 0,5*32}; - items.addElement(new Sentry(5*28,2*32,room,pace,program,true)); - } - {// Room 19 Green Lock (Turbines) - Room room = (Room) rooms.elementAt(19); - int[][] table = { - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,22, 1, 0, 0, 0, 0, 0, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} - }; - room.RoomArray = table; - int[] cells1 = {12,3,0,1, 11,3,0,1, 10,3,0,1, 9,3,0,1, 8,3,0,1, 7,3,0,1}; - items.addElement(new Turbine(28,9*32,room,cells1)); - int[] cells2 = {12,5,0,1, 11,5,0,1, 10,5,0,1, 9,5,0,1, 8,5,0,1, 7,5,0,1}; - items.addElement(new Turbine(5*28,9*32,room,cells2)); - int[] pace = {6*28,2*32, 13*28,2*32}; - int[] program = {28,32, 15*28,10*32, 19*28,5*32}; - items.addElement(new Sentry(6*28,2*32,room,pace,program, true)); - } - {// Room 20 Blue Lock (Flip Maze) - Room room = (Room) rooms.elementAt(20); - int[][] table = { - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 1}, - {0, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 1}, - {0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1}, - {0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1}, - {0, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 1}, - {1, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 1}, - {1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1}, - {1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0,26,23}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} - }; - room.RoomArray = table; - - int[] pace = {2*28,2*32, 2*28, 9*32}; - int[] program = {4*28,0, 18*28,11*32, 0,5*32}; - items.addElement(new Sentry(5*28,2*32,room,pace,program,true)); - } - {// Room 21 Purple Lock (4 Pull Locks) - Room room = (Room) rooms.elementAt(21); - int[][] table = { - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 1, 0, 0, 0,24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} - }; - room.RoomArray = table; - items.addElement(new WallHandle(11*28,3*32+8,room)); - items.addElement(new WallHandle(11*28,5*32+8,room)); - items.addElement(new WallHandle(11*28,7*32+8,room)); - items.addElement(new WallHandle(11*28,9*32+8,room)); - int[] pace = {2*28,2*32, 2*28, 9*32}; - int[] program = {4*28,0, 18*28,11*32, 0,5*32}; - items.addElement(new Sentry(5*28,2*32,room,pace,program,true)); - } + } + {// Room 9 Hallway + Room room = rooms.elementAt(9); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2} + }; - {// Room 22 Final Portal! - Room room = (Room) rooms.elementAt(22); - int[][] table = { - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0,28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} - }; - room.RoomArray = table; - room.AddTextBox("You did it! You beat the Secret 6th level!",2*28,2*32,500); - room.AddTextBox("Believe it or not, you have now accomplished something that Tom hasn't even done yet.!", - 2*28,5*32,500); - String[] helperlist = { - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper7.gif","helper6.gif","helper7.gif","helper6.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper1.gif","helper4.gif","helper2.gif","helper3.gif", - "helper0.gif","helper0.gif","helper0.gif","helper0.gif", - "helper5.gif","helper5.gif","helper5.gif","helper5.gif", - }; - Graphix helper = new Graphix(helperlist,15*28, 8*32); - room.graphix.addElement(helper); - } - - for (int a=1; a<=5; a++) - { - Room roomA = (Room) rooms.elementAt(a); - Room room1 = (Room) rooms.elementAt(1); - roomA.upRoom = room1; - roomA.downRoom = room1; - roomA.leftRoom = room1; - roomA.rightRoom = room1; - } - - ((Room) rooms.elementAt(1)).leftRoom = (Room) rooms.elementAt(2); - ((Room) rooms.elementAt(2)).upRoom = (Room) rooms.elementAt(3); - ((Room) rooms.elementAt(3)).rightRoom = (Room) rooms.elementAt(4); - ((Room) rooms.elementAt(4)).leftRoom = (Room) rooms.elementAt(5); - ((Room) rooms.elementAt(5)).downRoom = (Room) rooms.elementAt(6); - ((Room) rooms.elementAt(6)).upRoom = (Room) rooms.elementAt(1); - - LinkRoomsLeftRight(6,7); - LinkRoomsLeftRight(7,8); - LinkRoomsLeftRight(8,22); - - int[] list1 = {10,9,7,11,12}; - LinkRoomsVertically(list1); - - LinkRoomsUpDown(16,15); - LinkRoomsUpDown(13,14); - LinkRoomsLeftRight(15,10); - LinkRoomsLeftRight(10,13); - LinkRoomsLeftRight(17,9); - LinkRoomsLeftRight(9,18); - LinkRoomsLeftRight(19,11); - LinkRoomsLeftRight(11,20); - LinkRoomsLeftRight(12,21); - - gameCursor = new GameCursor(9*28+14,5*32+16,(Room) rooms.elementAt(1)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - solderingPen = new SolderingPen(); - remote = new Remote(); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - player = gameCursor; - currentViewer = player; - - } + room.AddTextBox("Orange Lock", 28, 6 * 32, 560); + room.AddArrow(0, 6 * 32, Arrow.DIR_LEFT, 28, Color.white); + room.AddTextBox("Yellow Lock", 400, 6 * 32, 560); + room.AddArrow(559, 6 * 32, Arrow.DIR_RIGHT, 28, Color.white); + } + {// Room 10 Hallway + Room room = rooms.elementAt(10); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2} + }; + + room.AddTextBox("Red Lock Map", 28, 9 * 32, 560); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + room.AddTextBox("Red Lock", 436, 2 * 32, 560); + room.AddArrow(559, 2 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + {// Room 11 Hallway + Room room = rooms.elementAt(11); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2} + }; + + room.AddTextBox("Green Lock", 28, 6 * 32, 560); + room.AddArrow(0, 6 * 32, Arrow.DIR_LEFT, 28, Color.white); + room.AddTextBox("Blue Lock", 424, 6 * 32, 560); + room.AddArrow(559, 6 * 32, Arrow.DIR_RIGHT, 28, Color.white); + } + {// Room 12 Hallway + Room room = rooms.elementAt(12); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + + room.AddTextBox("Purple Lock", 400, 6 * 32, 560); + room.AddArrow(559, 6 * 32, Arrow.DIR_RIGHT, 28, Color.white); + } + + {// Room 13 Red Lock upper + Room room = rooms.elementAt(13); + room.RoomArray = new int[][]{ + {10, 10, 10, 10, 10, 10, 10, 15, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 13}, + {0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 9}, + {14, 10, 10, 13, 0, 0, 0, 9, 0, 0, 0, 14, 10, 10, 10, 10, 10, 10, 10, 18}, + {9, 0, 0, 9, 0, 0, 0, 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 0, 0, 9, 0, 0, 0, 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 0, 0, 9, 0, 0, 0, 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 9}, + {9, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 9}, + {9, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 9}, + {9, 0, 0, 0, 14, 10, 10, 16, 10, 10, 10, 10, 10, 10, 10, 18, 0, 0, 0, 9} + }; + int[] pace = {2 * 28, 2 * 32, 2 * 28, 9 * 32}; + int[] program = {4 * 28, 0, 18 * 28, 11 * 32, 0, 2 * 32}; + items.addElement(new Sentry(5 * 28, 2 * 32, room, pace, program, true)); + } + {// Room 14 Red Lock lower + Room room = rooms.elementAt(14); + room.RoomArray = new int[][]{ + {9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 0, 0, 0, 9, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 18}, + {9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 0, 0, 0, 12, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 9}, + {9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9}, + {12, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11} + }; + + } + {// Room 15 Red Lock map upper (lower) + Room room = rooms.elementAt(15); + room.RoomArray = new int[][]{ + {1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + } + {// Room 16 Red Lock map lower (upper) + Room room = rooms.elementAt(16); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1} + }; + + } + {// Room 17 Orange Lock (pac-man) + Room room = rooms.elementAt(17); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1}, + {1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0}, + {1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0}, + {1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 20, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + items.addElement(new Pellet(2 * 28 - 14, 2 * 32 - 14, room)); + items.addElement(new Pellet(4 * 28 - 14, 2 * 32 - 14, room)); + items.addElement(new Pellet(6 * 28 - 14, 2 * 32 - 14, room)); + items.addElement(new Pellet(8 * 28 - 14, 2 * 32 - 14, room)); + items.addElement(new Pellet(10 * 28 - 14, 2 * 32 - 14, room)); + items.addElement(new Pellet(12 * 28 - 14, 2 * 32 - 14, room)); + items.addElement(new Pellet(14 * 28 - 14, 2 * 32 - 14, room)); + items.addElement(new Pellet(2 * 28 - 14, 4 * 32 - 14, room)); + items.addElement(new Pellet(6 * 28 - 14, 4 * 32 - 14, room)); + items.addElement(new Pellet(10 * 28 - 14, 4 * 32 - 14, room)); + items.addElement(new Pellet(14 * 28 - 14, 4 * 32 - 14, room)); + items.addElement(new Pellet(2 * 28 - 14, 6 * 32 - 14, room)); + items.addElement(new Pellet(4 * 28 - 14, 6 * 32 - 14, room)); + items.addElement(new Pellet(6 * 28 - 14, 6 * 32 - 14, room)); + items.addElement(new Pellet(8 * 28 - 14, 6 * 32 - 14, room)); + items.addElement(new Pellet(10 * 28 - 14, 6 * 32 - 14, room)); + items.addElement(new Pellet(12 * 28 - 14, 6 * 32 - 14, room)); + items.addElement(new Pellet(14 * 28 - 14, 6 * 32 - 14, room)); + items.addElement(new Pellet(2 * 28 - 14, 8 * 32 - 14, room)); + items.addElement(new Pellet(6 * 28 - 14, 8 * 32 - 14, room)); + items.addElement(new Pellet(10 * 28 - 14, 8 * 32 - 14, room)); + items.addElement(new Pellet(14 * 28 - 14, 8 * 32 - 14, room)); + items.addElement(new Pellet(2 * 28 - 14, 10 * 32 - 14, room)); + items.addElement(new Pellet(4 * 28 - 14, 10 * 32 - 14, room)); + items.addElement(new Pellet(6 * 28 - 14, 10 * 32 - 14, room)); + items.addElement(new Pellet(8 * 28 - 14, 10 * 32 - 14, room)); + items.addElement(new Pellet(10 * 28 - 14, 10 * 32 - 14, room)); + items.addElement(new Pellet(12 * 28 - 14, 10 * 32 - 14, room)); + items.addElement(new Pellet(14 * 28 - 14, 10 * 32 - 14, room)); + items.addElement(new Ghost(42, 48, room)); + items.addElement(new DirectionalSensor(16 * 28 + 8, 4 * 32 + 16, room, + new Ghost(0, 0, null))); + } + {// Room 18 Yellow Lock (Hot tunnel) + Room room = rooms.elementAt(18); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + items.addElement(new Wave(room)); + + int[] pace = {2 * 28, 2 * 32, 2 * 28, 9 * 32}; + int[] program = {4 * 28, 0, 18 * 28, 11 * 32, 0, 5 * 32}; + items.addElement(new Sentry(5 * 28, 2 * 32, room, pace, program, true)); + } + {// Room 19 Green Lock (Turbines) + Room room = rooms.elementAt(19); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + int[] cells1 = {12, 3, 0, 1, 11, 3, 0, 1, 10, 3, 0, 1, 9, 3, 0, 1, 8, 3, 0, 1, 7, 3, 0, 1}; + items.addElement(new Turbine(28, 9 * 32, room, cells1)); + int[] cells2 = {12, 5, 0, 1, 11, 5, 0, 1, 10, 5, 0, 1, 9, 5, 0, 1, 8, 5, 0, 1, 7, 5, 0, 1}; + items.addElement(new Turbine(5 * 28, 9 * 32, room, cells2)); + int[] pace = {6 * 28, 2 * 32, 13 * 28, 2 * 32}; + int[] program = {28, 32, 15 * 28, 10 * 32, 19 * 28, 5 * 32}; + items.addElement(new Sentry(6 * 28, 2 * 32, room, pace, program, true)); + } + {// Room 20 Blue Lock (Flip Maze) + Room room = rooms.elementAt(20); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 1}, + {0, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 1}, + {0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1}, + {0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1}, + {0, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 1}, + {1, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 1}, + {1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1}, + {1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 26, 23}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + + int[] pace = {2 * 28, 2 * 32, 2 * 28, 9 * 32}; + int[] program = {4 * 28, 0, 18 * 28, 11 * 32, 0, 5 * 32}; + items.addElement(new Sentry(5 * 28, 2 * 32, room, pace, program, true)); + } + {// Room 21 Purple Lock (4 Pull Locks) + Room room = rooms.elementAt(21); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 1, 0, 0, 0, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + items.addElement(new WallHandle(11 * 28, 3 * 32 + 8, room)); + items.addElement(new WallHandle(11 * 28, 5 * 32 + 8, room)); + items.addElement(new WallHandle(11 * 28, 7 * 32 + 8, room)); + items.addElement(new WallHandle(11 * 28, 9 * 32 + 8, room)); + int[] pace = {2 * 28, 2 * 32, 2 * 28, 9 * 32}; + int[] program = {4 * 28, 0, 18 * 28, 11 * 32, 0, 5 * 32}; + items.addElement(new Sentry(5 * 28, 2 * 32, room, pace, program, true)); + } + + {// Room 22 Final Portal! + Room room = rooms.elementAt(22); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + room.AddTextBox("You did it! You beat the Secret 6th level!", 2 * 28, 2 * 32, 500); + room.AddTextBox("Believe it or not, you have now accomplished something that Tom hasn't even done yet.!", + 2 * 28, 5 * 32, 500); + String[] helperlist = { + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper7.gif", "helper6.gif", "helper7.gif", "helper6.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper1.gif", "helper4.gif", "helper2.gif", "helper3.gif", + "helper0.gif", "helper0.gif", "helper0.gif", "helper0.gif", + "helper5.gif", "helper5.gif", "helper5.gif", "helper5.gif", + }; + Graphix helper = new Graphix(helperlist, 15 * 28, 8 * 32); + room.graphix.addElement(helper); + } + + for (int a = 1; a <= 5; a++) { + Room roomA = rooms.elementAt(a); + Room room1 = rooms.elementAt(1); + roomA.upRoom = room1; + roomA.downRoom = room1; + roomA.leftRoom = room1; + roomA.rightRoom = room1; + } + + rooms.elementAt(1).leftRoom = rooms.elementAt(2); + rooms.elementAt(2).upRoom = rooms.elementAt(3); + rooms.elementAt(3).rightRoom = rooms.elementAt(4); + rooms.elementAt(4).leftRoom = rooms.elementAt(5); + rooms.elementAt(5).downRoom = rooms.elementAt(6); + rooms.elementAt(6).upRoom = rooms.elementAt(1); + + LinkRoomsLeftRight(6, 7); + LinkRoomsLeftRight(7, 8); + LinkRoomsLeftRight(8, 22); + + int[] list1 = {10, 9, 7, 11, 12}; + LinkRoomsVertically(list1); + + LinkRoomsUpDown(16, 15); + LinkRoomsUpDown(13, 14); + LinkRoomsLeftRight(15, 10); + LinkRoomsLeftRight(10, 13); + LinkRoomsLeftRight(17, 9); + LinkRoomsLeftRight(9, 18); + LinkRoomsLeftRight(19, 11); + LinkRoomsLeftRight(11, 20); + LinkRoomsLeftRight(12, 21); + + gameCursor = new GameCursor(9 * 28 + 14, 5 * 32 + 16, rooms.elementAt(1)); + helpCam = new HelpCam(rooms.elementAt(0)); + solderingPen = new SolderingPen(); + remote = new Remote(); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + player = gameCursor; + currentViewer = player; + + } } \ No newline at end of file diff --git a/src/com/droidquest/levels/ROEndGame.java b/src/com/droidquest/levels/ROEndGame.java index af9bccb..ec200ba 100644 --- a/src/com/droidquest/levels/ROEndGame.java +++ b/src/com/droidquest/levels/ROEndGame.java @@ -14,152 +14,148 @@ import com.droidquest.materials.Lock; import com.droidquest.materials.Material; import com.droidquest.materials.Portal; -class ROEndGame extends Level -{ -public ROEndGame (RoomDisplay rd) - { - super(rd); - - materials.addElement(new Material(true, false)); // 0 = Empty Space - materials.addElement(new Material(new Color(0,0,255),false, true)); // 1 = Blue - materials.addElement(new Portal("MainMenu.lvl",false,false)); // 2 = Portal - - int[][] program1 = { - {Lock.NARROW}, - {4,5,0, 4,6,0}, - {4,4,0, 4,7,0}, - {Lock.NARROW}, - {4,4,1, 4,7,1}, - {4,5,1, 4,6,1}, - }; - materials.addElement(new Lock(Color.green, Color.green, program1 )); // 3=Green Lock - - int[][] program2 = { - {Lock.NARROW}, - {7,5,0, 7,6,0}, - {7,4,0, 7,7,0}, - {Lock.NARROW}, - {7,4,1, 7,7,1}, - {7,5,1, 7,6,1}, - }; - materials.addElement(new Lock(Color.yellow, Color.yellow, program2)); // 4=yellow Lock - - int[][] program3 = { - {Lock.NARROW}, - {10,5,0, 10,6,0}, - {10,4,0, 10,7,0}, - {Lock.NARROW}, - {10,4,1, 10,7,1}, - {10,5,1, 10,6,1}, - }; - materials.addElement(new Lock(Color.red, Color.red, program3)); // 5=red Lock - - int[][] program4 = { - {Lock.NARROW}, - {13,5,0, 13,6,0}, - {13,4,0, 13,7,0}, - {Lock.NARROW}, - {13,4,1, 13,7,1}, - {13,5,1, 13,6,1}, - }; - materials.addElement(new Lock(new Color(255,128,0), new Color(255,128,0), program4)); // 6=Orange lock - - int[][] program5 = { - {Lock.NARROW}, - {16,5,0, 16,6,0}, - {16,4,0, 16,7,0}, - {Lock.NARROW}, - {16,4,1, 16,7,1}, - {16,5,1, 16,6,1}, - }; - materials.addElement(new Lock(new Color(255,0,255), new Color(255,0,255), program5)); // 7=purple Lock - - materials.addElement(new Portal("RO6.lvl",true,true)); // 8=portal - - - for (int a=0; a<3; a++) - rooms.addElement(new Room()); - - {// Room 0 Help - Room room = (Room) rooms.elementAt(0); - int[][] table = { - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} - }; - room.RoomArray = table; - room.AddTextBox("No help here. Press Return.", - 118, 5*32, 450); - } +class ROEndGame extends Level { + public ROEndGame(RoomDisplay rd) { + super(rd); - {// Room 1 Portal to Main Menu - Room room = (Room) rooms.elementAt(1); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {255,000,000} CONGRATULATIONS!",64,64, 500); - room.AddTextBox("You are one of the few, true",112,4*32, 560); - room.AddTextBox("Robot Masters.",196,4*32+20, 560); - room.AddTextBox("Return to the Main Menu",2*28,10*32+24, 500); - room.AddArrow(360,10*32+16,Arrow.DIR_RIGHT,28,Color.white); - items.addElement(new EndAnimation(room)); - } - - {// Room 2 Locks to Secret Level - Room room = (Room) rooms.elementAt(2); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1}, - {1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1}, - {1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1}, - {1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1}, - {1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1}, - {1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,8,1}, - {1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1}, - {1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1}, - {1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1}, - {0,0,0,3,1,0,4,1,0,5,1,0,6,1,0,7,1,0,0,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table; - room.AddTextBox("You may want to take the keys with you...",24,24, 560); - } + materials.addElement(new Material(true, false)); // 0 = Empty Space + materials.addElement(new Material(new Color(0, 0, 255), false, true)); // 1 = Blue + materials.addElement(new Portal("MainMenu.lvl", false, false)); // 2 = Portal - LinkRoomsLeftRight(1,2); - - gameCursor = new GameCursor(10*28,8*32,(Room) rooms.elementAt(1)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - solderingPen = new SolderingPen(); - remote = new Remote(); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - player = gameCursor; - currentViewer = player; - - } + int[][] program1 = { + {Lock.NARROW}, + {4, 5, 0, 4, 6, 0}, + {4, 4, 0, 4, 7, 0}, + {Lock.NARROW}, + {4, 4, 1, 4, 7, 1}, + {4, 5, 1, 4, 6, 1}, + }; + materials.addElement(new Lock(Color.green, Color.green, program1)); // 3=Green Lock + + int[][] program2 = { + {Lock.NARROW}, + {7, 5, 0, 7, 6, 0}, + {7, 4, 0, 7, 7, 0}, + {Lock.NARROW}, + {7, 4, 1, 7, 7, 1}, + {7, 5, 1, 7, 6, 1}, + }; + materials.addElement(new Lock(Color.yellow, Color.yellow, program2)); // 4=yellow Lock + + int[][] program3 = { + {Lock.NARROW}, + {10, 5, 0, 10, 6, 0}, + {10, 4, 0, 10, 7, 0}, + {Lock.NARROW}, + {10, 4, 1, 10, 7, 1}, + {10, 5, 1, 10, 6, 1}, + }; + materials.addElement(new Lock(Color.red, Color.red, program3)); // 5=red Lock + + int[][] program4 = { + {Lock.NARROW}, + {13, 5, 0, 13, 6, 0}, + {13, 4, 0, 13, 7, 0}, + {Lock.NARROW}, + {13, 4, 1, 13, 7, 1}, + {13, 5, 1, 13, 6, 1}, + }; + materials.addElement(new Lock(new Color(255, 128, 0), new Color(255, 128, 0), program4)); // 6=Orange lock + + int[][] program5 = { + {Lock.NARROW}, + {16, 5, 0, 16, 6, 0}, + {16, 4, 0, 16, 7, 0}, + {Lock.NARROW}, + {16, 4, 1, 16, 7, 1}, + {16, 5, 1, 16, 6, 1}, + }; + materials.addElement(new Lock(new Color(255, 0, 255), new Color(255, 0, 255), program5)); // 7=purple Lock + + materials.addElement(new Portal("RO6.lvl", true, true)); // 8=portal + + + for (int a = 0; a < 3; a++) { + rooms.addElement(new Room()); + } + + {// Room 0 Help + Room room = rooms.elementAt(0); + room.RoomArray = new int[][]{ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + }; + room.AddTextBox("No help here. Press Return.", + 118, 5 * 32, 450); + } + + {// Room 1 Portal to Main Menu + Room room = rooms.elementAt(1); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + + room.AddTextBox("{BIG} {255,000,000} CONGRATULATIONS!", 64, 64, 500); + room.AddTextBox("You are one of the few, true", 112, 4 * 32, 560); + room.AddTextBox("Robot Masters.", 196, 4 * 32 + 20, 560); + room.AddTextBox("Return to the Main Menu", 2 * 28, 10 * 32 + 24, 500); + room.AddArrow(360, 10 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new EndAnimation(room)); + } + + {// Room 2 Locks to Secret Level + Room room = rooms.elementAt(2); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1}, + {1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1}, + {1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1}, + {1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1}, + {1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1}, + {1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 8, 1}, + {1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1}, + {1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1}, + {1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1}, + {0, 0, 0, 3, 1, 0, 4, 1, 0, 5, 1, 0, 6, 1, 0, 7, 1, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + room.AddTextBox("You may want to take the keys with you...", 24, 24, 560); + } + + LinkRoomsLeftRight(1, 2); + + gameCursor = new GameCursor(10 * 28, 8 * 32, rooms.elementAt(1)); + helpCam = new HelpCam(rooms.elementAt(0)); + solderingPen = new SolderingPen(); + remote = new Remote(); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + player = gameCursor; + currentViewer = player; + + } } diff --git a/src/com/droidquest/levels/ROEndGame2.java b/src/com/droidquest/levels/ROEndGame2.java index deeb447..a78d55a 100644 --- a/src/com/droidquest/levels/ROEndGame2.java +++ b/src/com/droidquest/levels/ROEndGame2.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.avatars.GameCursor; @@ -13,77 +11,76 @@ import com.droidquest.items.EndAnimation; import com.droidquest.materials.Material; import com.droidquest.materials.Portal; -class ROEndGame2 extends Level -{ -public ROEndGame2 (RoomDisplay rd) - { - super(rd); - - materials.addElement(new Material(true, false)); // 0 = Empty Space - materials.addElement(new Material(new Color(0,0,255),false, true)); // 1 = Blue - materials.addElement(new Portal("MainMenu.lvl",true,false)); // 2 = Portal - - for (int a=0; a<2; a++) - rooms.addElement(new Room()); - - {// Room 0 Help - Room room = (Room) rooms.elementAt(0); - int[][] table = { - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} - }; - room.RoomArray = table; - room.AddTextBox("No help here. Press Return.", - 118, 5*32, 450); - } +import java.awt.*; - {// Room 1 Portal to Main Menu - Room room = (Room) rooms.elementAt(1); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table; - - room.AddTextBox("{BIG} {255,000,000} CONGRATULATIONS!",64,64, 500); - room.AddTextBox("You are one of the rare and elite",82,4*32, 560); - room.AddTextBox("Robot Lords.",214,5*32+20, 560); - room.AddTextBox("Return to the Main Menu",2*28,10*32+24, 500); - room.AddArrow(360,10*32+16,Arrow.DIR_RIGHT,28,Color.white); - items.addElement(new EndAnimation(room)); - } - - gameCursor = new GameCursor(10*28,8*32,(Room) rooms.elementAt(1)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - solderingPen = new SolderingPen(); - remote = new Remote(); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - player = gameCursor; - currentViewer = player; - - } +class ROEndGame2 extends Level { + public ROEndGame2(RoomDisplay rd) { + super(rd); + + materials.addElement(new Material(true, false)); // 0 = Empty Space + materials.addElement(new Material(new Color(0, 0, 255), false, true)); // 1 = Blue + materials.addElement(new Portal("MainMenu.lvl", true, false)); // 2 = Portal + + for (int a = 0; a < 2; a++) { + rooms.addElement(new Room()); + } + + {// Room 0 Help + Room room = rooms.elementAt(0); + room.RoomArray = new int[][]{ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + }; + room.AddTextBox("No help here. Press Return.", + 118, 5 * 32, 450); + } + + {// Room 1 Portal to Main Menu + Room room = rooms.elementAt(1); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + + room.AddTextBox("{BIG} {255,000,000} CONGRATULATIONS!", 64, 64, 500); + room.AddTextBox("You are one of the rare and elite", 82, 4 * 32, 560); + room.AddTextBox("Robot Lords.", 214, 5 * 32 + 20, 560); + room.AddTextBox("Return to the Main Menu", 2 * 28, 10 * 32 + 24, 500); + room.AddArrow(360, 10 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new EndAnimation(room)); + } + + gameCursor = new GameCursor(10 * 28, 8 * 32, rooms.elementAt(1)); + helpCam = new HelpCam(rooms.elementAt(0)); + solderingPen = new SolderingPen(); + remote = new Remote(); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + player = gameCursor; + currentViewer = player; + + } } diff --git a/src/com/droidquest/levels/ROLab.java b/src/com/droidquest/levels/ROLab.java index b0e102e..8b55468 100644 --- a/src/com/droidquest/levels/ROLab.java +++ b/src/com/droidquest/levels/ROLab.java @@ -1,337 +1,293 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; -import com.droidquest.avatars.HelpCam; -import com.droidquest.avatars.LabCursor; -import com.droidquest.avatars.PaintBrush; -import com.droidquest.avatars.Remote; -import com.droidquest.avatars.SolderingPen; +import com.droidquest.avatars.*; import com.droidquest.chipstuff.Port; import com.droidquest.decorations.Arrow; -import com.droidquest.devices.ContactSensor; -import com.droidquest.devices.DirectionalSensor; -import com.droidquest.devices.PortDevice; -import com.droidquest.devices.PrototypeChip; -import com.droidquest.devices.RoomSensor; -import com.droidquest.devices.SmallChip; -import com.droidquest.items.AutoWire; -import com.droidquest.items.BlueRobot; -import com.droidquest.items.Burner; -import com.droidquest.items.Crystal; -import com.droidquest.items.Factory; -import com.droidquest.items.Hexagon; -import com.droidquest.items.Key; -import com.droidquest.items.MazeControl; -import com.droidquest.items.MazeCreator; -import com.droidquest.items.MazeLock; -import com.droidquest.items.OrangeRobot; -import com.droidquest.items.PC16Button; -import com.droidquest.items.PC32Button; -import com.droidquest.items.PCButton; -import com.droidquest.items.SpeedControl; -import com.droidquest.items.Square; -import com.droidquest.items.ToolBox; -import com.droidquest.items.Triangle; -import com.droidquest.items.UnBurner; -import com.droidquest.items.WhiteRobot; -import com.droidquest.items.WireTester; -import com.droidquest.materials.ChipTester; -import com.droidquest.materials.ChipTrash; -import com.droidquest.materials.CrystalRecharger; -import com.droidquest.materials.Lock; -import com.droidquest.materials.Material; -import com.droidquest.materials.PrototypeBurner; -import com.droidquest.materials.ShapeEditor; -import com.droidquest.materials.SmallChipBurner; +import com.droidquest.devices.*; +import com.droidquest.items.*; +import com.droidquest.materials.*; -class ROLab extends Level -{ -public ROLab(RoomDisplay rd) - { - super(rd); - - // Material 0, Blank - materials.addElement(new Material(true, false)); - // Material 1, LightBlue Wall - materials.addElement(new Material(new Color(192,192,255),false, true)); - // Material 2, LightOrange Wall - materials.addElement(new Material(new Color(255,224,192),false, true)); - // Material 3, Red Wall - materials.addElement(new Material(new Color(255,0,0),false, true)); - // Material 4, Green Wall - materials.addElement(new Material(new Color(0,255,0),false, false)); - // Material 5, CrystalRecharger - materials.addElement(new CrystalRecharger()); - // Material 6, Crystal Shape Editor - materials.addElement(new ShapeEditor(new Crystal(0,0,null,0))); - // Material 7, Hexagon Shape Editor - materials.addElement(new ShapeEditor(new Hexagon(0,0,null,Color.blue))); - // Material 8, Square Shape Editor - materials.addElement(new ShapeEditor(new Square(0,0,null,Color.white))); - // Material 9, Triangle Shape Editor - materials.addElement(new ShapeEditor(new Triangle(0,0,null,new Color(255,128,0)))); - // Material 10, PrototypeBurner - materials.addElement(new PrototypeBurner()); - // Material 11, SmallChipBurner - materials.addElement(new SmallChipBurner()); - // Material 12, ChipTrash - materials.addElement(new ChipTrash()); - // Material 13, ChipTester - materials.addElement(new ChipTester()); - // Material 14, Lock - int[][] lockProgram = { - {Lock.NARROW}, - {0,1,1, 19,1,1}, - {0,2,1, 19,2,1}, - {0,3,1, 19,3,1}, - {Lock.NARROW}, - {0,3,0, 19,3,0}, - {0,2,0, 19,2,0}, - {0,1,0, 19,1,0}, - }; - materials.addElement(new Lock(new Color(192,192,255), Color.white, lockProgram)); - // Materials 15, MazeLock - materials.addElement(new MazeLock()); - - - for (int a=0; a<18; a++) - rooms.addElement(new Room()); - - { // Room 0, Help Screen - Room room = (Room) rooms.elementAt(0); - int[][] table = { - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4} - }; - room.RoomArray = table; - room.AddTextBox("Use the Innovation Lab to design and test circuits in robots and the large prototype chip.", - 2*28, 2*32, 500); - room.AddTextBox("Burn a small chip from your prototype chip in the burn room.", - 2*28, 5*32, 500); - room.AddTextBox("Change maze walls with the paint brush. Change sensor bodies and maze objects in the Shape Editor.", - 2*28, 7*32, 500); - room.AddTextBox("For help, see Tutorials.", - 2*28, 10*32, 500); - room.AddTextBox("(To go to Lab, press Return.)", - 4*28, 11*32, 500); - } - { // Room 1, Chip Testing Room - Room room = (Room) rooms.elementAt(1); - int[][] table = { - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 1,13,13,13,13,13,13, 1, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 1,13,13,13,13,13,13, 1, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 1,13,13,13,13,13,13, 1, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 1,13,13,13,13,13,13, 1, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 1,13,13,13,13,13,13, 1, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} - }; - room.RoomArray = table; - room.AddTextBox("{000,000,000} Chip Tester", (560-(11*12))/2, 32+24, 500); - PortDevice[] portdevices = new PortDevice[8]; - portdevices[0] = new PortDevice(6*28+4,3*32+4,room,28,Port.TYPE_UNDEFINED); - portdevices[1] = new PortDevice(6*28+4,4*32+4,room,28,Port.TYPE_UNDEFINED); - portdevices[2] = new PortDevice(6*28+4,5*32+4,room,28,Port.TYPE_UNDEFINED); - portdevices[3] = new PortDevice(6*28+4,6*32+4,room,28,Port.TYPE_UNDEFINED); - portdevices[4] = new PortDevice(12*28+4,6*32+4,room,28,Port.TYPE_UNDEFINED); - portdevices[5] = new PortDevice(12*28+4,5*32+4,room,28,Port.TYPE_UNDEFINED); - portdevices[6] = new PortDevice(12*28+4,4*32+4,room,28,Port.TYPE_UNDEFINED); - portdevices[7] = new PortDevice(12*28+4,3*32+4,room,28,Port.TYPE_UNDEFINED); - portdevices[0].rotate(1); - portdevices[1].rotate(1); - portdevices[2].rotate(1); - portdevices[3].rotate(1); - portdevices[4].rotate(-1); - portdevices[5].rotate(-1); - portdevices[6].rotate(-1); - portdevices[7].rotate(-1); - for (int a=0; a<8; a++) - items.addElement(portdevices[a]); - items.addElement(new AutoWire(2*28,10*32,room)); - items.addElement(new WireTester(5*28,3*32,room,portdevices[0])); - items.addElement(new WireTester(5*28,4*32,room,portdevices[1])); - items.addElement(new WireTester(5*28,5*32,room,portdevices[2])); - items.addElement(new WireTester(5*28,6*32,room,portdevices[3])); - items.addElement(new WireTester(14*28+2,6*32,room,portdevices[4])); - items.addElement(new WireTester(14*28+2,5*32,room,portdevices[5])); - items.addElement(new WireTester(14*28+2,4*32,room,portdevices[6])); - items.addElement(new WireTester(14*28+2,3*32,room,portdevices[7])); - room.AddArrow(3*28,10*32+16,Arrow.DIR_LEFT,28,Color.white); - room.AddTextBox("Autowirer",4*28,11*32-8,200); - } - { // Room 2, Storage Space 1 - Room room = (Room) rooms.elementAt(2); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table; - room.AddTextBox("Storage Space", 2*28, 2*32, 500); - } - { // Room 3, Storage Space 2 - Room room = (Room) rooms.elementAt(3); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table; - } - { // Room 4, Burner Room - Room room = (Room) rooms.elementAt(4); - int[][] table = { - {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 2,10,10,10,10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 2,10,10,10,10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 2,10,10,10,10, 2, 0, 0, 0, 2,11,11, 2, 0, 0, 0, 0, 0}, - {2, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2,11,11, 2, 0, 0, 0, 0, 0}, - {2, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} - }; - room.RoomArray = table; - room.AddTextBox("Burner Room", 2*28, 2*32, 200); - room.AddTextBox("1x",15*28-14,11*32-8,100); - items.addElement(new SpeedControl(15*28,7*32,room,SpeedControl.DIR_UP)); - items.addElement(new SpeedControl(15*28,9*32,room,SpeedControl.DIR_DOWN)); - items.addElement(new SmallChip(12*28, 1*32+16, room, "1")); - items.addElement(new SmallChip(14*28, 1*32+16, room, "2")); - items.addElement(new SmallChip(16*28, 1*32+16, room, "3")); - items.addElement(new SmallChip(18*28, 1*32+16, room, "4")); - items.addElement(new SmallChip(12*28, 3*32, room, "5")); - items.addElement(new SmallChip(14*28, 3*32, room, "6")); - items.addElement(new SmallChip(16*28, 3*32, room, "7")); - items.addElement(new SmallChip(18*28, 3*32, room, "8")); - items.addElement(new Burner(18*28, 10*32+2, room)); - items.addElement(new UnBurner(2*28, 10*32+2, room)); - room.AddTextBox("{000,000,000} Unburner", 1*28, 12*32-8, 200); - room.AddTextBox("{000,000,000} Burner", 17*28, 12*32-8, 200); - } - { // Room 5, Title Room - Room room = (Room) rooms.elementAt(5); - int[][] table = { - {1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1} - }; - room.RoomArray = table; - room.AddTextBox("{BIG} Innovation Lab", 3*28, 2*32, 600); - items.addElement(new PrototypeChip(8*28, 4*32, room)); - items.addElement(new BlueRobot(4*28, 8*32, room)); - items.addElement(new WhiteRobot(9*28, 8*32, room)); - items.addElement(new OrangeRobot(14*28, 8*32, room)); - } - { // Room 6, Chip Factory - Room room = (Room) rooms.elementAt(6); - int[][] table = { - {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,12,12,12,12, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,12,12,12,12, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,12,12,12,12, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} - }; - room.RoomArray = table; - room.AddTextBox("Chip Factory", 2*28, 2*32, 500); - room.AddTextBox("Press for Prototype", 5*28, 9*32+18, 500); - room.AddTextBox("Press for Small Chip", 5*28, 10*32+18, 500); - room.AddTextBox("TRASH", 16*28-2, 9*32, 500); - room.AddArrow(3*28+14,9*32+12, Arrow.DIR_LEFT, 28, Color.white); - room.AddArrow(3*28+14,10*32+12, Arrow.DIR_LEFT, 28, Color.white); - items.addElement(new PCButton(2*28, 9*32, room)); - items.addElement(new Factory(2*28, 10*32, room, new SmallChip(0,0,null,"X"))); - items.addElement(new PC16Button(18*28,1*32,room)); - items.addElement(new PC32Button(18*28,2*32,room)); - room.AddTextBox("16 Pin", 15*28, 1*32+14, 500); - room.AddTextBox("32 Pin", 15*28, 2*32+14, 500); - } - { // Room 7, Sensor & Object Factory - Room room = (Room) rooms.elementAt(7); - int[][] table = { - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1,12,12,12, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1,12,12,12, 1, 0, 0, 6, 0, 0, 7, 0, 0, 8, 0, 0, 9, 0, 0, 1}, - {1,12,12,12, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} - }; - room.RoomArray = table; +import java.awt.*; + +class ROLab extends Level { + public ROLab(RoomDisplay rd) { + super(rd); + + // Material 0, Blank + materials.addElement(new Material(true, false)); + // Material 1, LightBlue Wall + materials.addElement(new Material(new Color(192, 192, 255), false, true)); + // Material 2, LightOrange Wall + materials.addElement(new Material(new Color(255, 224, 192), false, true)); + // Material 3, Red Wall + materials.addElement(new Material(new Color(255, 0, 0), false, true)); + // Material 4, Green Wall + materials.addElement(new Material(new Color(0, 255, 0), false, false)); + // Material 5, CrystalRecharger + materials.addElement(new CrystalRecharger()); + // Material 6, Crystal Shape Editor + materials.addElement(new ShapeEditor(new Crystal(0, 0, null, 0))); + // Material 7, Hexagon Shape Editor + materials.addElement(new ShapeEditor(new Hexagon(0, 0, null, Color.blue))); + // Material 8, Square Shape Editor + materials.addElement(new ShapeEditor(new Square(0, 0, null, Color.white))); + // Material 9, Triangle Shape Editor + materials.addElement(new ShapeEditor(new Triangle(0, 0, null, new Color(255, 128, 0)))); + // Material 10, PrototypeBurner + materials.addElement(new PrototypeBurner()); + // Material 11, SmallChipBurner + materials.addElement(new SmallChipBurner()); + // Material 12, ChipTrash + materials.addElement(new ChipTrash()); + // Material 13, ChipTester + materials.addElement(new ChipTester()); + // Material 14, Lock + int[][] lockProgram = { + {Lock.NARROW}, + {0, 1, 1, 19, 1, 1}, + {0, 2, 1, 19, 2, 1}, + {0, 3, 1, 19, 3, 1}, + {Lock.NARROW}, + {0, 3, 0, 19, 3, 0}, + {0, 2, 0, 19, 2, 0}, + {0, 1, 0, 19, 1, 0}, + }; + materials.addElement(new Lock(new Color(192, 192, 255), Color.white, lockProgram)); + // Materials 15, MazeLock + materials.addElement(new MazeLock()); + + + for (int a = 0; a < 18; a++) { + rooms.addElement(new Room()); + } + + { // Room 0, Help Screen + Room room = rooms.elementAt(0); + room.RoomArray = new int[][]{ + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} + }; + room.AddTextBox("Use the Innovation Lab to design and test circuits in robots and the large prototype chip.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Burn a small chip from your prototype chip in the burn room.", + 2 * 28, 5 * 32, 500); + room.AddTextBox("Change maze walls with the paint brush. Change sensor bodies and maze objects in the Shape Editor.", + 2 * 28, 7 * 32, 500); + room.AddTextBox("For help, see Tutorials.", + 2 * 28, 10 * 32, 500); + room.AddTextBox("(To go to Lab, press Return.)", + 4 * 28, 11 * 32, 500); + } + { // Room 1, Chip Testing Room + Room room = rooms.elementAt(1); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 1, 13, 13, 13, 13, 13, 13, 1, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 1, 13, 13, 13, 13, 13, 13, 1, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 1, 13, 13, 13, 13, 13, 13, 1, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 1, 13, 13, 13, 13, 13, 13, 1, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 1, 13, 13, 13, 13, 13, 13, 1, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} + }; + room.AddTextBox("{000,000,000} Chip Tester", (560 - (11 * 12)) / 2, 32 + 24, 500); + PortDevice[] portdevices = new PortDevice[8]; + portdevices[0] = new PortDevice(6 * 28 + 4, 3 * 32 + 4, room, 28, Port.TYPE_UNDEFINED); + portdevices[1] = new PortDevice(6 * 28 + 4, 4 * 32 + 4, room, 28, Port.TYPE_UNDEFINED); + portdevices[2] = new PortDevice(6 * 28 + 4, 5 * 32 + 4, room, 28, Port.TYPE_UNDEFINED); + portdevices[3] = new PortDevice(6 * 28 + 4, 6 * 32 + 4, room, 28, Port.TYPE_UNDEFINED); + portdevices[4] = new PortDevice(12 * 28 + 4, 6 * 32 + 4, room, 28, Port.TYPE_UNDEFINED); + portdevices[5] = new PortDevice(12 * 28 + 4, 5 * 32 + 4, room, 28, Port.TYPE_UNDEFINED); + portdevices[6] = new PortDevice(12 * 28 + 4, 4 * 32 + 4, room, 28, Port.TYPE_UNDEFINED); + portdevices[7] = new PortDevice(12 * 28 + 4, 3 * 32 + 4, room, 28, Port.TYPE_UNDEFINED); + portdevices[0].rotate(1); + portdevices[1].rotate(1); + portdevices[2].rotate(1); + portdevices[3].rotate(1); + portdevices[4].rotate(-1); + portdevices[5].rotate(-1); + portdevices[6].rotate(-1); + portdevices[7].rotate(-1); + for (int a = 0; a < 8; a++) { + items.addElement(portdevices[a]); + } + items.addElement(new AutoWire(2 * 28, 10 * 32, room)); + items.addElement(new WireTester(5 * 28, 3 * 32, room, portdevices[0])); + items.addElement(new WireTester(5 * 28, 4 * 32, room, portdevices[1])); + items.addElement(new WireTester(5 * 28, 5 * 32, room, portdevices[2])); + items.addElement(new WireTester(5 * 28, 6 * 32, room, portdevices[3])); + items.addElement(new WireTester(14 * 28 + 2, 6 * 32, room, portdevices[4])); + items.addElement(new WireTester(14 * 28 + 2, 5 * 32, room, portdevices[5])); + items.addElement(new WireTester(14 * 28 + 2, 4 * 32, room, portdevices[6])); + items.addElement(new WireTester(14 * 28 + 2, 3 * 32, room, portdevices[7])); + room.AddArrow(3 * 28, 10 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + room.AddTextBox("Autowirer", 4 * 28, 11 * 32 - 8, 200); + } + { // Room 2, Storage Space 1 + Room room = rooms.elementAt(2); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} + }; + room.AddTextBox("Storage Space", 2 * 28, 2 * 32, 500); + } + { // Room 3, Storage Space 2 + Room room = rooms.elementAt(3); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} + }; + } + { // Room 4, Burner Room + Room room = rooms.elementAt(4); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 10, 10, 10, 10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 10, 10, 10, 10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 2, 10, 10, 10, 10, 2, 0, 0, 0, 2, 11, 11, 2, 0, 0, 0, 0, 0}, + {2, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 11, 11, 2, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Burner Room", 2 * 28, 2 * 32, 200); + room.AddTextBox("1x", 15 * 28 - 14, 11 * 32 - 8, 100); + items.addElement(new SpeedControl(15 * 28, 7 * 32, room, SpeedControl.DIR_UP)); + items.addElement(new SpeedControl(15 * 28, 9 * 32, room, SpeedControl.DIR_DOWN)); + items.addElement(new SmallChip(12 * 28, 1 * 32 + 16, room, "1")); + items.addElement(new SmallChip(14 * 28, 1 * 32 + 16, room, "2")); + items.addElement(new SmallChip(16 * 28, 1 * 32 + 16, room, "3")); + items.addElement(new SmallChip(18 * 28, 1 * 32 + 16, room, "4")); + items.addElement(new SmallChip(12 * 28, 3 * 32, room, "5")); + items.addElement(new SmallChip(14 * 28, 3 * 32, room, "6")); + items.addElement(new SmallChip(16 * 28, 3 * 32, room, "7")); + items.addElement(new SmallChip(18 * 28, 3 * 32, room, "8")); + items.addElement(new Burner(18 * 28, 10 * 32 + 2, room)); + items.addElement(new UnBurner(2 * 28, 10 * 32 + 2, room)); + room.AddTextBox("{000,000,000} Unburner", 1 * 28, 12 * 32 - 8, 200); + room.AddTextBox("{000,000,000} Burner", 17 * 28, 12 * 32 - 8, 200); + } + { // Room 5, Title Room + Room room = rooms.elementAt(5); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} + }; + room.AddTextBox("{BIG} Innovation Lab", 3 * 28, 2 * 32, 600); + items.addElement(new PrototypeChip(8 * 28, 4 * 32, room)); + items.addElement(new BlueRobot(4 * 28, 8 * 32, room)); + items.addElement(new WhiteRobot(9 * 28, 8 * 32, room)); + items.addElement(new OrangeRobot(14 * 28, 8 * 32, room)); + } + { // Room 6, Chip Factory + Room room = rooms.elementAt(6); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 12, 12, 12, 12, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 12, 12, 12, 12, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 12, 12, 12, 12, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + room.AddTextBox("Chip Factory", 2 * 28, 2 * 32, 500); + room.AddTextBox("Press for Prototype", 5 * 28, 9 * 32 + 18, 500); + room.AddTextBox("Press for Small Chip", 5 * 28, 10 * 32 + 18, 500); + room.AddTextBox("TRASH", 16 * 28 - 2, 9 * 32, 500); + room.AddArrow(3 * 28 + 14, 9 * 32 + 12, Arrow.DIR_LEFT, 28, Color.white); + room.AddArrow(3 * 28 + 14, 10 * 32 + 12, Arrow.DIR_LEFT, 28, Color.white); + items.addElement(new PCButton(2 * 28, 9 * 32, room)); + items.addElement(new Factory(2 * 28, 10 * 32, room, new SmallChip(0, 0, null, "X"))); + items.addElement(new PC16Button(18 * 28, 1 * 32, room)); + items.addElement(new PC32Button(18 * 28, 2 * 32, room)); + room.AddTextBox("16 Pin", 15 * 28, 1 * 32 + 14, 500); + room.AddTextBox("32 Pin", 15 * 28, 2 * 32 + 14, 500); + } + { // Room 7, Sensor & Object Factory + Room room = rooms.elementAt(7); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 12, 12, 12, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 12, 12, 12, 1, 0, 0, 6, 0, 0, 7, 0, 0, 8, 0, 0, 9, 0, 0, 1}, + {1, 12, 12, 12, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + + Triangle t = new Triangle(0, 0, null, new Color(255, 128, 0)); + items.addElement(new Factory(2 * 28, 3 * 32, room, t)); + items.addElement(new Factory(5 * 28, 3 * 32, room, + new ContactSensor(0, 0, null, t))); + items.addElement(new Factory(8 * 28, 3 * 32, room, + new RoomSensor(0, 0, null, t))); + items.addElement(new Factory(12 * 28, 3 * 32, room, + new DirectionalSensor(0, 0, null, t))); + + room.AddTextBox("Sensor & Object Factory", 142, 2 * 32 - 8, 500); + room.AddTextBox("Shape Editor Icons", 228, 8 * 32, 400); + room.AddTextBox("TRASH", 40, 9 * 32, 400); - Triangle t = new Triangle(0,0, null, new Color(255,128,0)); - items.addElement(new Factory(2*28, 3*32, room, t)); - items.addElement(new Factory(5*28, 3*32, room, - new ContactSensor(0,0,null, t))); - items.addElement(new Factory(8*28, 3*32, room, - new RoomSensor(0,0,null, t))); - items.addElement(new Factory(12*28, 3*32, room, - new DirectionalSensor(0,0,null,t))); - - room.AddTextBox("Sensor & Object Factory", 142, 2*32-8, 500); - room.AddTextBox("Shape Editor Icons", 228, 8*32, 400); - room.AddTextBox("TRASH", 40, 9*32, 400); - // items.addElement(new Crystal(2*28,10*32,room,100000)); // items.addElement(new Crystal(5*28,10*32,room,100000)); // items.addElement(new Square(8*28,10*32,room,Color.white)); @@ -347,259 +303,250 @@ public ROLab(RoomDisplay rd) // items.addElement(new DirectionalSensor(2*28,6*32,room,new Hexagon(0,0,null,Color.white))); // items.addElement(new DirectionalSensor(8*28,6*32,room,new Triangle(0,0,null,Color.white))); // items.addElement(new DirectionalSensor(14*28,6*32,room,new Square(0,0,null,Color.white))); - } - { // Room 8, Recharger Room - Room room = (Room) rooms.elementAt(8); - int[][] table = { - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,14}, - {1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table; - room.AddTextBox("To Maze", 2*28, 11*32, 200); - room.AddArrow(28+14,12*32-1, Arrow.DIR_DOWN, 32, Color.white); - room.AddArrow(28+14,12*32-1, Arrow.DIR_DOWN, 32, Color.white); - items.addElement(new Key(15*28+16, 10*32+12, room, Color.white)); - } - { // Room 9, Maze Control Room - Room room = (Room) rooms.elementAt(9); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table; - room.AddTextBox("Maze Control Room", 178, 2*32, 300); - room.AddTextBox("4x2", 262, 5*32+24, 500); - items.addElement(new MazeControl(9*28+14,3*32+6,room,MazeControl.DIR_UP)); - items.addElement(new MazeControl(9*28+14,7*32,room,MazeControl.DIR_DOWN)); - items.addElement(new MazeControl(7*28+2,5*32+4,room,MazeControl.DIR_LEFT)); - items.addElement(new MazeControl(12*28,5*32+4,room,MazeControl.DIR_RIGHT)); - items.addElement(new MazeCreator(2*28, 10*32, room)); - room.AddArrow(3*28+14,10*32+12, Arrow.DIR_LEFT, 28, Color.white); - room.AddTextBox("Press to resize Maze", 5*28, 10*32+18, 500); - room.AddArrow(18*28,10*32, Arrow.DIR_DOWN, 28, Color.white); - room.AddTextBox("Lock", 17*28+14, 9*32, 100); - } - { // Room 10, Maze Top Far Left - Room room = (Room) rooms.elementAt(10); - int[][] table = { - {3,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {3,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.editable=true; - } - { // Room 11, Maze Top Near Left - Room room = (Room) rooms.elementAt(11); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.editable=true; - } - { // Room 12, Maze Top Near Right - Room room = (Room) rooms.elementAt(12); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.editable=true; - } - { // Room 13, Maze Top Far Right - Room room =(Room) rooms.elementAt(13); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,3} - }; - room.RoomArray = table; - room.editable=true; - } - { // Room 14, Maze Bot Far Left - Room room = (Room) rooms.elementAt(14); - int[][] table = { - {3,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.editable=true; - } - { // Room 15, Maze Bot Near Left - Room room = (Room) rooms.elementAt(15); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.editable=true; - } - { // Room 16, Maze Bot Near Right - Room room = (Room) rooms.elementAt(16); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.editable=true; - } - { // Room 17, Maze Bot Far Right - Room room = (Room) rooms.elementAt(17); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.editable=true; - } - - // 00=Help - // - // 01-02-03 - // 04-05-06 - // 07-08-09 - // - // 10+ = Maze - // 10-11-12-13 - // 14-15-16-17 - - // 15-16-17 - // 00-01-14 - // 02-03-04 - // - // 05-06-07-08 - // 09-10-11-12 + } + { // Room 8, Recharger Room + Room room = rooms.elementAt(8); + room.RoomArray = new int[][]{ + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 14}, + {1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + room.AddTextBox("To Maze", 2 * 28, 11 * 32, 200); + room.AddArrow(28 + 14, 12 * 32 - 1, Arrow.DIR_DOWN, 32, Color.white); + room.AddArrow(28 + 14, 12 * 32 - 1, Arrow.DIR_DOWN, 32, Color.white); + items.addElement(new Key(15 * 28 + 16, 10 * 32 + 12, room, Color.white)); + } + { // Room 9, Maze Control Room + Room room = rooms.elementAt(9); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + room.AddTextBox("Maze Control Room", 178, 2 * 32, 300); + room.AddTextBox("4x2", 262, 5 * 32 + 24, 500); + items.addElement(new MazeControl(9 * 28 + 14, 3 * 32 + 6, room, MazeControl.DIR_UP)); + items.addElement(new MazeControl(9 * 28 + 14, 7 * 32, room, MazeControl.DIR_DOWN)); + items.addElement(new MazeControl(7 * 28 + 2, 5 * 32 + 4, room, MazeControl.DIR_LEFT)); + items.addElement(new MazeControl(12 * 28, 5 * 32 + 4, room, MazeControl.DIR_RIGHT)); + items.addElement(new MazeCreator(2 * 28, 10 * 32, room)); + room.AddArrow(3 * 28 + 14, 10 * 32 + 12, Arrow.DIR_LEFT, 28, Color.white); + room.AddTextBox("Press to resize Maze", 5 * 28, 10 * 32 + 18, 500); + room.AddArrow(18 * 28, 10 * 32, Arrow.DIR_DOWN, 28, Color.white); + room.AddTextBox("Lock", 17 * 28 + 14, 9 * 32, 100); + } + { // Room 10, Maze Top Far Left + Room room = rooms.elementAt(10); + room.RoomArray = new int[][]{ + {3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.editable = true; + } + { // Room 11, Maze Top Near Left + Room room = rooms.elementAt(11); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.editable = true; + } + { // Room 12, Maze Top Near Right + Room room = rooms.elementAt(12); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.editable = true; + } + { // Room 13, Maze Top Far Right + Room room = rooms.elementAt(13); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3} + }; + room.editable = true; + } + { // Room 14, Maze Bot Far Left + Room room = rooms.elementAt(14); + room.RoomArray = new int[][]{ + {3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.editable = true; + } + { // Room 15, Maze Bot Near Left + Room room = rooms.elementAt(15); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.editable = true; + } + { // Room 16, Maze Bot Near Right + Room room = rooms.elementAt(16); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.editable = true; + } + { // Room 17, Maze Bot Far Right + Room room = rooms.elementAt(17); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.editable = true; + } - int[][] roomgrid1={ - {1,2,3}, - {4,5,6}, - {7,8,9} - }; - LinkRoomsGrid(roomgrid1); - - LinkRoomsLeftRight(6,4); - - int[][] roomgrid2={ - {10,11,12,13}, - {14,15,16,17} - }; - LinkRoomsGrid(roomgrid2); - - LinkRoomsUpDown(8,10); - - gameCursor = new LabCursor(9*28+14,9*32+16,(Room) rooms.elementAt(5)); - solderingPen = new SolderingPen(); - remote = new Remote(); - toolbox = new ToolBox(7*28,10*32, (Room) rooms.elementAt(8)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - items.addElement(toolbox); ((ToolBox)toolbox).Toggle(); - paintbrush = new PaintBrush(); - items.addElement(paintbrush); - items.addElement(gameCursor); - items.addElement(solderingPen); - items.addElement(remote); - items.addElement(helpCam); - player = gameCursor; - currentViewer = player; - } + // 00=Help + // + // 01-02-03 + // 04-05-06 + // 07-08-09 + // + // 10+ = Maze + // 10-11-12-13 + // 14-15-16-17 + + // 15-16-17 + // 00-01-14 + // 02-03-04 + // + // 05-06-07-08 + // 09-10-11-12 + + int[][] roomgrid1 = { + {1, 2, 3}, + {4, 5, 6}, + {7, 8, 9} + }; + LinkRoomsGrid(roomgrid1); + + LinkRoomsLeftRight(6, 4); + + int[][] roomgrid2 = { + {10, 11, 12, 13}, + {14, 15, 16, 17} + }; + LinkRoomsGrid(roomgrid2); + + LinkRoomsUpDown(8, 10); + + gameCursor = new LabCursor(9 * 28 + 14, 9 * 32 + 16, rooms.elementAt(5)); + solderingPen = new SolderingPen(); + remote = new Remote(); + toolbox = new ToolBox(7 * 28, 10 * 32, rooms.elementAt(8)); + helpCam = new HelpCam(rooms.elementAt(0)); + items.addElement(toolbox); + ((ToolBox) toolbox).Toggle(); + paintbrush = new PaintBrush(); + items.addElement(paintbrush); + items.addElement(gameCursor); + items.addElement(solderingPen); + items.addElement(remote); + items.addElement(helpCam); + player = gameCursor; + currentViewer = player; + } } diff --git a/src/com/droidquest/levels/ROTut1.java b/src/com/droidquest/levels/ROTut1.java index b20dfea..28ba98e 100644 --- a/src/com/droidquest/levels/ROTut1.java +++ b/src/com/droidquest/levels/ROTut1.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.Wire; @@ -10,663 +8,650 @@ import com.droidquest.avatars.HelpCam; import com.droidquest.chipstuff.Port; import com.droidquest.decorations.Arrow; import com.droidquest.decorations.Graphix; -import com.droidquest.devices.Antenna; -import com.droidquest.devices.ContactSensor; -import com.droidquest.devices.Device; -import com.droidquest.devices.DirectionalSensor; -import com.droidquest.devices.NOTGate; -import com.droidquest.devices.PortDevice; -import com.droidquest.devices.RoomSensor; -import com.droidquest.items.BlueRobot; -import com.droidquest.items.Crystal; -import com.droidquest.items.GenericRobot; -import com.droidquest.items.Item; -import com.droidquest.items.Key; -import com.droidquest.items.OrangeRobot; -import com.droidquest.items.SentryT1; -import com.droidquest.items.Square; -import com.droidquest.items.Triangle; -import com.droidquest.items.WhiteRobot; +import com.droidquest.devices.*; +import com.droidquest.items.*; import com.droidquest.materials.CrystalRecharger; import com.droidquest.materials.Lock; import com.droidquest.materials.Material; import com.droidquest.materials.Portal; -class ROTut1 extends Level -{ -public ROTut1(RoomDisplay rd) - { - super(rd); - - // Material 0, Blank - materials.addElement(new Material(true, false)); - // Material 1, LightBlue Wall - materials.addElement(new Material(new Color(192,192,255),false, true)); - // Material 2, Green Wall - materials.addElement(new Material(new Color(0,255,0),false, true)); - // Material 3, Orange Wall - materials.addElement(new Material(new Color(255,128,0),false, true)); - // Material 4, LightOrange Wall - materials.addElement(new Material(new Color(255,224,192),false, true)); - // Material 5, CrystalRecharger - materials.addElement(new CrystalRecharger()); - // Material 6, Blue Wall - materials.addElement(new Material(new Color(0,0,255),false, true)); - // Material 7, LockT1 - int[][] lockProgram = { - {Lock.NARROW}, - {12,10,0 }, - {12,9,0, 12,6,1}, - {12,8,0, 12,5,1}, - {Lock.NARROW}, - {12,5,0, 12,8,1}, - {12,6,0, 12,9,1}, - {12,10,1}, - }; - materials.addElement(new Lock(Color.white, Color.blue, lockProgram)); - // Material 8, Portal to Tutorial 2; - materials.addElement(new Portal("ROTut2.lvl",false, true)); - // Material 9, Portal to Main Menu; - materials.addElement(new Portal("MainMenu.lvl",false, true)); +import java.awt.*; - for (int a=0; a<34; a++) - rooms.addElement(new Room()); +class ROTut1 extends Level { + public ROTut1(RoomDisplay rd) { + super(rd); - { // Room 0, Help Screen - Room room = (Room) rooms.elementAt(0); - room.SetMaterialOutline(0,0,19,11,2); - room.AddTextBox("Use the Menubar above to turn sound on or off, or to return to the Main Menu level", 2*28, 4*32, 450); - room.AddTextBox("Press ? to get help or hints", 2*28, 8*32, 500); - room.AddTextBox("To continue, press RETURN", 4*28, 10*32, 500); - } - { // Room 1, Title Screen - Room room = (Room) rooms.elementAt(1); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(19,5,19,7,0); - room.SetMaterial(0,10,0); - room.AddTextBox("{BIG} ROBOT ANATOMY", 4*28, 2*32, 500); - room.AddTextBox("In ROBOT ANATOMY, you will learn how to move, how to handle objects, and how robots ", - 2*28, 3*32, 500); - room.AddTextBox("- Move", 6*28, 5*32, 500); - room.AddTextBox("- Send Signals", 6*28, 6*32, 500); - room.AddTextBox("- Grab Objects", 6*28, 7*32, 500); - room.AddTextBox("- Detect Objects", 6*28, 8*32, 500); - room.AddTextBox("Follow the Arrows", 6*28, 10*32, 500); - room.AddArrow(559,6*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 2, Movement - Room room = (Room) rooms.elementAt(2); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialFill(0,5,19,7,0); - room.AddTextBox("You can move the cursor using the Arrow keys on your keyboard, or by clicking anywhere on the screen with the mouse.", - 2*28, 2*32, 500); - room.AddTextBox("Click here", 3*28, 8*32, 500); - room.AddArrow(5*28,6*32+16, Arrow.DIR_UP, 28, Color.white) ; - room.AddTextBox("Double-Click here", 12*28+14, 8*32, 160); - room.AddArrow(15*28,6*32+16, Arrow.DIR_UP, 28, Color.white) ; - room.AddArrow(559,6*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 3, Movement 2 - Room room = (Room) rooms.elementAt(3); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialFill(0,5,19,7,0); - room.AddTextBox("Double-Clicking the mouse on one side of the cursor starts your cursor moving in that direction until it reaches a wall or the next room.", - 2*28, 2*32, 500); - room.AddArrow(559,6*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 4, Pick up Key - Room room = (Room) rooms.elementAt(4); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,5,0,7,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("You can pick up and drop objects.", - 2*28, 2*32, 500); - room.AddTextBox("To pick up an object, move on top of it and press the SPACEBAR (or Right-Click the mouse).", - 2*28, 3*32, 500); - room.AddTextBox("Pick up this key and move it around. To drop it, press the SPACEBAR again.", - 2*28, 8*32, 500); - room.AddTextBox("Take the Key with you", - 6*28, 10*32+16, 500); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - items.addElement(new Key(9*28, 5*32, room, Color.blue)); - } - { // Room 5, Locked Sentry - Room room = (Room) rooms.elementAt(5); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterialOutline(8,11,11,11,0); - room.SetMaterialOutline(12,7,19,11,1); - room.SetMaterial(12,7,7); - room.AddTextBox("You can move in small steps. Press the control key and the cursor keys at the same time.", - 2*28, 2*32, 500); - room.AddTextBox("This sentry is trapped.", - 2*28, 4*32+16, 500); - room.AddTextBox("To let it out, hold the key by the HANDLE. Use small steps to put the key in the lock.", - 2*28, 6*32, 500); - room.AddArrow(10*28, 383, Arrow.DIR_DOWN, 28, Color.white) ; - items.addElement(new SentryT1(17*28, 9*32+16, room)); - } - { // Room 6, Blue Robot - Room room = (Room) rooms.elementAt(6); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(8,0,11,0,0); - room.SetMaterialOutline(16,11,18,11,0); - room.AddTextBox("This is a robot. You can go inside it.", - 2*28, 2*32, 350); - room.AddTextBox("To go inside, line yourself up with one of the robot's white BUMPERS and move in slowly. It may take a few tries.", - 2*28, 4*32, 350); - room.AddTextBox("Go inside and explore.", - 2*28, 9*32, 350); - room.AddTextBox("Come back and take the robot with you.", - 2*28, 10*32, 350); - room.AddArrow(17*28+14, 383, Arrow.DIR_DOWN, 28, Color.white); - room.AddTextBox("BUMPER", - 15*28, 4*32+16, 350); - room.AddArrow(15*28+2, 3*32+2, Arrow.DIR_UP, 28, Color.white); - GenericRobot robot = new BlueRobot(15*28,2*32,room); - items.addElement(robot); - { - robot.charge = 0; - robot.thrusterPower=true; - Wire dummy; - dummy = new Wire(((GenericRobot)robot).devices[7].ports[0], - ((GenericRobot)robot).devices[0].ports[0]); - dummy = new Wire(((GenericRobot)robot).devices[1].ports[0], - ((GenericRobot)robot).devices[4].ports[0]); - dummy = new Wire(((GenericRobot)robot).devices[3].ports[0], - ((GenericRobot)robot).devices[6].ports[0]); - dummy = new Wire(((GenericRobot)robot).devices[5].ports[0], - ((GenericRobot)robot).devices[2].ports[0]); - robot.InternalRoom.AddTextBox("GRABBER", 7*28, 2*32+20, 100); - robot.InternalRoom.AddTextBox("ANTENNA", 7*28, 4*32-8, 100); - robot.InternalRoom.AddTextBox("BUMPER", 3*28, 6*32, 100); - robot.InternalRoom.AddTextBox("BATTERY", 6*28, 9*32+24, 100); - robot.InternalRoom.AddTextBox("SWITCH", 13*28+8, 10*32-8, 100); - robot.InternalRoom.AddTextBox("THRUSTER", 14*28, 5*32, 100); - robot.InternalRoom.AddTextBox("EYE", 13*28, 3*32, 100); - robot.InternalRoom.AddArrow(6*28, 3*32-16, Arrow.DIR_LEFT, 28, Color.white) ; - robot.InternalRoom.AddArrow(4*28+14, 4*32-16, Arrow.DIR_LEFT, 28, Color.white) ; - robot.InternalRoom.AddArrow(2*28+14, 5*32, Arrow.DIR_UP, 28, Color.white) ; - robot.InternalRoom.AddArrow(4*28+14, 10*32-16, Arrow.DIR_LEFT, 28, Color.white) ; - robot.InternalRoom.AddArrow(16*28+16, 10*32-16, Arrow.DIR_RIGHT, 28, Color.white) ; - robot.InternalRoom.AddArrow(18*28, 5*32+8, Arrow.DIR_UP, 28, Color.white) ; - robot.InternalRoom.AddArrow(16*28, 3*32-8, Arrow.DIR_RIGHT, 28, Color.white) ; - } - } - { // Room 7, Alternate Entry - Room room = (Room) rooms.elementAt(7); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialFill(16,0,18,11,0); - room.AddTextBox("You can also enter the robot by moving the cursor so it overlaps the robot, and then pressing E.", - 2*28, 2*32, 350); - room.AddTextBox("Once inside, you can exit by pressing E again.", - 2*28, 6*32, 350); - } - { // Room 8, Periscope - Room room = (Room) rooms.elementAt(8); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialFill(16,0,18,11,0); - room.AddTextBox("You can be inside the robot and still see outside.", - 2*28, 2*32, 350); - room.AddTextBox("Go inside the robot. Sit on the robot's EYE to activate its periscope.", - 2*28, 4*32, 350); - room.AddTextBox("Move off the eye to see inside the robot again.", - 2*28, 6*32, 350); - room.AddTextBox("Come outside.", - 2*28, 9*32, 350); - room.AddTextBox("Take the robot with you through the next few rooms.", - 2*28, 10*32, 350); - room.AddArrow(17*28+14, 383, Arrow.DIR_DOWN, 28, Color.white) ; - } - { // Room 9, Triangle - Room room = (Room) rooms.elementAt(9); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialFill(16,0,18,0,0); - room.SetMaterialFill(19,5,19,7,0); - room.AddTextBox("You can put things inside robots. You can even put robots inside robots!", - 2*28, 2*32, 400); - room.AddTextBox("Pick up the triangle. Carry it inside the robot. Drop it and come outside.", - 2*28, 9*32, 400); - room.AddArrow(559, 6*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - items.addElement(new Triangle(9*28, 6*32, room, new Color(255,128,0))); - } - { // Room 10, Input - Room room = (Room) rooms.elementAt(10); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,0,3,3,1); - room.SetMaterialFill(0,5,19,8,0); - room.AddTextBox("This is an INPUT.", - 5*28, 2*32, 400); - room.AddTextBox("Some robot parts connect to inputs. Go inside the robot and see.", - 5*28, 3*32, 400); - room.AddTextBox("When electricity flows IN to an input, it turns on the robot part.", - 2*28, 8*32, 500); - room.AddTextBox("You can see electricity flow. It is orange.", - 2*28, 10*32, 500); - room.AddArrow(559, 6*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - PortDevice pd=new PortDevice(2*28-8,24,room, 24, Port.TYPE_INPUT); - items.addElement(pd); - pd.rotate(1); pd.rotate(1); - } - { // Room 11, Output - Room room = (Room) rooms.elementAt(11); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,0,3,3,1); - room.SetMaterialFill(0,5,19,8,0); - room.AddTextBox("This is an OUTPUT.", - 5*28, 2*32, 400); - room.AddTextBox("Some robot parts connect to outputs. Go inside the robot and see.", - 5*28, 3*32, 400); - room.AddTextBox("When a robot part is activated, electricity flows OUT of its output.", - 2*28, 9*32, 500); - room.AddArrow(559, 6*32+16, Arrow.DIR_RIGHT, 32, Color.white) ; - PortDevice pd=new PortDevice(2*28-8,20,room, 24, Port.TYPE_OUTPUT); - items.addElement(pd); - pd.rotate(1); pd.rotate(1); - } - { // Room 12, Bumper - Room room = (Room) rooms.elementAt(12); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,5,0,8,0); - room.SetMaterialOutline(16,11,18,11,0); - room.AddTextBox("When a robot touches a wall, its bumper beeps and turns orange with electricity. Inside the robot, the bumper's OUTPUT turns on too.", - 2*28, 2*32, 450); - room.AddTextBox("Try it and see what happens.", - 2*28, 5*32, 450); - room.AddArrow(17*28+14, 383, Arrow.DIR_DOWN, 28, Color.white) ; - } - { // Room 13, Thrusters - Room room = (Room) rooms.elementAt(13); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(16,0,18,0,0); - room.SetMaterialOutline(14,11,16,11,0); - room.AddTextBox("Inside a robot are four THRUSTERS.", - 2*28, 2*32, 350); - room.AddTextBox("You can propel robots by making electricity flow into the thrusters' INPUTS.", - 2*28, 4*32, 350); - room.AddTextBox("There is also a BATTERY inside the robot.", - 2*28, 7*32, 300); - room.AddTextBox("This robot can't move because its battery is dead.", - 2*28, 9*32, 300); - room.AddArrow(15*28+14, 383, Arrow.DIR_DOWN, 28, Color.white) ; - } - { // Room 14, Crystal - Room room = (Room) rooms.elementAt(14); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialOutline(14,0,16,0,0); - room.SetMaterialOutline(19,4,19,6,0); - room.AddTextBox("Use this ENERGY CRYSTAL to recharge dead batteries.", - 2*28, 2*32, 250); - room.AddTextBox("Take it inside the robot. Pass it over the battery. Notice how the battery level fills with electricity.", - 2*28, 4*32+16, 350); - room.AddTextBox("The crystal goes dead (white) as its electricity drains.", - 2*28, 8*32, 500); - room.AddTextBox("Drop the crystal in the robot. Take the robot with you.", - 2*28, 10*32, 450); - room.AddArrow(559, 5*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - items.addElement(new Crystal(12*28,2*32, room,100000)); - } - { // Room 15, Crystal Recharger - Room room = (Room) rooms.elementAt(15); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialOutline(16,11,18,11,0); - room.SetMaterialOutline(0,4,0,6,0); - room.SetMaterial(17,2,5); - room.AddTextBox("Use this CRYSTAL RECHARGER to recharge energy crystals.", - 2*28, 2*32, 350); - room.AddTextBox("Bring the dead energy crystal outside. Pass it over the recharger. Watch it fill with electricity.", - 2*28, 7*32, 400); - room.AddTextBox("Continue to take the robot with you.", - 2*28, 10*32, 350); - room.AddArrow(17*28+14, 383, Arrow.DIR_DOWN, 28, Color.white) ; - } - { // Room 16, Thruster Demo - Room room = (Room) rooms.elementAt(16); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialFill(16,0,18,11,0); - room.AddTextBox("START", - 13*28+14, 52, 350); - room.AddArrow(13*28, 32, Arrow.DIR_UP, 28, Color.white) ; - room.AddTextBox("Move the robot so ONLY its top bumper touches the top wall. Drop it.", - 4*28, 4*32, 350); - room.AddTextBox("When the robot touches a wall, electricity flows from its bumper to the thruster, propelling the robot.", - 4*28, 7*32, 350); - room.AddArrow(17*28+14, 383, Arrow.DIR_DOWN, 28, Color.white) ; - } - { // Room 17, Thruster Talk - Room room = (Room) rooms.elementAt(17); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialFill(16,0,18,11,0); - room.AddTextBox("A thruster moves a robot in the direction opposite its thrust.", - 2*28, 3*32, 400); - room.AddTextBox("When the left thruster is on, the robot moves RIGHT.", - 2*28, 5*32, 400); - room.AddTextBox("When the right thruster is on, the robot moves LEFT.", - 2*28, 7*32, 400); - room.AddTextBox("What happens when the top or bottom thruster is on?", - 2*28, 9*32, 400); - room.AddArrow(17*28+14, 383, Arrow.DIR_DOWN, 28, Color.white) ; - } - { // Room 18, Switch - Room room = (Room) rooms.elementAt(18); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialFill(16,0,18,0,0); - room.SetMaterialFill(0,5,0,7,0); - room.AddTextBox("The SWITCH inside a robot turns electricity flow to the thrusters on or off.", - 2*28, 2*32, 400); - room.AddTextBox("Go inside and sit on the switch. Press SPACEBAR to open and close it.", - 2*28, 5*32, 400); - room.AddTextBox("Thrusters work when the switch is closed (orange). Open the switch to save batteries.", - 2*28, 8*32, 450); - room.AddTextBox("Leave the robot here.", - 2*28, 11*32, 350); - room.AddArrow(0, 6*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - } - { // Room 19, Antenna Input - Room room = (Room) rooms.elementAt(19); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(0,0,4,5,4); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterialOutline(19,5,19,7,0); - room.AddTextBox("The ANTENNA control inside a robot controls the antenna outside.", - 6*28, 2*32, 400); - room.AddTextBox("When its INPUT is on, the robot's antenna sends signals to other robots, wherever they may be.", - 6*28, 5*32, 400); - room.AddArrow(0, 9*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - Antenna ant = new Antenna(2*28-12,2*32, room, Color.white); - PortDevice pd = new PortDevice(18, 4*32, room, 28, Port.TYPE_OUTPUT); - items.addElement(ant); - items.addElement(pd); - pd.value=true; - pd.rotate(1); - Wire dummy = new Wire(pd.ports[0], ant.ports[0]); - } - { // Room 20, Antenna Output - Room room = (Room) rooms.elementAt(20); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(0,0,4,4,4); - room.SetMaterialOutline(0,5,0,7,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("When a robot's antenna receives signals, the antenna control's OUTPUT turns on.", - 6*28, 2*32, 350); - room.AddArrow(0, 6*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - items.addElement(new Antenna(2*28-12, 2*32, room, Color.white)); - } - { // Room 21, Grabber Input - Room room = (Room) rooms.elementAt(21); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(0,0,4,5,4); - room.SetMaterialOutline(16,11,18,11,0); - room.SetMaterialOutline(19,5,19,7,0); - room.AddTextBox("The GRABBER control inside a robot controls the grabber outside the robot.", - 6*28, 2*32, 350); - room.AddTextBox("When the grabber control's INPUT is on, the robot will grab an object that touches the robot's body.", - 6*28, 4*32, 350); - room.AddTextBox("Note: Robots can't grab objects held by you or another robot.", - 3*28, 9*32, 400); - room.AddArrow(17*28+14, 383, Arrow.DIR_DOWN, 28, Color.white) ; - room.graphix.addElement(new Graphix("grab0.jpg",28,48)); - } - { // Room 22, Grabber Output - Room room = (Room) rooms.elementAt(22); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(0,0,4,5,4); - room.SetMaterialOutline(16,0,18,0,0); - room.SetMaterialOutline(19,5,19,7,0); - room.AddTextBox("When a robot grabs a object, the grabber control's OUTPUT turns on.", - 6*28, 2*32, 300); - room.AddArrow(559, 6*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - room.graphix.addElement(new Graphix("grab1.jpg",28,56)); - } - { // Room 23, Sensors - Room room = (Room) rooms.elementAt(23); - room.SetMaterialOutline(0,0,19,4,6); - room.SetMaterialOutline(0,8,19,11,6); - room.SetMaterialOutline(1,8,18,8,0); - room.AddTextBox("These are SENSORS. Use them inside robots to detect objects that MATCH the sensor shape. Each of these sensors detects energy crystals in a different way.", - 2*28, 8*32, 500); - room.AddArrow(559, 6*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - items.addElement(new DirectionalSensor(3*28+14,1*32+4, room,new Crystal(0,0,null,0))); - items.addElement(new RoomSensor(10*28,2*32, room,new Crystal(0,0,null,0))); - items.addElement(new ContactSensor(16*28,2*32, room,new Crystal(0,0,null,0))); - } - { // Room 24, Contact Sensor - Room room = (Room) rooms.elementAt(24); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,5,19,7,0); - room.AddTextBox("This is a CONTACT sensor. It detects objects that touch it.", - 2*28, 2*32, 400); - room.AddTextBox("Inside the robot, it detects objects that touch the robot's body.", - 2*28, 4*32, 500); - room.AddTextBox("Place the square ON the sensor. What happens when you let go?", - 2*28, 9*32, 500); - room.AddArrow(559, 6*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - items.addElement(new ContactSensor(16*28,2*32,room,new Square(0,0,null,Color.white))); - items.addElement(new Square(10*28,6*32,room,Color.blue)); - } - { // Room 25, Room Sensor - Room room = (Room) rooms.elementAt(25); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,5,0,7,0); - room.SetMaterialOutline(1,11,3,11,0); - room.AddTextBox("This is an IN-SAME-ROOM sensor. It detects objects in the same room.", - 2*28, 2*32, 400); - room.AddTextBox("Inside the robot, it detects objects in the same room as the robot.", - 2*28, 4*32, 500); - room.AddTextBox("Sensors can't detect an object that is held. Pick up the triangle. What happens?", - 6*28, 9*32, 400); - room.AddArrow(2*28+14, 383, Arrow.DIR_DOWN, 28, Color.white) ; - items.addElement(new Triangle(10*28,6*32,room,new Color(255,128,0))); - items.addElement(new RoomSensor(15*28,2*32,room,new Triangle(0,0,null,Color.white))); - } - { // Room 26, Directional Sensor - Room room = (Room) rooms.elementAt(26); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,4,0,6,0); - room.SetMaterialOutline(1,0,3,0,0); - room.AddTextBox("This is a DIRECTIONAL sensor. It detects the direction of an object in the same room.", - 4*28, 2*32, 450); - room.AddTextBox("Inside the robot, it detects the direction of an object in the robot's room.", - 4*28, 4*32, 450); - room.AddTextBox("Pick up the sensor. move it around the crystal. Outputs pointing in the DIRECTION of the crystal turn on.", - 2*28, 9*32, 500); - room.AddArrow(0, 5*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - items.addElement(new Crystal(10*28,6*32,room,100000)); - items.addElement(new DirectionalSensor(14*28,5*32, room, new Crystal(0,0,null,0))); - } - { // Room 27, Orange Robot Talk - Room room = (Room) rooms.elementAt(27); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(19,4,19,6,0); - room.SetMaterialOutline(0,8,0,10,0); - room.AddTextBox("Next door is a robot wired with three sensors.", - 2*28, 2*32, 400); - room.AddTextBox("The sensors are wired to make the robot:", - 2*28, 4*32, 400); - room.AddTextBox("- beep when it contacts a square.", - 4*28, 6*32, 400); - room.AddTextBox("- move left or right toward an energy crystal.", - 4*28, 8*32, 400); - room.AddTextBox("- move down when a triangle is in the room", - 4*28, 10*32, 400); - room.AddArrow(0, 9*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - } - { // Room 28, Orange Robot - Room room = (Room) rooms.elementAt(28); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(19,8,19,10,0); - room.SetMaterialOutline(1,11,2,11,0); - room.AddTextBox("Go inside the robot. Notice how the sensors are wired.", - 2*28, 2*32, 500); - room.AddTextBox("Come outside. Move the objects and the robot to new locations. Watch what happens.", - 2*28, 4*32, 500); - room.AddArrow(2*28+14, 383, Arrow.DIR_DOWN, 28, Color.white) ; - items.addElement(new Square(4*28,6*32, room,Color.blue)); - items.addElement(new Crystal(9*28,6*32, room,100000)); - items.addElement(new Triangle(14*28, 6*32, room,new Color(255,128,0))); - GenericRobot robot = new OrangeRobot(2*28, 2*32, room); - items.addElement(robot); - { - robot.thrusterPower=true; - items.addElement(new DirectionalSensor(7*28+14,5*32+4,robot.InternalRoom,new Crystal(0,0,null,0))); - Item dsensor = (Item) items.lastElement(); - Wire dummy; - dummy = new Wire(((GenericRobot)robot).devices[1].ports[0], - ((Device)dsensor).ports[3]); - dummy = new Wire(((GenericRobot)robot).devices[3].ports[0], - ((Device)dsensor).ports[1]); - - items.addElement(new RoomSensor(8*28,2*32,robot.InternalRoom,new Triangle(0,0,null,Color.white))); - Item rsensor = (Item) items.lastElement(); - ((Device)rsensor).rotate(1); - ((Device)rsensor).rotate(1); - dummy = new Wire(((Device)rsensor).ports[0], - ((GenericRobot)robot).devices[0].ports[0]); - - items.addElement(new ContactSensor(13*28,2*32,robot.InternalRoom,new Square(0,0,null,Color.white))); - Item csensor = (Item) items.lastElement(); - dummy = new Wire(((GenericRobot)robot).devices[8].ports[0], - ((Device)csensor).ports[0]); - } - } - { // Room 29, White Robot Talk - Room room = (Room) rooms.elementAt(29); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(19,8,19,10,0); - room.SetMaterialOutline(1,0,2,0,0); - room.AddTextBox("The robot next door is wired to pick up and carry an object.", - 4*28, 2*32, 400); - room.AddTextBox("The robot is also wired to follow walls.", - 4*28, 4*32, 400); - room.AddTextBox("Go inside the robot. Close the switch. Move quickly onto the eye and watch how the robot works.", - 4*28, 6*32, 400); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 30, White Robot Maze - Room room = (Room) rooms.elementAt(30); - int[][] table = { - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,4}, - {4,0,0,0,4,0,0,0,0,0,0,0,0,0,0,4,0,0,0,4}, - {4,0,0,0,4,0,0,0,0,0,0,0,0,0,0,4,0,0,0,4}, - {4,0,0,0,4,0,0,0,4,0,0,0,0,0,0,4,0,0,0,4}, - {4,0,0,0,4,0,0,0,4,0,0,0,0,0,0,4,0,0,0,4}, - {0,0,0,0,4,0,0,0,4,4,4,4,4,4,4,4,0,0,0,4}, - {0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,4,4,0,4,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4} - }; - room.RoomArray = table; - items.addElement(new Crystal(12*28,6*32,room,100000)); - items.addElement(new WhiteRobot(1*28, 6*32, room)); - { - Item robot = (Item) items.lastElement(); - Wire dummy; - dummy = new Wire(((GenericRobot)robot).devices[1].ports[0], - ((GenericRobot)robot).devices[6].ports[0]); - dummy = new Wire(((GenericRobot)robot).devices[5].ports[0], - ((GenericRobot)robot).devices[0].ports[0]); - dummy = new Wire(((GenericRobot)robot).devices[7].ports[0], - ((GenericRobot)robot).devices[2].ports[0]); - dummy = new Wire(((GenericRobot)robot).devices[3].ports[0], - ((GenericRobot)robot).devices[4].ports[0]); - - items.addElement(new ContactSensor(8*28,2*32,robot.InternalRoom,new Triangle(0,0,null,Color.white))); - Item csensor = (Item) items.lastElement(); - - items.addElement(new NOTGate(10*28,5*32,robot.InternalRoom)); - Item notgate = (Item) items.lastElement(); - ((Device)notgate).rotate(1); - ((Device)notgate).rotate(1); - dummy = new Wire(((Device)csensor).ports[0], - ((Device)notgate).ports[0]); - dummy = new Wire(((Device)notgate).ports[1], - ((GenericRobot)robot).devices[9].ports[0]); - } - } - { // Room 31, After Maze - Room room = (Room) rooms.elementAt(31); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(19,4,19,6,0); - room.SetMaterial(3,0,0); - room.SetMaterial(5,0,0); - room.AddTextBox("Drop a triangle on the robot above to make it let go of the crystal. Look inside to see why it works.", - 2*28, 8*32, 500); - room.AddArrow(559, 5*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - items.addElement(new Triangle(14*28, 6*32, room, new Color(255,128,0))); - } - { // Room 32, End - Room room = (Room) rooms.elementAt(32); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,4,0,6,0); - room.SetMaterial(19,10,0); - room.SetMaterial(5,5,8); - room.SetMaterial(5,7,9); - room.AddTextBox("You have learned a lot about ROBOT ANATOMY.", - 2*28, 2*32, 500); - room.AddTextBox("Go to TOOLKIT tutorial.", - 6*28, 6*32, 500); - room.AddTextBox("Return to MAIN MENU.", - 6*28, 8*32, 500); - room.AddTextBox("Press ? for help or hints.", - 2*28, 10*32, 500); - } - { // Room 33, Shortcut - Room room = (Room) rooms.elementAt(33); - room.SetMaterialOutline(0,0,19,9,1); - room.SetMaterialOutline(0,11,19,11,1); - room.AddTextBox("Aha! A shortcut between the beginning and end of ROBOT ANATOMY!", - 4*28, 4*32, 400); - room.AddTextBox("or", - 10*28, 10*32+20, 500); - room.AddArrow(8*28, 10*32+16, Arrow.DIR_LEFT, 50, Color.white) ; - room.AddArrow(13*28, 10*32+16, Arrow.DIR_RIGHT, 50, Color.white) ; - } + // Material 0, Blank + materials.addElement(new Material(true, false)); + // Material 1, LightBlue Wall + materials.addElement(new Material(new Color(192, 192, 255), false, true)); + // Material 2, Green Wall + materials.addElement(new Material(new Color(0, 255, 0), false, true)); + // Material 3, Orange Wall + materials.addElement(new Material(new Color(255, 128, 0), false, true)); + // Material 4, LightOrange Wall + materials.addElement(new Material(new Color(255, 224, 192), false, true)); + // Material 5, CrystalRecharger + materials.addElement(new CrystalRecharger()); + // Material 6, Blue Wall + materials.addElement(new Material(new Color(0, 0, 255), false, true)); + // Material 7, LockT1 + int[][] lockProgram = { + {Lock.NARROW}, + {12, 10, 0}, + {12, 9, 0, 12, 6, 1}, + {12, 8, 0, 12, 5, 1}, + {Lock.NARROW}, + {12, 5, 0, 12, 8, 1}, + {12, 6, 0, 12, 9, 1}, + {12, 10, 1}, + }; + materials.addElement(new Lock(Color.white, Color.blue, lockProgram)); + // Material 8, Portal to Tutorial 2; + materials.addElement(new Portal("ROTut2.lvl", false, true)); + // Material 9, Portal to Main Menu; + materials.addElement(new Portal("MainMenu.lvl", false, true)); - int[] list1 = {31,32,33,1,2,3,4,5}; - LinkRoomsHorizontally(list1); + for (int a = 0; a < 34; a++) { + rooms.addElement(new Room()); + } - int[] list2 = {5,6,7,8,9}; - LinkRoomsVertically(list2); - - int[] list3 = {9,10,11,12}; - LinkRoomsHorizontally(list3); - - int[] list4 = {12,13,14}; - LinkRoomsVertically(list4); + { // Room 0, Help Screen + Room room = rooms.elementAt(0); + room.SetMaterialOutline(0, 0, 19, 11, 2); + room.AddTextBox("Use the Menubar above to turn sound on or off, or to return to the Main Menu level", 2 * 28, 4 * 32, 450); + room.AddTextBox("Press ? to get help or hints", 2 * 28, 8 * 32, 500); + room.AddTextBox("To continue, press RETURN", 4 * 28, 10 * 32, 500); + } + { // Room 1, Title Screen + Room room = rooms.elementAt(1); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(19, 5, 19, 7, 0); + room.SetMaterial(0, 10, 0); + room.AddTextBox("{BIG} ROBOT ANATOMY", 4 * 28, 2 * 32, 500); + room.AddTextBox("In ROBOT ANATOMY, you will learn how to move, how to handle objects, and how robots ", + 2 * 28, 3 * 32, 500); + room.AddTextBox("- Move", 6 * 28, 5 * 32, 500); + room.AddTextBox("- Send Signals", 6 * 28, 6 * 32, 500); + room.AddTextBox("- Grab Objects", 6 * 28, 7 * 32, 500); + room.AddTextBox("- Detect Objects", 6 * 28, 8 * 32, 500); + room.AddTextBox("Follow the Arrows", 6 * 28, 10 * 32, 500); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 2, Movement + Room room = rooms.elementAt(2); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialFill(0, 5, 19, 7, 0); + room.AddTextBox("You can move the cursor using the Arrow keys on your keyboard, or by clicking anywhere on the screen with the mouse.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Click here", 3 * 28, 8 * 32, 500); + room.AddArrow(5 * 28, 6 * 32 + 16, Arrow.DIR_UP, 28, Color.white); + room.AddTextBox("Double-Click here", 12 * 28 + 14, 8 * 32, 160); + room.AddArrow(15 * 28, 6 * 32 + 16, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 3, Movement 2 + Room room = rooms.elementAt(3); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialFill(0, 5, 19, 7, 0); + room.AddTextBox("Double-Clicking the mouse on one side of the cursor starts your cursor moving in that direction until it reaches a wall or the next room.", + 2 * 28, 2 * 32, 500); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 4, Pick up Key + Room room = rooms.elementAt(4); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 5, 0, 7, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("You can pick up and drop objects.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("To pick up an object, move on top of it and press the SPACEBAR (or Right-Click the mouse).", + 2 * 28, 3 * 32, 500); + room.AddTextBox("Pick up this key and move it around. To drop it, press the SPACEBAR again.", + 2 * 28, 8 * 32, 500); + room.AddTextBox("Take the Key with you", + 6 * 28, 10 * 32 + 16, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new Key(9 * 28, 5 * 32, room, Color.blue)); + } + { // Room 5, Locked Sentry + Room room = rooms.elementAt(5); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterialOutline(8, 11, 11, 11, 0); + room.SetMaterialOutline(12, 7, 19, 11, 1); + room.SetMaterial(12, 7, 7); + room.AddTextBox("You can move in small steps. Press the control key and the cursor keys at the same time.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("This sentry is trapped.", + 2 * 28, 4 * 32 + 16, 500); + room.AddTextBox("To let it out, hold the key by the HANDLE. Use small steps to put the key in the lock.", + 2 * 28, 6 * 32, 500); + room.AddArrow(10 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + items.addElement(new SentryT1(17 * 28, 9 * 32 + 16, room)); + } + { // Room 6, Blue Robot + Room room = rooms.elementAt(6); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(8, 0, 11, 0, 0); + room.SetMaterialOutline(16, 11, 18, 11, 0); + room.AddTextBox("This is a robot. You can go inside it.", + 2 * 28, 2 * 32, 350); + room.AddTextBox("To go inside, line yourself up with one of the robot's white BUMPERS and move in slowly. It may take a few tries.", + 2 * 28, 4 * 32, 350); + room.AddTextBox("Go inside and explore.", + 2 * 28, 9 * 32, 350); + room.AddTextBox("Come back and take the robot with you.", + 2 * 28, 10 * 32, 350); + room.AddArrow(17 * 28 + 14, 383, Arrow.DIR_DOWN, 28, Color.white); + room.AddTextBox("BUMPER", + 15 * 28, 4 * 32 + 16, 350); + room.AddArrow(15 * 28 + 2, 3 * 32 + 2, Arrow.DIR_UP, 28, Color.white); + GenericRobot robot = new BlueRobot(15 * 28, 2 * 32, room); + items.addElement(robot); + { + robot.charge = 0; + robot.thrusterPower = true; + Wire dummy; + dummy = new Wire(robot.devices[7].ports[0], + robot.devices[0].ports[0]); + dummy = new Wire(robot.devices[1].ports[0], + robot.devices[4].ports[0]); + dummy = new Wire(robot.devices[3].ports[0], + robot.devices[6].ports[0]); + dummy = new Wire(robot.devices[5].ports[0], + robot.devices[2].ports[0]); + robot.InternalRoom.AddTextBox("GRABBER", 7 * 28, 2 * 32 + 20, 100); + robot.InternalRoom.AddTextBox("ANTENNA", 7 * 28, 4 * 32 - 8, 100); + robot.InternalRoom.AddTextBox("BUMPER", 3 * 28, 6 * 32, 100); + robot.InternalRoom.AddTextBox("BATTERY", 6 * 28, 9 * 32 + 24, 100); + robot.InternalRoom.AddTextBox("SWITCH", 13 * 28 + 8, 10 * 32 - 8, 100); + robot.InternalRoom.AddTextBox("THRUSTER", 14 * 28, 5 * 32, 100); + robot.InternalRoom.AddTextBox("EYE", 13 * 28, 3 * 32, 100); + robot.InternalRoom.AddArrow(6 * 28, 3 * 32 - 16, Arrow.DIR_LEFT, 28, Color.white); + robot.InternalRoom.AddArrow(4 * 28 + 14, 4 * 32 - 16, Arrow.DIR_LEFT, 28, Color.white); + robot.InternalRoom.AddArrow(2 * 28 + 14, 5 * 32, Arrow.DIR_UP, 28, Color.white); + robot.InternalRoom.AddArrow(4 * 28 + 14, 10 * 32 - 16, Arrow.DIR_LEFT, 28, Color.white); + robot.InternalRoom.AddArrow(16 * 28 + 16, 10 * 32 - 16, Arrow.DIR_RIGHT, 28, Color.white); + robot.InternalRoom.AddArrow(18 * 28, 5 * 32 + 8, Arrow.DIR_UP, 28, Color.white); + robot.InternalRoom.AddArrow(16 * 28, 3 * 32 - 8, Arrow.DIR_RIGHT, 28, Color.white); + } + } + { // Room 7, Alternate Entry + Room room = rooms.elementAt(7); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialFill(16, 0, 18, 11, 0); + room.AddTextBox("You can also enter the robot by moving the cursor so it overlaps the robot, and then pressing E.", + 2 * 28, 2 * 32, 350); + room.AddTextBox("Once inside, you can exit by pressing E again.", + 2 * 28, 6 * 32, 350); + } + { // Room 8, Periscope + Room room = rooms.elementAt(8); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialFill(16, 0, 18, 11, 0); + room.AddTextBox("You can be inside the robot and still see outside.", + 2 * 28, 2 * 32, 350); + room.AddTextBox("Go inside the robot. Sit on the robot's EYE to activate its periscope.", + 2 * 28, 4 * 32, 350); + room.AddTextBox("Move off the eye to see inside the robot again.", + 2 * 28, 6 * 32, 350); + room.AddTextBox("Come outside.", + 2 * 28, 9 * 32, 350); + room.AddTextBox("Take the robot with you through the next few rooms.", + 2 * 28, 10 * 32, 350); + room.AddArrow(17 * 28 + 14, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 9, Triangle + Room room = rooms.elementAt(9); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialFill(16, 0, 18, 0, 0); + room.SetMaterialFill(19, 5, 19, 7, 0); + room.AddTextBox("You can put things inside robots. You can even put robots inside robots!", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Pick up the triangle. Carry it inside the robot. Drop it and come outside.", + 2 * 28, 9 * 32, 400); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new Triangle(9 * 28, 6 * 32, room, new Color(255, 128, 0))); + } + { // Room 10, Input + Room room = rooms.elementAt(10); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 0, 3, 3, 1); + room.SetMaterialFill(0, 5, 19, 8, 0); + room.AddTextBox("This is an INPUT.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("Some robot parts connect to inputs. Go inside the robot and see.", + 5 * 28, 3 * 32, 400); + room.AddTextBox("When electricity flows IN to an input, it turns on the robot part.", + 2 * 28, 8 * 32, 500); + room.AddTextBox("You can see electricity flow. It is orange.", + 2 * 28, 10 * 32, 500); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + PortDevice pd = new PortDevice(2 * 28 - 8, 24, room, 24, Port.TYPE_INPUT); + items.addElement(pd); + pd.rotate(1); + pd.rotate(1); + } + { // Room 11, Output + Room room = rooms.elementAt(11); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 0, 3, 3, 1); + room.SetMaterialFill(0, 5, 19, 8, 0); + room.AddTextBox("This is an OUTPUT.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("Some robot parts connect to outputs. Go inside the robot and see.", + 5 * 28, 3 * 32, 400); + room.AddTextBox("When a robot part is activated, electricity flows OUT of its output.", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 32, Color.white); + PortDevice pd = new PortDevice(2 * 28 - 8, 20, room, 24, Port.TYPE_OUTPUT); + items.addElement(pd); + pd.rotate(1); + pd.rotate(1); + } + { // Room 12, Bumper + Room room = rooms.elementAt(12); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 5, 0, 8, 0); + room.SetMaterialOutline(16, 11, 18, 11, 0); + room.AddTextBox("When a robot touches a wall, its bumper beeps and turns orange with electricity. Inside the robot, the bumper's OUTPUT turns on too.", + 2 * 28, 2 * 32, 450); + room.AddTextBox("Try it and see what happens.", + 2 * 28, 5 * 32, 450); + room.AddArrow(17 * 28 + 14, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 13, Thrusters + Room room = rooms.elementAt(13); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(16, 0, 18, 0, 0); + room.SetMaterialOutline(14, 11, 16, 11, 0); + room.AddTextBox("Inside a robot are four THRUSTERS.", + 2 * 28, 2 * 32, 350); + room.AddTextBox("You can propel robots by making electricity flow into the thrusters' INPUTS.", + 2 * 28, 4 * 32, 350); + room.AddTextBox("There is also a BATTERY inside the robot.", + 2 * 28, 7 * 32, 300); + room.AddTextBox("This robot can't move because its battery is dead.", + 2 * 28, 9 * 32, 300); + room.AddArrow(15 * 28 + 14, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 14, Crystal + Room room = rooms.elementAt(14); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialOutline(14, 0, 16, 0, 0); + room.SetMaterialOutline(19, 4, 19, 6, 0); + room.AddTextBox("Use this ENERGY CRYSTAL to recharge dead batteries.", + 2 * 28, 2 * 32, 250); + room.AddTextBox("Take it inside the robot. Pass it over the battery. Notice how the battery level fills with electricity.", + 2 * 28, 4 * 32 + 16, 350); + room.AddTextBox("The crystal goes dead (white) as its electricity drains.", + 2 * 28, 8 * 32, 500); + room.AddTextBox("Drop the crystal in the robot. Take the robot with you.", + 2 * 28, 10 * 32, 450); + room.AddArrow(559, 5 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new Crystal(12 * 28, 2 * 32, room, 100000)); + } + { // Room 15, Crystal Recharger + Room room = rooms.elementAt(15); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialOutline(16, 11, 18, 11, 0); + room.SetMaterialOutline(0, 4, 0, 6, 0); + room.SetMaterial(17, 2, 5); + room.AddTextBox("Use this CRYSTAL RECHARGER to recharge energy crystals.", + 2 * 28, 2 * 32, 350); + room.AddTextBox("Bring the dead energy crystal outside. Pass it over the recharger. Watch it fill with electricity.", + 2 * 28, 7 * 32, 400); + room.AddTextBox("Continue to take the robot with you.", + 2 * 28, 10 * 32, 350); + room.AddArrow(17 * 28 + 14, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 16, Thruster Demo + Room room = rooms.elementAt(16); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialFill(16, 0, 18, 11, 0); + room.AddTextBox("START", + 13 * 28 + 14, 52, 350); + room.AddArrow(13 * 28, 32, Arrow.DIR_UP, 28, Color.white); + room.AddTextBox("Move the robot so ONLY its top bumper touches the top wall. Drop it.", + 4 * 28, 4 * 32, 350); + room.AddTextBox("When the robot touches a wall, electricity flows from its bumper to the thruster, propelling the robot.", + 4 * 28, 7 * 32, 350); + room.AddArrow(17 * 28 + 14, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 17, Thruster Talk + Room room = rooms.elementAt(17); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialFill(16, 0, 18, 11, 0); + room.AddTextBox("A thruster moves a robot in the direction opposite its thrust.", + 2 * 28, 3 * 32, 400); + room.AddTextBox("When the left thruster is on, the robot moves RIGHT.", + 2 * 28, 5 * 32, 400); + room.AddTextBox("When the right thruster is on, the robot moves LEFT.", + 2 * 28, 7 * 32, 400); + room.AddTextBox("What happens when the top or bottom thruster is on?", + 2 * 28, 9 * 32, 400); + room.AddArrow(17 * 28 + 14, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 18, Switch + Room room = rooms.elementAt(18); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialFill(16, 0, 18, 0, 0); + room.SetMaterialFill(0, 5, 0, 7, 0); + room.AddTextBox("The SWITCH inside a robot turns electricity flow to the thrusters on or off.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Go inside and sit on the switch. Press SPACEBAR to open and close it.", + 2 * 28, 5 * 32, 400); + room.AddTextBox("Thrusters work when the switch is closed (orange). Open the switch to save batteries.", + 2 * 28, 8 * 32, 450); + room.AddTextBox("Leave the robot here.", + 2 * 28, 11 * 32, 350); + room.AddArrow(0, 6 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 19, Antenna Input + Room room = rooms.elementAt(19); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(0, 0, 4, 5, 4); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterialOutline(19, 5, 19, 7, 0); + room.AddTextBox("The ANTENNA control inside a robot controls the antenna outside.", + 6 * 28, 2 * 32, 400); + room.AddTextBox("When its INPUT is on, the robot's antenna sends signals to other robots, wherever they may be.", + 6 * 28, 5 * 32, 400); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + Antenna ant = new Antenna(2 * 28 - 12, 2 * 32, room, Color.white); + PortDevice pd = new PortDevice(18, 4 * 32, room, 28, Port.TYPE_OUTPUT); + items.addElement(ant); + items.addElement(pd); + pd.value = true; + pd.rotate(1); + Wire dummy = new Wire(pd.ports[0], ant.ports[0]); + } + { // Room 20, Antenna Output + Room room = rooms.elementAt(20); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(0, 0, 4, 4, 4); + room.SetMaterialOutline(0, 5, 0, 7, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("When a robot's antenna receives signals, the antenna control's OUTPUT turns on.", + 6 * 28, 2 * 32, 350); + room.AddArrow(0, 6 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + items.addElement(new Antenna(2 * 28 - 12, 2 * 32, room, Color.white)); + } + { // Room 21, Grabber Input + Room room = rooms.elementAt(21); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(0, 0, 4, 5, 4); + room.SetMaterialOutline(16, 11, 18, 11, 0); + room.SetMaterialOutline(19, 5, 19, 7, 0); + room.AddTextBox("The GRABBER control inside a robot controls the grabber outside the robot.", + 6 * 28, 2 * 32, 350); + room.AddTextBox("When the grabber control's INPUT is on, the robot will grab an object that touches the robot's body.", + 6 * 28, 4 * 32, 350); + room.AddTextBox("Note: Robots can't grab objects held by you or another robot.", + 3 * 28, 9 * 32, 400); + room.AddArrow(17 * 28 + 14, 383, Arrow.DIR_DOWN, 28, Color.white); + room.graphix.addElement(new Graphix("grab0.jpg", 28, 48)); + } + { // Room 22, Grabber Output + Room room = rooms.elementAt(22); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(0, 0, 4, 5, 4); + room.SetMaterialOutline(16, 0, 18, 0, 0); + room.SetMaterialOutline(19, 5, 19, 7, 0); + room.AddTextBox("When a robot grabs a object, the grabber control's OUTPUT turns on.", + 6 * 28, 2 * 32, 300); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + room.graphix.addElement(new Graphix("grab1.jpg", 28, 56)); + } + { // Room 23, Sensors + Room room = rooms.elementAt(23); + room.SetMaterialOutline(0, 0, 19, 4, 6); + room.SetMaterialOutline(0, 8, 19, 11, 6); + room.SetMaterialOutline(1, 8, 18, 8, 0); + room.AddTextBox("These are SENSORS. Use them inside robots to detect objects that MATCH the sensor shape. Each of these sensors detects energy crystals in a different way.", + 2 * 28, 8 * 32, 500); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new DirectionalSensor(3 * 28 + 14, 1 * 32 + 4, room, new Crystal(0, 0, null, 0))); + items.addElement(new RoomSensor(10 * 28, 2 * 32, room, new Crystal(0, 0, null, 0))); + items.addElement(new ContactSensor(16 * 28, 2 * 32, room, new Crystal(0, 0, null, 0))); + } + { // Room 24, Contact Sensor + Room room = rooms.elementAt(24); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 5, 19, 7, 0); + room.AddTextBox("This is a CONTACT sensor. It detects objects that touch it.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Inside the robot, it detects objects that touch the robot's body.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("Place the square ON the sensor. What happens when you let go?", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new ContactSensor(16 * 28, 2 * 32, room, new Square(0, 0, null, Color.white))); + items.addElement(new Square(10 * 28, 6 * 32, room, Color.blue)); + } + { // Room 25, Room Sensor + Room room = rooms.elementAt(25); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 5, 0, 7, 0); + room.SetMaterialOutline(1, 11, 3, 11, 0); + room.AddTextBox("This is an IN-SAME-ROOM sensor. It detects objects in the same room.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Inside the robot, it detects objects in the same room as the robot.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("Sensors can't detect an object that is held. Pick up the triangle. What happens?", + 6 * 28, 9 * 32, 400); + room.AddArrow(2 * 28 + 14, 383, Arrow.DIR_DOWN, 28, Color.white); + items.addElement(new Triangle(10 * 28, 6 * 32, room, new Color(255, 128, 0))); + items.addElement(new RoomSensor(15 * 28, 2 * 32, room, new Triangle(0, 0, null, Color.white))); + } + { // Room 26, Directional Sensor + Room room = rooms.elementAt(26); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 4, 0, 6, 0); + room.SetMaterialOutline(1, 0, 3, 0, 0); + room.AddTextBox("This is a DIRECTIONAL sensor. It detects the direction of an object in the same room.", + 4 * 28, 2 * 32, 450); + room.AddTextBox("Inside the robot, it detects the direction of an object in the robot's room.", + 4 * 28, 4 * 32, 450); + room.AddTextBox("Pick up the sensor. move it around the crystal. Outputs pointing in the DIRECTION of the crystal turn on.", + 2 * 28, 9 * 32, 500); + room.AddArrow(0, 5 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + items.addElement(new Crystal(10 * 28, 6 * 32, room, 100000)); + items.addElement(new DirectionalSensor(14 * 28, 5 * 32, room, new Crystal(0, 0, null, 0))); + } + { // Room 27, Orange Robot Talk + Room room = rooms.elementAt(27); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(19, 4, 19, 6, 0); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.AddTextBox("Next door is a robot wired with three sensors.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("The sensors are wired to make the robot:", + 2 * 28, 4 * 32, 400); + room.AddTextBox("- beep when it contacts a square.", + 4 * 28, 6 * 32, 400); + room.AddTextBox("- move left or right toward an energy crystal.", + 4 * 28, 8 * 32, 400); + room.AddTextBox("- move down when a triangle is in the room", + 4 * 28, 10 * 32, 400); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 28, Orange Robot + Room room = rooms.elementAt(28); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.SetMaterialOutline(1, 11, 2, 11, 0); + room.AddTextBox("Go inside the robot. Notice how the sensors are wired.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Come outside. Move the objects and the robot to new locations. Watch what happens.", + 2 * 28, 4 * 32, 500); + room.AddArrow(2 * 28 + 14, 383, Arrow.DIR_DOWN, 28, Color.white); + items.addElement(new Square(4 * 28, 6 * 32, room, Color.blue)); + items.addElement(new Crystal(9 * 28, 6 * 32, room, 100000)); + items.addElement(new Triangle(14 * 28, 6 * 32, room, new Color(255, 128, 0))); + GenericRobot robot = new OrangeRobot(2 * 28, 2 * 32, room); + items.addElement(robot); + { + robot.thrusterPower = true; + items.addElement(new DirectionalSensor(7 * 28 + 14, 5 * 32 + 4, robot.InternalRoom, new Crystal(0, 0, null, 0))); + Item dsensor = items.lastElement(); + Wire dummy; + dummy = new Wire(robot.devices[1].ports[0], + ((Device) dsensor).ports[3]); + dummy = new Wire(robot.devices[3].ports[0], + ((Device) dsensor).ports[1]); - LinkRoomsLeftRight(14,15); - - int[] list5 = {15,16,17,18}; - LinkRoomsVertically(list5); - - int[] list6 = {21,20,19,18}; - LinkRoomsHorizontally(list6); + items.addElement(new RoomSensor(8 * 28, 2 * 32, robot.InternalRoom, new Triangle(0, 0, null, Color.white))); + Item rsensor = items.lastElement(); + ((Device) rsensor).rotate(1); + ((Device) rsensor).rotate(1); + dummy = new Wire(((Device) rsensor).ports[0], + robot.devices[0].ports[0]); - LinkRoomsUpDown(21,22); + items.addElement(new ContactSensor(13 * 28, 2 * 32, robot.InternalRoom, new Square(0, 0, null, Color.white))); + Item csensor = items.lastElement(); + dummy = new Wire(robot.devices[8].ports[0], + ((Device) csensor).ports[0]); + } + } + { // Room 29, White Robot Talk + Room room = rooms.elementAt(29); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.SetMaterialOutline(1, 0, 2, 0, 0); + room.AddTextBox("The robot next door is wired to pick up and carry an object.", + 4 * 28, 2 * 32, 400); + room.AddTextBox("The robot is also wired to follow walls.", + 4 * 28, 4 * 32, 400); + room.AddTextBox("Go inside the robot. Close the switch. Move quickly onto the eye and watch how the robot works.", + 4 * 28, 6 * 32, 400); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 30, White Robot Maze + Room room = rooms.elementAt(30); + room.RoomArray = new int[][]{ + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 4}, + {4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4}, + {4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4}, + {4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4}, + {4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4}, + {0, 0, 0, 0, 4, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 4}, + {0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 4, 4, 0, 4, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} + }; + items.addElement(new Crystal(12 * 28, 6 * 32, room, 100000)); + items.addElement(new WhiteRobot(1 * 28, 6 * 32, room)); + { + Item robot = items.lastElement(); + Wire dummy; + dummy = new Wire(((GenericRobot) robot).devices[1].ports[0], + ((GenericRobot) robot).devices[6].ports[0]); + dummy = new Wire(((GenericRobot) robot).devices[5].ports[0], + ((GenericRobot) robot).devices[0].ports[0]); + dummy = new Wire(((GenericRobot) robot).devices[7].ports[0], + ((GenericRobot) robot).devices[2].ports[0]); + dummy = new Wire(((GenericRobot) robot).devices[3].ports[0], + ((GenericRobot) robot).devices[4].ports[0]); - int[] list7 = {22,23,24,25}; - LinkRoomsHorizontally(list7); - - LinkRoomsUpDown(25,26); - - int[] list8 = {28,27,26}; - LinkRoomsHorizontally(list8); - - LinkRoomsUpDown(28,29); - LinkRoomsLeftRight(29,30); - LinkRoomsUpDown(30,31); - - gameCursor = new GameCursor(16*28+14,5*32+16,(Room) rooms.elementAt(1)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - items.addElement(gameCursor); - items.addElement(helpCam); + items.addElement(new ContactSensor(8 * 28, 2 * 32, robot.InternalRoom, new Triangle(0, 0, null, Color.white))); + Item csensor = items.lastElement(); - player = gameCursor; - currentViewer = player; - electricity=true; - } + items.addElement(new NOTGate(10 * 28, 5 * 32, robot.InternalRoom)); + Item notgate = items.lastElement(); + ((Device) notgate).rotate(1); + ((Device) notgate).rotate(1); + dummy = new Wire(((Device) csensor).ports[0], + ((Device) notgate).ports[0]); + dummy = new Wire(((Device) notgate).ports[1], + ((GenericRobot) robot).devices[9].ports[0]); + } + } + { // Room 31, After Maze + Room room = rooms.elementAt(31); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(19, 4, 19, 6, 0); + room.SetMaterial(3, 0, 0); + room.SetMaterial(5, 0, 0); + room.AddTextBox("Drop a triangle on the robot above to make it let go of the crystal. Look inside to see why it works.", + 2 * 28, 8 * 32, 500); + room.AddArrow(559, 5 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new Triangle(14 * 28, 6 * 32, room, new Color(255, 128, 0))); + } + { // Room 32, End + Room room = rooms.elementAt(32); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 4, 0, 6, 0); + room.SetMaterial(19, 10, 0); + room.SetMaterial(5, 5, 8); + room.SetMaterial(5, 7, 9); + room.AddTextBox("You have learned a lot about ROBOT ANATOMY.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Go to TOOLKIT tutorial.", + 6 * 28, 6 * 32, 500); + room.AddTextBox("Return to MAIN MENU.", + 6 * 28, 8 * 32, 500); + room.AddTextBox("Press ? for help or hints.", + 2 * 28, 10 * 32, 500); + } + { // Room 33, Shortcut + Room room = rooms.elementAt(33); + room.SetMaterialOutline(0, 0, 19, 9, 1); + room.SetMaterialOutline(0, 11, 19, 11, 1); + room.AddTextBox("Aha! A shortcut between the beginning and end of ROBOT ANATOMY!", + 4 * 28, 4 * 32, 400); + room.AddTextBox("or", + 10 * 28, 10 * 32 + 20, 500); + room.AddArrow(8 * 28, 10 * 32 + 16, Arrow.DIR_LEFT, 50, Color.white); + room.AddArrow(13 * 28, 10 * 32 + 16, Arrow.DIR_RIGHT, 50, Color.white); + } + + int[] list1 = {31, 32, 33, 1, 2, 3, 4, 5}; + LinkRoomsHorizontally(list1); + + int[] list2 = {5, 6, 7, 8, 9}; + LinkRoomsVertically(list2); + + int[] list3 = {9, 10, 11, 12}; + LinkRoomsHorizontally(list3); + + int[] list4 = {12, 13, 14}; + LinkRoomsVertically(list4); + + LinkRoomsLeftRight(14, 15); + + int[] list5 = {15, 16, 17, 18}; + LinkRoomsVertically(list5); + + int[] list6 = {21, 20, 19, 18}; + LinkRoomsHorizontally(list6); + + LinkRoomsUpDown(21, 22); + + int[] list7 = {22, 23, 24, 25}; + LinkRoomsHorizontally(list7); + + LinkRoomsUpDown(25, 26); + + int[] list8 = {28, 27, 26}; + LinkRoomsHorizontally(list8); + + LinkRoomsUpDown(28, 29); + LinkRoomsLeftRight(29, 30); + LinkRoomsUpDown(30, 31); + + gameCursor = new GameCursor(16 * 28 + 14, 5 * 32 + 16, rooms.elementAt(1)); + helpCam = new HelpCam(rooms.elementAt(0)); + items.addElement(gameCursor); + items.addElement(helpCam); + + player = gameCursor; + currentViewer = player; + electricity = true; + } } diff --git a/src/com/droidquest/levels/ROTut2.java b/src/com/droidquest/levels/ROTut2.java index 26e57cf..14aaa67 100644 --- a/src/com/droidquest/levels/ROTut2.java +++ b/src/com/droidquest/levels/ROTut2.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.Wire; @@ -11,1263 +9,1214 @@ import com.droidquest.avatars.Remote; import com.droidquest.avatars.SolderingPen; import com.droidquest.chipstuff.Port; import com.droidquest.decorations.Arrow; -import com.droidquest.devices.ANDGate; -import com.droidquest.devices.Antenna; -import com.droidquest.devices.ContactSensor; -import com.droidquest.devices.DirectionalSensor; -import com.droidquest.devices.FlipFlop; -import com.droidquest.devices.NOTGate; -import com.droidquest.devices.Node; -import com.droidquest.devices.ORGate; -import com.droidquest.devices.PortDevice; -import com.droidquest.devices.RoomSensor; -import com.droidquest.devices.Thruster; -import com.droidquest.devices.XORGate; -import com.droidquest.items.BlueRobot; +import com.droidquest.devices.*; +import com.droidquest.items.*; import com.droidquest.items.Button; -import com.droidquest.items.Crystal; -import com.droidquest.items.Key; -import com.droidquest.items.OrangeRobot; -import com.droidquest.items.SentryT2; -import com.droidquest.items.ToolBox; -import com.droidquest.items.WhiteRobot; import com.droidquest.materials.CrystalRecharger; import com.droidquest.materials.Material; import com.droidquest.materials.Portal; -class ROTut2 extends Level -{ +import java.awt.*; -public ROTut2(RoomDisplay rd) - { - super(rd); - - // Material 0, Blank - materials.addElement(new Material(true, false)); - // Material 1, Green Wall - materials.addElement(new Material(new Color(0,255,0),false, true)); - // Material 2, Blue Wall - materials.addElement(new Material(new Color(0,0,255),false, true)); - // Material 3, Light Blue Wall - materials.addElement(new Material(new Color(190,190,255),false,true)); - // Material 4, Dark Blue Wall - materials.addElement(new Material(new Color(0,0,128),false, true)); - // Material 5, Recharger - materials.addElement(new CrystalRecharger()); - // Material 6, Portal to Tutorial 3; - materials.addElement(new Portal("ROTut3.lvl",false, true)); - // Material 7, Portal to Main Menu; - materials.addElement(new Portal("MainMenu.lvl",false, true)); - - for (int a=0; a<42; a++) - rooms.addElement(new Room()); +class ROTut2 extends Level { - { // Room 0, Help Screen - Room room = (Room) rooms.elementAt(0); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table; - room.AddTextBox("Special Keys",6*28, 2*32, 500); - room.AddTextBox("R Become the Remote Control. SPACEBAR toggles on/off.", - 2*28, 3*32, 500); - room.AddTextBox("S Become the Solderpen. SPACEBAR toggles on/off.", - 2*28, 5*32, 500); - room.AddTextBox("C Become the Cursor. SPACEBAR toggles on/off.", - 2*28, 7*32, 500); - room.AddTextBox("T Summons Toolkit to your room. Open/close Toolkit in room.", - 2*28, 9*32, 500); - room.AddTextBox("To continue, press RETURN.", 4*28, 11*32, 500); - } - { // Room 1, Title Screen - Room room = (Room) rooms.elementAt(1); - int[][] table = { - {2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("{BIG} TOOLKIT", 6*28, 2*32, 500); - room.AddTextBox("Here you will learn to use the", - 2*28, 3*32, 500); - room.AddTextBox("- Remote Control", 6*28, 5*32, 500); - room.AddTextBox("- Solderpen", 6*28, 6*32, 500); - room.AddTextBox("- Toolkit", 6*28, 7*32, 500); - room.AddTextBox("If you don't know about ROBOT ANATOMY, return to the Main Menu by using the menubar.", - 2*28, 9*32, 500); - room.AddArrow(559,7*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 2, Remote - Room room = (Room) rooms.elementAt(2); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("This is the REMOTE CONTROL. It 'freezes' the flow of electricity.", - 2*28, 2*32, 400); - room.AddTextBox("Press R to become the Remote Control.", - 2*28, 6*32, 300); - room.AddArrow(559,7*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - Remote remote = new Remote(); - remote.x = 17*28+14; remote.y = 48; remote.room = room; - items.addElement(remote); - } - { // Room 3, Freeze Electricity - Room room = (Room) rooms.elementAt(3); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("Press SPACEBAR to 'freeze' the electricity. The Remote Control turns white.", - 2*28, 2*32, 500); - room.AddTextBox("Press SPACEBAR again to let electricity flow. The Remote Control turns orange.", - 2*28, 10*32, 500); - room.AddArrow(559,7*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - Node node = new Node(10*28,4*32,room, Node.TYPE_STRAIGHT); - NOTGate notgate = new NOTGate(15*28, 6*32, room); - items.addElement(node); - items.addElement(notgate); - Wire wire = new Wire(node.ports[0], notgate.ports[1]); - wire = new Wire(notgate.ports[0], node.ports[2]); - } - { // Room 4, Freeze Robot - Room room = (Room) rooms.elementAt(4); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3} - }; - room.RoomArray = table; - room.AddTextBox("Freeze the electricity to stop the robot.", - 9*28, 2*32, 300); - room.AddTextBox("Turn on the elec- tricity and the robot moves.", - 9*28, 5*32, 300); - room.AddTextBox("When the Remote Control is on, it drains electricity from the Robot's battery.", - 9*28, 8*32, 300); - room.AddArrow(559,6*32+16, Arrow.DIR_RIGHT, 28, Color.white); - items.addElement(new Crystal(3*28, 10*32, room, 100000)); - OrangeRobot robot = new OrangeRobot(28,32,room); - items.addElement(robot); - RoomSensor sensor = new RoomSensor(6*28, 6*32, robot.InternalRoom, - new Crystal(0,0,null,0)); - items.addElement(sensor); - sensor.rotate(1); sensor.rotate(1); - Wire wire = new Wire(sensor.ports[0], robot.devices[8].ports[0]); - wire = new Wire(robot.devices[5].ports[0], robot.devices[2].ports[0]); - wire = new Wire(robot.devices[3].ports[0], robot.devices[6].ports[0]); - wire = new Wire(robot.devices[7].ports[0], robot.devices[0].ports[0]); - wire = new Wire(robot.devices[1].ports[0], robot.devices[4].ports[0]); - robot.thrusterPower=true; - } - { // Room 5, Freeze Sensors - Room room = (Room) rooms.elementAt(5); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("Freeze the electricity again. Press C to become the cursor. Pick up the sensor and move it around the crystal.", - 2*28, 2*32, 450); - room.AddTextBox("Did the outputs change color?", - 2*28, 5*32, 200); - room.AddTextBox("Sensors don't work when the remote control is off.", - 2*28, 8*32, 350); - room.AddTextBox("Turn the remote contol on.", - 2*28, 11*32, 500); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - items.addElement(new Crystal(12*28, 4*32, room, 100000)); - items.addElement(new DirectionalSensor(15*28, 6*32, room, - new Crystal(0,0,null,0))); - } - { // Room 6, Solderpen - Room room = (Room) rooms.elementAt(6); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,3} - }; - room.RoomArray = table; - room.AddTextBox("The SOLDERPEN is used to wire OUTPUTS to INPUTS.", - 2*28, 2*32, 350); - room.AddTextBox("Press S to become the Solderpen.", - 2*28, 5*32, 400); - room.AddTextBox("Tip", - 14*28+8, 3*32-12, 50); - room.AddArrow(16*28+24, 2*32+14, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(17*28, 383, Arrow.DIR_DOWN, 28, Color.white); - SolderingPen sp = new SolderingPen(); - items.addElement(sp); - sp.x = 17*28; sp.y=2*32-8; sp.room = room; - } - { // Room 7, Attach wires - Room room = (Room) rooms.elementAt(7); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0} - }; - room.RoomArray = table; - room.AddTextBox("Move the Solderpen to the INPUT (circle) until the Solderpen tip glows orange. Press SPACEBAR.", - 2*28, 2*32, 400); - room.AddTextBox("Move the Solderpen to the OUTPUT (arrow). When the tip glows orange, press SPACEBAR. The INPUT is now wired to the OUTPUT and electricity flows between them.", - 2*28, 7*32, 400); - room.AddArrow(0, 5*32+16, Arrow.DIR_LEFT, 28, Color.white); - items.addElement(new Thruster(17*28, 9*32, room, Port.ROT_RIGHT, Color.white)); - PortDevice pd = new PortDevice(15*28, 10*32, room, 28, Port.TYPE_OUTPUT); - pd.value=true; - items.addElement(pd); - } - { // Room 8, Detatch wires - Room room = (Room) rooms.elementAt(8); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0} - }; - room.RoomArray = table; - room.AddTextBox("To disconnect the wire, move near the INPUT or OUTPUT. Press the SPACEBAR when the tip glows green.", - 2*28, 2*32, 400); - room.AddArrow(0, 9*32+16, Arrow.DIR_LEFT, 28, Color.white); - Thruster thruster = new Thruster(17*28, 9*32, room, Port.ROT_RIGHT, Color.white); - items.addElement(thruster); - PortDevice pd = new PortDevice(15*28, 10*32, room, 28, Port.TYPE_OUTPUT); - pd.value=true; - items.addElement(pd); - Wire wire = new Wire(thruster.ports[0], pd.ports[0]); - } - { // Room 9, Stretch Wires - Room room = (Room) rooms.elementAt(9); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("When you connect inputs to outputs, you create CIRCUITS.", - 2*28, 2*32, 500); - room.AddTextBox("Change to the cursor and pick up part of this circuit.", - 2*28, 4*32, 500); - room.AddTextBox("The wire will stretch as you move, but break if you leave the room.", - 2*28, 6*32, 500); - room.AddArrow(0, 9*32+16, Arrow.DIR_LEFT, 28, Color.white); - NOTGate ng = new NOTGate(15*28, 7*32, room); - ORGate og = new ORGate(10*28, 7*32, room); - og.rotate(1); og.rotate(1); - items.addElement(ng); - items.addElement(og); - Wire wire = new Wire(ng.ports[1], og.ports[0]); - wire = new Wire(og.ports[2], ng.ports[0]); - } - { // Room 10, Stretch Wires - Room room = (Room) rooms.elementAt(10); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("Practice wiring circuits in the orange robot above. (Don't forget to come back!)", - 2*28, 2*32, 400); - room.AddTextBox("Go inside the robot and rewire the bumpers to the thrusters in any way you like.", - 2*28, 5*32, 400); - room.AddTextBox("To start the robot moving, put it against a wall.", - 2*28, 8*32, 400); - room.AddArrow(0, 9*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 11, Toolkit is here - Room room = (Room) rooms.elementAt(11); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("This is the TOOLKIT. Inside are parts you need to wire circuits.", - 2*28, 2*32, 400); - room.AddTextBox("Press C to become the cursor and pick up the Toolkit.", - 2*28, 5*32, 400); - room.AddTextBox("Carry it into the next room.", - 2*28, 8*32, 400); - room.AddArrow(3*28, 383, Arrow.DIR_DOWN, 28, Color.white); - toolbox = new ToolBox(15*28, 2*32, room); - items.addElement(toolbox); - } - { // Room 12, Open and Close Toolkit - Room room = (Room) rooms.elementAt(12); - int[][] table = { - {3,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("Drop Toolkit here.", - 4*28, 4*32, 100); - room.AddTextBox("You can open and close the Toolkit by pressing T. Try it a few times.", - 2*28, 7*32, 300); - room.AddTextBox("Leave the Toolkit here.", - 2*28, 10*32, 400); - room.AddArrow(9*28, 5*32, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 13, Toolkit Sentry - Room room = (Room) rooms.elementAt(13); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,3,3,0,0,3,3,3,3,3,3,0,0,3}, - {3,0,0,3,3,0,0,3,3,0,0,3,3,3,3,3,3,0,0,0}, - {3,0,0,3,3,0,0,3,3,0,0,3,3,0,0,3,3,0,0,0}, - {3,0,0,3,3,0,0,3,3,0,0,3,3,0,0,3,3,0,0,0}, - {3,0,0,3,3,0,0,3,3,0,0,3,3,0,0,3,3,0,0,0}, - {0,0,0,3,3,0,0,0,0,0,0,3,3,0,0,0,0,0,0,3}, - {0,0,0,3,3,0,0,0,0,0,0,3,3,0,0,0,0,0,0,3}, - {0,0,0,3,3,0,0,0,0,0,0,3,3,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("NO TOOLKITS ALLOWED!", - 2*28, 2*32, 150); - room.AddArrow(559, 6*32, Arrow.DIR_RIGHT, 28, Color.white); - items.add(new SentryT2(2*28, 2*32, room)); - } - { // Room 14, Summon Toolkit - Room room = (Room) rooms.elementAt(14); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("Do you want the Toolkit? Press T to summon it. Drop the Toolkit and press T to open and close it.", - 2*28, 2*32, 500); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 15, Objects in Toolkit - Room room = (Room) rooms.elementAt(15); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("You can take parts in and out of the Toolkit with the cursor.", - 2*28, 2*32, 500); - room.AddTextBox("To take a part out, move on top of it and press the SPACEBAR. To put it back, drop it anywhere in the Toolkit.", - 2*28, 5*32, 500); - room.AddTextBox("Open Toolkit here.", - 3*28, 9*32, 100); - room.AddArrow(7*28, 10*32+16, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 16, Rotating Objects - Room room = (Room) rooms.elementAt(16); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("You can rotate parts left and right by holding a part and pressing the [ and ] keys.", - 2*28, 2*32, 450); - room.AddTextBox("There is no limit to the number of parts you can take out of the Toolkit.", - 2*28, 5*32, 450); - room.AddTextBox("Open Toolkit here.", - 3*28, 9*32, 100); - room.AddArrow(7*28, 10*32+16, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 17, Hot Cursor - Room room = (Room) rooms.elementAt(17); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("You can make the cursor HOT with elctricity. Press H.", - 6*28, 2*32, 300); - room.AddTextBox("Pass the hot cursor over the antenna INPUT to turn the antenna on.", - 6*28, 5*32, 300); - room.AddTextBox("Press H again to make the cursor cold.", - 6*28, 8*32, 300); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - items.addElement(new Antenna(2*28, 2*32, room, Color.white)); - } - { // Room 18 Crossroads - Room room = (Room) rooms.elementAt(18); - int[][] table = { - {4,0,0,0,0,4,4,4,4,4,4,4,4,4,4,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,4,4,4,4,4,4,4,0,0,0,0,4,4,4,4,4,4,4,4} - }; - room.RoomArray = table; - room.AddTextBox("{BIG} CROSSROADS", - 3*28, 4*32, 500); - room.AddTextBox("(Turn the Remote Control on.)", - 4*28, 5*32, 250); - room.AddTextBox("NODES", - 2*28, 32+16, 300); - room.AddTextBox("FLIPFLOPS", - 15*28, 32+16, 300); - room.AddTextBox("LOGIC GATES", - 16*28, 6*32, 100); - room.AddTextBox("When you have learned all about the Toolkit, go this way.", - 4*28, 9*32, 300); - room.AddArrow(3*28, 0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(17*28, 0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(559, 6*32, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(10*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 19, Paths to Nodes & FlipFlops - Room room = (Room) rooms.elementAt(19); - int[][] table = { - {4,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,4}, - {0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,0,0,0,0,4}, - {0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,0,0,0,0,4}, - {0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,0,0,0,0,4}, - {4,0,0,0,0,4,4,4,4,4,4,4,4,4,4,0,0,0,0,4}, - {4,0,0,0,0,4,4,4,4,4,4,4,4,4,4,0,0,0,0,4}, - {4,0,0,0,0,4,4,4,4,4,4,4,4,4,4,0,0,0,0,4}, - {4,0,0,0,0,4,4,4,4,4,4,4,4,4,4,0,0,0,0,4} - }; - room.RoomArray = table; - room.AddArrow(3*28, 0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(0, 6*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 20, Nodes Intro - Room room = (Room) rooms.elementAt(20); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Nodes make electricity branch to two or three places.", - 2*28, 2*32, 350); - room.AddTextBox("Take a node from the Toolkit and carry it to the next room.", - 2*28, 9*32, 500); - room.AddArrow(0, 6*32+16, Arrow.DIR_LEFT, 28, Color.white); - items.addElement(new Node(13*28, 32+16, room, Node.TYPE_STRAIGHT)); - items.addElement(new Node(15*28, 32+16, room, Node.TYPE_RIGHT)); - items.addElement(new Node(17*28, 32+16, room, Node.TYPE_THREE)); - } - { // Room 21, Nodes Workshop - Room room = (Room) rooms.elementAt(21); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Wire the INPUT (circle) of the node to the OUTPUT of the CONTACT sensor. Wire the node outputs to the thrusters.", - 2*28, 2*32, 275); - room.AddTextBox("Drop the blue key so that it touches the sensor. Electricity flows to both thrusters.", - 2*28, 9*32, 500); - items.addElement(new Key(11*28, 2*32, room, Color.white)); - items.addElement(new ContactSensor(11*28, 4*32, room, new Key(0,0,null, Color.white))); - items.addElement(new Thruster(15*28, 32+16, room, Port.ROT_UP, Color.white)); - items.addElement(new Thruster(16*28, 3*32, room, Port.ROT_RIGHT, Color.white)); - } - { // Room 22, Flipflop intro - Room room = (Room) rooms.elementAt(22); - int[][] table = { - {2,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("A flipflop is like a light switch. It 'flips' electricity from one output to the other.", - 5*28, 2*32, 300); - room.AddTextBox("Take a flipflop from the Toolkit. Put the hot cursor on one input at a time to make the electricity 'flip' or 'flop'.", - 5*28, 6*32, 300); - items.addElement(new FlipFlop(17*28+7, 32+16, room)); - room.AddArrow(3*28, 0, Arrow.DIR_UP, 28, Color.white); - } - { // Room 23, Flipflop workshop - Room room = (Room) rooms.elementAt(23); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Go inside the robot and wire the orange OUTPUT of the flipflop to the thruster on the right. Sit on the eye to see what you did.", - 5*28, 8*32, 420); - BlueRobot robot = new BlueRobot(9*28,4*32,room); - items.addElement(robot); - FlipFlop ff = new FlipFlop(10*28, 5*32, robot.InternalRoom); - items.addElement(ff); - Wire wire = new Wire(ff.ports[0], robot.devices[7].ports[0]); - wire = new Wire(ff.ports[2], robot.devices[3].ports[0]); - wire = new Wire(robot.devices[5].ports[0], ff.ports[1]); - robot.thrusterPower=true; - } - { // Room 24, Crossroads II - Room room = (Room) rooms.elementAt(24); - int[][] table = { - {4,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {4,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4} - }; - room.RoomArray = table; - room.AddTextBox("Crossroads", - 2*28, 6*32+8, 500); - room.AddTextBox("NOT-gate", - 2*28, 32+16, 500); - room.AddTextBox("AND-gate", - 15*28, 2*32+16, 500); - room.AddTextBox("XOR-gate", - 15*28, 10*32, 500); - room.AddTextBox("OR-gate", - 2*28, 10*32+16, 500); - room.AddArrow(3*28, 0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(559, 2*32+16, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(3*28, 383, Arrow.DIR_DOWN, 28, Color.white); - room.AddArrow(0, 6*32, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 25, NOT gate intro - Room room = (Room) rooms.elementAt(25); - int[][] table = { - {2,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("A NOT-gate inverts electricity flow. It turns on when its INPUT is NOT on.", - 5*28, 2*32, 300); - room.AddTextBox("Take a NOT-gate from the Toolkit and use the hot cursor to see how it works.", - 5*28, 6*32, 400); - items.addElement(new NOTGate(17*28+10, 32+12, room)); - room.AddArrow(3*28, 0, Arrow.DIR_UP, 28, Color.white); - } - { // Room 26, NOT gate workshop - Room room = (Room) rooms.elementAt(26); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Wire the NOT-gate output to the Antenna INPUT.", - 5*28, 2*32, 400); - room.AddTextBox("The antenna beeps when the crystal is NOT touching the CONTACT sensor.", - 5*28, 8*32, 400); - items.addElement(new Crystal(3*28, 7*32, room, 100000)); - ContactSensor sensor = new ContactSensor(2*28, 6*32, room, new Crystal(0,0,null,0)); - items.addElement(sensor); - NOTGate ng = new NOTGate(4*28, 4*32, room); - items.addElement(ng); - items.addElement(new Antenna(2*28, 2*32, room, Color.white)); - Wire wire = new Wire(sensor.ports[0], ng.ports[0]); - } - { // Room 27, OR gate intro - Room room = (Room) rooms.elementAt(27); - int[][] table = { - {2,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,2} - }; - room.RoomArray = table; - room.AddTextBox("An OR-gate turns on when one OR the other INPUT is on, or both.", - 5*28, 2*32, 300); - room.AddTextBox("Take an OR-gate from the Toolkit and use the hot cursor to see how it works.", - 2*28, 8*32, 400); - items.addElement(new ORGate(17*28+10, 32+12, room)); - room.AddArrow(17*28, 0, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 28, OR workshop - Room room = (Room) rooms.elementAt(28); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Wire the OR-gate output to the Antenna INPUT.", - 5*28, 2*32, 400); - room.AddTextBox("The antenna beeps when the key is above OR left of the sensor.", - 5*28, 10*32, 400); - items.addElement(new Key(3*28, 7*32, room, Color.blue)); - DirectionalSensor sensor = new DirectionalSensor(8*28, 6*32, room, - new Key(0,0,null,Color.white)); - items.addElement(sensor); - ORGate og = new ORGate(4*28, 4*32, room); - items.addElement(og); - items.addElement(new Antenna(2*28, 2*32, room, Color.white)); - Wire wire = new Wire(sensor.ports[0], og.ports[1]); - wire = new Wire(sensor.ports[3], og.ports[0]); - } - { // Room 29, Paths to AND & XOR - Room room = (Room) rooms.elementAt(29); - int[][] table = { - {4,4,4,4,4,4,4,0,0,0,0,4,4,4,4,4,4,4,4,4}, - {0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4}, - {0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4}, - {0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4}, - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {4,4,4,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4} - }; - room.RoomArray = table; - room.AddArrow(9*28, 0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(5*28, 0, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 30, AND gate intro - Room room = (Room) rooms.elementAt(30); - int[][] table = { - {2,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("An AND-gate turns on when its left AND right INPUTS are on.", - 5*28, 2*32, 300); - room.AddTextBox("Take a AND-gate from the Toolkit and test it with the hot cursor.", - 5*28, 6*32, 400); - items.addElement(new ANDGate(17*28+10, 32+12, room)); - room.AddArrow(3*28, 0, Arrow.DIR_UP, 28, Color.white); - } - { // Room 31, AND gate workshop - Room room = (Room) rooms.elementAt(31); - int[][] table3 = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table3; - room.AddTextBox("Wire the AND-gate output to the Antenna INPUT.", - 5*28, 2*32, 400); - room.AddTextBox("The antenna beeps when the key is left AND up from this DIRECTIONAL sensor.", - 5*28, 9*32, 400); - items.addElement(new Key(3*28, 7*32, room, Color.blue)); - DirectionalSensor sensor = new DirectionalSensor(5*28, 6*32, room, - new Key(0,0,null,Color.white)); - items.addElement(sensor); - ANDGate ag = new ANDGate(4*28, 4*32, room); - items.addElement(ag); - items.addElement(new Antenna(2*28, 2*32, room, Color.white)); - Wire wire = new Wire(sensor.ports[0], ag.ports[1]); - wire = new Wire(sensor.ports[3], ag.ports[0]); - } - { // Room 32, XOR gate intro - Room room = (Room) rooms.elementAt(32); - int[][] table = { - {2,2,2,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,2} - }; - room.RoomArray = table; - room.AddTextBox("An EXCLUSIVE-OR- gate (XOR-gate) turns on when one OR the other INPUT is on, NOT both.", - 7*28, 2*32, 250); - room.AddTextBox("Take an XOR-gate from the Toolkit and test it with the hot cursor.", - 2*28, 9*32, 400); - items.addElement(new XORGate(17*28+10, 32+12, room)); - room.AddArrow(17*28, 0, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 33, XOR workshop - Room room = (Room) rooms.elementAt(33); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Wire the XOR-gate output to the Antenna INPUT.", - 5*28, 2*32, 400); - room.AddTextBox("The antenna beeps when either the key or the crystal is in the room, but not both.", - 5*28, 9*32, 400); - items.addElement(new Key(2*28, 9*32, room, Color.blue)); - items.addElement(new Crystal(2*28, 7*32, room, 100000)); - RoomSensor sensor1 = new RoomSensor(8*28, 6*32, room, new Key(0,0,null,Color.white)); - RoomSensor sensor2 = new RoomSensor(8*28, 7*32, room, new Crystal(0,0,null,0)); - sensor1.rotate(1); sensor1.rotate(1); - sensor2.rotate(1); sensor2.rotate(1); - items.addElement(sensor1); - items.addElement(sensor2); - XORGate xg = new XORGate(4*28, 4*32, room); - items.addElement(xg); - items.addElement(new Antenna(2*28, 2*32, room, Color.white)); - Wire wire = new Wire(sensor1.ports[0], xg.ports[1]); - wire = new Wire(sensor2.ports[0], xg.ports[0]); - } - { // Room 34, Circuit Ideas I - Room room = (Room) rooms.elementAt(34); - int[][] table = { - {3,3,3,3,3,3,3,3,0,0,0,0,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,0,0,0,0,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("Try these robot circuits in the robot below.", - 2*28, 2*32, 500); - room.AddTextBox("LEFT WALL CRAWLER", - 3*28, 4*32, 500); - room.AddTextBox("Rewire the NOT gate to the thruster on the right.", - 4*28, 4*32+16, 400); - room.AddTextBox("PING-PONG", - 3*28, 7*32, 500); - room.AddTextBox("Unwire the NOT-gate. Use a second flipflop wired the same way as the robot in the flipflop example above.", - 4*28, 7*32+16, 400); - room.AddTextBox("MORE CIRCUIT IDEAS", - 0, 9*32, 100); - room.AddTextBox("ROBOT", - 9*28, 11*32, 400); - room.AddArrow(10*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 35, Circuit Ideas II - Room room = (Room) rooms.elementAt(35); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("KEY-PHOBE", - 2*28, 2*32, 450); - room.AddTextBox("Wire a key DIRECTIONAL sensor's outputs to the thrusters they point toward.", - 3*28, 2*32+16, 450); - room.AddTextBox("NON-KEY-GRABBER", - 2*28, 5*32, 450); - room.AddTextBox("Wire a key CONTACT sensor to a NOT-gate. Wire the NOT-gate to the grabber input.", - 3*28, 5*32+16, 450); - room.AddTextBox("CRYSTAL-SIGNALER", - 2*28, 8*32, 450); - room.AddTextBox("Wire the crystal IN-SAME-ROOM sensor to the antenna.", - 3*28, 8*32+16, 450); - } - { // Room 36, Robot Play area 1 - Room room = (Room) rooms.elementAt(36); - int[][] table = { - {3,3,3,3,3,3,3,3,0,0,0,0,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,0,0,0,0,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - WhiteRobot robot = new WhiteRobot(0,6*32,room); - items.addElement(robot); - NOTGate ng = new NOTGate(3*28,5*32,robot.InternalRoom); - items.addElement(ng); - ng.rotate(1); ng.rotate(1); - FlipFlop ff = new FlipFlop(10*28, 4*32, robot.InternalRoom); - items.addElement(ff); - Wire wire = new Wire(robot.devices[3].ports[0], ng.ports[1]); - wire = new Wire(robot.devices[6].ports[0], ff.ports[0]); - wire = new Wire(ff.ports[1], robot.devices[4].ports[0]); - wire = new Wire(ff.ports[2], robot.devices[2].ports[0]); - wire = new Wire(ff.ports[3], robot.devices[0].ports[0]); - ContactSensor sensor = new ContactSensor(15*28, 6*32, robot.InternalRoom, - new Button(0,0,null,Color.white)); - items.addElement(sensor); - robot.thrusterPower=true; - items.addElement(new Key(2*28, 9*32, room, Color.blue)); - items.addElement(new Crystal(4*28, 9*32, room, 100000)); - } - { // Room 37, Robot Play area 2 - Room room = (Room) rooms.elementAt(37); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,3}, - {3,0,0,0,3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0}, - {3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0}, - {3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0}, - {3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0}, - {3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0}, - {3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0}, - {3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - items.addElement(new Button(16*28, 32+16, room, new Color(255,128,0))); - } - { // Room 38, Robot Play area 3 - Room room = (Room) rooms.elementAt(38); - int[][] table = { - {3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,3,0,0,0,3,3,3,3,3,3,3,0,0,0,3}, - {3,0,0,0,0,3,0,0,0,3,0,0,0,0,0,3,0,0,0,3}, - {3,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,0,0,0,3}, - {3,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,0,0,0,3}, - {3,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - items.addElement(new Button(12*28, 5*32, room, new Color(0,0,255))); - } - { // Room 39, End - Room room = (Room) rooms.elementAt(39); - int[][] table = { - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Now you know how to use the Solderpen, Remote Control, and Toolkit.", - 2*28, 2*32, 500); - room.AddTextBox("You also know how nodes, flipflops, and logic gates work.", - 2*28, 3*32+16, 500); - room.AddTextBox("You can use these to design and build robots in ROBOTROPOLIS and the INNOVATION LAB.", - 2*28, 6*32, 500); - room.AddTextBox("Go to CHIP DESIGN.", - 6*28, 9*32, 500); - room.AddTextBox("Return to MAIN MENU.", - 6*28, 11*32, 500); - } - { // Room 40, Wire Flipping - Room room = (Room) rooms.elementAt(40); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("Wires are normally drawn as a horizontal line and a vertical line attached to the 1st and 2nd ports. But these can be 'flipped' without having to remove the wire.", - 2*28, 2*32, 500); - room.AddTextBox("Become the Soldering Pen and move the tip over any wired port until the tip turns green and then press F.", - 2*28, 6*32, 500); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - NOTGate ng1 = new NOTGate(6*28, 10*32, room); - items.addElement(ng1); - ng1.rotate(1); - NOTGate ng2 = new NOTGate(12*28, 8*32, room); - items.addElement(ng2); - Wire wire = new Wire(ng1.ports[1], ng2.ports[0]); - } - { // Room 41, Gate Flipping - Room room = (Room) rooms.elementAt(41); - int[][] table = { - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("AND, OR, XOR, and FlipFlops can also be flipped so their inputs (and outputs) can switch connections without having to rewire them.", - 2*28, 2*32, 500); - room.AddTextBox("Become the cursor and pick up a gate, and then press F.", - 2*28, 5*32, 500); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - NOTGate ng1 = new NOTGate(4*28, 10*32, room); - ng1.rotate(1); - items.addElement(ng1); - NOTGate ng2 = new NOTGate(8*28, 10*32, room); - ng2.rotate(-1); - items.addElement(ng2); - NOTGate ng3 = new NOTGate(10*28, 10*32, room); - ng3.rotate(1); - items.addElement(ng3); - NOTGate ng4 = new NOTGate(14*28, 10*32, room); - ng4.rotate(-1); - items.addElement(ng4); - ANDGate ag = new ANDGate(6*28,8*32,room); - ag.rotate(1); - items.addElement(ag); - XORGate xg = new XORGate(12*28,8*32,room); - xg.rotate(-1); - items.addElement(xg); - FlipFlop ff = new FlipFlop(9*28,7*32,room); - items.addElement(ff); - ORGate og = new ORGate(12*28,6*32,room); - og.rotate(1); - items.addElement(og); - new Wire(ag.ports[0], ng1.ports[1]); - new Wire(ng2.ports[1], ag.ports[1]); - new Wire(ng3.ports[1], xg.ports[0]); - new Wire(xg.ports[1], ng4.ports[1]); - new Wire(ag.ports[2], ff.ports[0]); - new Wire(xg.ports[2], ff.ports[1]); - new Wire(og.ports[0], ff.ports[2]); - new Wire(og.ports[1], ff.ports[3]); - } + public ROTut2(RoomDisplay rd) { + super(rd); - - int[] list1={1,2,3,4,5,6}; - LinkRoomsHorizontally(list1); - int[] list2={11,10,9,8,7}; - LinkRoomsHorizontally(list2); - int[] list3={12,13,14,15,16,40,41,17,18,24,29}; - LinkRoomsHorizontally(list3); - int[] list4={23,22,19,18,34,36,39,1}; - LinkRoomsVertically(list4); - int[] list5={26,25,24,27,28}; - LinkRoomsVertically(list5); - int[] list6={31,30,29,32,33}; - LinkRoomsVertically(list6); - LinkRoomsLeftRight(21,20); - LinkRoomsLeftRight(20,19); - LinkRoomsLeftRight(35,34); - LinkRoomsLeftRight(37,36); - LinkRoomsUpDown(4,10); - LinkRoomsUpDown(6,7); - LinkRoomsUpDown(11,12); - LinkRoomsUpDown(37,38); - - gameCursor = new LabCursor(16*28+14,5*32+16,(Room) rooms.elementAt(1)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - solderingPen = new SolderingPen(); - remote = new Remote(); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - player = gameCursor; - currentViewer = player; - } + // Material 0, Blank + materials.addElement(new Material(true, false)); + // Material 1, Green Wall + materials.addElement(new Material(new Color(0, 255, 0), false, true)); + // Material 2, Blue Wall + materials.addElement(new Material(new Color(0, 0, 255), false, true)); + // Material 3, Light Blue Wall + materials.addElement(new Material(new Color(190, 190, 255), false, true)); + // Material 4, Dark Blue Wall + materials.addElement(new Material(new Color(0, 0, 128), false, true)); + // Material 5, Recharger + materials.addElement(new CrystalRecharger()); + // Material 6, Portal to Tutorial 3; + materials.addElement(new Portal("ROTut3.lvl", false, true)); + // Material 7, Portal to Main Menu; + materials.addElement(new Portal("MainMenu.lvl", false, true)); + + for (int a = 0; a < 42; a++) { + rooms.addElement(new Room()); + } + + { // Room 0, Help Screen + Room room = rooms.elementAt(0); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + room.AddTextBox("Special Keys", 6 * 28, 2 * 32, 500); + room.AddTextBox("R Become the Remote Control. SPACEBAR toggles on/off.", + 2 * 28, 3 * 32, 500); + room.AddTextBox("S Become the Solderpen. SPACEBAR toggles on/off.", + 2 * 28, 5 * 32, 500); + room.AddTextBox("C Become the Cursor. SPACEBAR toggles on/off.", + 2 * 28, 7 * 32, 500); + room.AddTextBox("T Summons Toolkit to your room. Open/close Toolkit in room.", + 2 * 28, 9 * 32, 500); + room.AddTextBox("To continue, press RETURN.", 4 * 28, 11 * 32, 500); + } + { // Room 1, Title Screen + Room room = rooms.elementAt(1); + room.RoomArray = new int[][]{ + {2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("{BIG} TOOLKIT", 6 * 28, 2 * 32, 500); + room.AddTextBox("Here you will learn to use the", + 2 * 28, 3 * 32, 500); + room.AddTextBox("- Remote Control", 6 * 28, 5 * 32, 500); + room.AddTextBox("- Solderpen", 6 * 28, 6 * 32, 500); + room.AddTextBox("- Toolkit", 6 * 28, 7 * 32, 500); + room.AddTextBox("If you don't know about ROBOT ANATOMY, return to the Main Menu by using the menubar.", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 7 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 2, Remote + Room room = rooms.elementAt(2); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("This is the REMOTE CONTROL. It 'freezes' the flow of electricity.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Press R to become the Remote Control.", + 2 * 28, 6 * 32, 300); + room.AddArrow(559, 7 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + Remote remote = new Remote(); + remote.x = 17 * 28 + 14; + remote.y = 48; + remote.room = room; + items.addElement(remote); + } + { // Room 3, Freeze Electricity + Room room = rooms.elementAt(3); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("Press SPACEBAR to 'freeze' the electricity. The Remote Control turns white.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Press SPACEBAR again to let electricity flow. The Remote Control turns orange.", + 2 * 28, 10 * 32, 500); + room.AddArrow(559, 7 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + Node node = new Node(10 * 28, 4 * 32, room, Node.TYPE_STRAIGHT); + NOTGate notgate = new NOTGate(15 * 28, 6 * 32, room); + items.addElement(node); + items.addElement(notgate); + Wire wire = new Wire(node.ports[0], notgate.ports[1]); + wire = new Wire(notgate.ports[0], node.ports[2]); + } + { // Room 4, Freeze Robot + Room room = rooms.elementAt(4); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3} + }; + room.AddTextBox("Freeze the electricity to stop the robot.", + 9 * 28, 2 * 32, 300); + room.AddTextBox("Turn on the elec- tricity and the robot moves.", + 9 * 28, 5 * 32, 300); + room.AddTextBox("When the Remote Control is on, it drains electricity from the Robot's battery.", + 9 * 28, 8 * 32, 300); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new Crystal(3 * 28, 10 * 32, room, 100000)); + OrangeRobot robot = new OrangeRobot(28, 32, room); + items.addElement(robot); + RoomSensor sensor = new RoomSensor(6 * 28, 6 * 32, robot.InternalRoom, + new Crystal(0, 0, null, 0)); + items.addElement(sensor); + sensor.rotate(1); + sensor.rotate(1); + Wire wire = new Wire(sensor.ports[0], robot.devices[8].ports[0]); + wire = new Wire(robot.devices[5].ports[0], robot.devices[2].ports[0]); + wire = new Wire(robot.devices[3].ports[0], robot.devices[6].ports[0]); + wire = new Wire(robot.devices[7].ports[0], robot.devices[0].ports[0]); + wire = new Wire(robot.devices[1].ports[0], robot.devices[4].ports[0]); + robot.thrusterPower = true; + } + { // Room 5, Freeze Sensors + Room room = rooms.elementAt(5); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("Freeze the electricity again. Press C to become the cursor. Pick up the sensor and move it around the crystal.", + 2 * 28, 2 * 32, 450); + room.AddTextBox("Did the outputs change color?", + 2 * 28, 5 * 32, 200); + room.AddTextBox("Sensors don't work when the remote control is off.", + 2 * 28, 8 * 32, 350); + room.AddTextBox("Turn the remote contol on.", + 2 * 28, 11 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new Crystal(12 * 28, 4 * 32, room, 100000)); + items.addElement(new DirectionalSensor(15 * 28, 6 * 32, room, + new Crystal(0, 0, null, 0))); + } + { // Room 6, Solderpen + Room room = rooms.elementAt(6); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3} + }; + room.AddTextBox("The SOLDERPEN is used to wire OUTPUTS to INPUTS.", + 2 * 28, 2 * 32, 350); + room.AddTextBox("Press S to become the Solderpen.", + 2 * 28, 5 * 32, 400); + room.AddTextBox("Tip", + 14 * 28 + 8, 3 * 32 - 12, 50); + room.AddArrow(16 * 28 + 24, 2 * 32 + 14, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(17 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + SolderingPen sp = new SolderingPen(); + items.addElement(sp); + sp.x = 17 * 28; + sp.y = 2 * 32 - 8; + sp.room = room; + } + { // Room 7, Attach wires + Room room = rooms.elementAt(7); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0} + }; + room.AddTextBox("Move the Solderpen to the INPUT (circle) until the Solderpen tip glows orange. Press SPACEBAR.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Move the Solderpen to the OUTPUT (arrow). When the tip glows orange, press SPACEBAR. The INPUT is now wired to the OUTPUT and electricity flows between them.", + 2 * 28, 7 * 32, 400); + room.AddArrow(0, 5 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + items.addElement(new Thruster(17 * 28, 9 * 32, room, Port.ROT_RIGHT, Color.white)); + PortDevice pd = new PortDevice(15 * 28, 10 * 32, room, 28, Port.TYPE_OUTPUT); + pd.value = true; + items.addElement(pd); + } + { // Room 8, Detatch wires + Room room = rooms.elementAt(8); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0} + }; + room.AddTextBox("To disconnect the wire, move near the INPUT or OUTPUT. Press the SPACEBAR when the tip glows green.", + 2 * 28, 2 * 32, 400); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + Thruster thruster = new Thruster(17 * 28, 9 * 32, room, Port.ROT_RIGHT, Color.white); + items.addElement(thruster); + PortDevice pd = new PortDevice(15 * 28, 10 * 32, room, 28, Port.TYPE_OUTPUT); + pd.value = true; + items.addElement(pd); + Wire wire = new Wire(thruster.ports[0], pd.ports[0]); + } + { // Room 9, Stretch Wires + Room room = rooms.elementAt(9); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("When you connect inputs to outputs, you create CIRCUITS.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Change to the cursor and pick up part of this circuit.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("The wire will stretch as you move, but break if you leave the room.", + 2 * 28, 6 * 32, 500); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + NOTGate ng = new NOTGate(15 * 28, 7 * 32, room); + ORGate og = new ORGate(10 * 28, 7 * 32, room); + og.rotate(1); + og.rotate(1); + items.addElement(ng); + items.addElement(og); + Wire wire = new Wire(ng.ports[1], og.ports[0]); + wire = new Wire(og.ports[2], ng.ports[0]); + } + { // Room 10, Stretch Wires + Room room = rooms.elementAt(10); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("Practice wiring circuits in the orange robot above. (Don't forget to come back!)", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Go inside the robot and rewire the bumpers to the thrusters in any way you like.", + 2 * 28, 5 * 32, 400); + room.AddTextBox("To start the robot moving, put it against a wall.", + 2 * 28, 8 * 32, 400); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 11, Toolkit is here + Room room = rooms.elementAt(11); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("This is the TOOLKIT. Inside are parts you need to wire circuits.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Press C to become the cursor and pick up the Toolkit.", + 2 * 28, 5 * 32, 400); + room.AddTextBox("Carry it into the next room.", + 2 * 28, 8 * 32, 400); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + toolbox = new ToolBox(15 * 28, 2 * 32, room); + items.addElement(toolbox); + } + { // Room 12, Open and Close Toolkit + Room room = rooms.elementAt(12); + room.RoomArray = new int[][]{ + {3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("Drop Toolkit here.", + 4 * 28, 4 * 32, 100); + room.AddTextBox("You can open and close the Toolkit by pressing T. Try it a few times.", + 2 * 28, 7 * 32, 300); + room.AddTextBox("Leave the Toolkit here.", + 2 * 28, 10 * 32, 400); + room.AddArrow(9 * 28, 5 * 32, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 13, Toolkit Sentry + Room room = rooms.elementAt(13); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 3}, + {3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 0}, + {3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 0}, + {3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 0}, + {3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 0}, + {0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("NO TOOLKITS ALLOWED!", + 2 * 28, 2 * 32, 150); + room.AddArrow(559, 6 * 32, Arrow.DIR_RIGHT, 28, Color.white); + items.add(new SentryT2(2 * 28, 2 * 32, room)); + } + { // Room 14, Summon Toolkit + Room room = rooms.elementAt(14); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("Do you want the Toolkit? Press T to summon it. Drop the Toolkit and press T to open and close it.", + 2 * 28, 2 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 15, Objects in Toolkit + Room room = rooms.elementAt(15); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("You can take parts in and out of the Toolkit with the cursor.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("To take a part out, move on top of it and press the SPACEBAR. To put it back, drop it anywhere in the Toolkit.", + 2 * 28, 5 * 32, 500); + room.AddTextBox("Open Toolkit here.", + 3 * 28, 9 * 32, 100); + room.AddArrow(7 * 28, 10 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 16, Rotating Objects + Room room = rooms.elementAt(16); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("You can rotate parts left and right by holding a part and pressing the [ and ] keys.", + 2 * 28, 2 * 32, 450); + room.AddTextBox("There is no limit to the number of parts you can take out of the Toolkit.", + 2 * 28, 5 * 32, 450); + room.AddTextBox("Open Toolkit here.", + 3 * 28, 9 * 32, 100); + room.AddArrow(7 * 28, 10 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 17, Hot Cursor + Room room = rooms.elementAt(17); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("You can make the cursor HOT with elctricity. Press H.", + 6 * 28, 2 * 32, 300); + room.AddTextBox("Pass the hot cursor over the antenna INPUT to turn the antenna on.", + 6 * 28, 5 * 32, 300); + room.AddTextBox("Press H again to make the cursor cold.", + 6 * 28, 8 * 32, 300); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new Antenna(2 * 28, 2 * 32, room, Color.white)); + } + { // Room 18 Crossroads + Room room = rooms.elementAt(18); + room.RoomArray = new int[][]{ + {4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4} + }; + room.AddTextBox("{BIG} CROSSROADS", + 3 * 28, 4 * 32, 500); + room.AddTextBox("(Turn the Remote Control on.)", + 4 * 28, 5 * 32, 250); + room.AddTextBox("NODES", + 2 * 28, 32 + 16, 300); + room.AddTextBox("FLIPFLOPS", + 15 * 28, 32 + 16, 300); + room.AddTextBox("LOGIC GATES", + 16 * 28, 6 * 32, 100); + room.AddTextBox("When you have learned all about the Toolkit, go this way.", + 4 * 28, 9 * 32, 300); + room.AddArrow(3 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(17 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(559, 6 * 32, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(10 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 19, Paths to Nodes & FlipFlops + Room room = rooms.elementAt(19); + room.RoomArray = new int[][]{ + {4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4} + }; + room.AddArrow(3 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(0, 6 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 20, Nodes Intro + Room room = rooms.elementAt(20); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Nodes make electricity branch to two or three places.", + 2 * 28, 2 * 32, 350); + room.AddTextBox("Take a node from the Toolkit and carry it to the next room.", + 2 * 28, 9 * 32, 500); + room.AddArrow(0, 6 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + items.addElement(new Node(13 * 28, 32 + 16, room, Node.TYPE_STRAIGHT)); + items.addElement(new Node(15 * 28, 32 + 16, room, Node.TYPE_RIGHT)); + items.addElement(new Node(17 * 28, 32 + 16, room, Node.TYPE_THREE)); + } + { // Room 21, Nodes Workshop + Room room = rooms.elementAt(21); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Wire the INPUT (circle) of the node to the OUTPUT of the CONTACT sensor. Wire the node outputs to the thrusters.", + 2 * 28, 2 * 32, 275); + room.AddTextBox("Drop the blue key so that it touches the sensor. Electricity flows to both thrusters.", + 2 * 28, 9 * 32, 500); + items.addElement(new Key(11 * 28, 2 * 32, room, Color.white)); + items.addElement(new ContactSensor(11 * 28, 4 * 32, room, new Key(0, 0, null, Color.white))); + items.addElement(new Thruster(15 * 28, 32 + 16, room, Port.ROT_UP, Color.white)); + items.addElement(new Thruster(16 * 28, 3 * 32, room, Port.ROT_RIGHT, Color.white)); + } + { // Room 22, Flipflop intro + Room room = rooms.elementAt(22); + room.RoomArray = new int[][]{ + {2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("A flipflop is like a light switch. It 'flips' electricity from one output to the other.", + 5 * 28, 2 * 32, 300); + room.AddTextBox("Take a flipflop from the Toolkit. Put the hot cursor on one input at a time to make the electricity 'flip' or 'flop'.", + 5 * 28, 6 * 32, 300); + items.addElement(new FlipFlop(17 * 28 + 7, 32 + 16, room)); + room.AddArrow(3 * 28, 0, Arrow.DIR_UP, 28, Color.white); + } + { // Room 23, Flipflop workshop + Room room = rooms.elementAt(23); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Go inside the robot and wire the orange OUTPUT of the flipflop to the thruster on the right. Sit on the eye to see what you did.", + 5 * 28, 8 * 32, 420); + BlueRobot robot = new BlueRobot(9 * 28, 4 * 32, room); + items.addElement(robot); + FlipFlop ff = new FlipFlop(10 * 28, 5 * 32, robot.InternalRoom); + items.addElement(ff); + Wire wire = new Wire(ff.ports[0], robot.devices[7].ports[0]); + wire = new Wire(ff.ports[2], robot.devices[3].ports[0]); + wire = new Wire(robot.devices[5].ports[0], ff.ports[1]); + robot.thrusterPower = true; + } + { // Room 24, Crossroads II + Room room = rooms.elementAt(24); + room.RoomArray = new int[][]{ + {4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} + }; + room.AddTextBox("Crossroads", + 2 * 28, 6 * 32 + 8, 500); + room.AddTextBox("NOT-gate", + 2 * 28, 32 + 16, 500); + room.AddTextBox("AND-gate", + 15 * 28, 2 * 32 + 16, 500); + room.AddTextBox("XOR-gate", + 15 * 28, 10 * 32, 500); + room.AddTextBox("OR-gate", + 2 * 28, 10 * 32 + 16, 500); + room.AddArrow(3 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(559, 2 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + room.AddArrow(0, 6 * 32, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 25, NOT gate intro + Room room = rooms.elementAt(25); + room.RoomArray = new int[][]{ + {2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("A NOT-gate inverts electricity flow. It turns on when its INPUT is NOT on.", + 5 * 28, 2 * 32, 300); + room.AddTextBox("Take a NOT-gate from the Toolkit and use the hot cursor to see how it works.", + 5 * 28, 6 * 32, 400); + items.addElement(new NOTGate(17 * 28 + 10, 32 + 12, room)); + room.AddArrow(3 * 28, 0, Arrow.DIR_UP, 28, Color.white); + } + { // Room 26, NOT gate workshop + Room room = rooms.elementAt(26); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Wire the NOT-gate output to the Antenna INPUT.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("The antenna beeps when the crystal is NOT touching the CONTACT sensor.", + 5 * 28, 8 * 32, 400); + items.addElement(new Crystal(3 * 28, 7 * 32, room, 100000)); + ContactSensor sensor = new ContactSensor(2 * 28, 6 * 32, room, new Crystal(0, 0, null, 0)); + items.addElement(sensor); + NOTGate ng = new NOTGate(4 * 28, 4 * 32, room); + items.addElement(ng); + items.addElement(new Antenna(2 * 28, 2 * 32, room, Color.white)); + Wire wire = new Wire(sensor.ports[0], ng.ports[0]); + } + { // Room 27, OR gate intro + Room room = rooms.elementAt(27); + room.RoomArray = new int[][]{ + {2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2} + }; + room.AddTextBox("An OR-gate turns on when one OR the other INPUT is on, or both.", + 5 * 28, 2 * 32, 300); + room.AddTextBox("Take an OR-gate from the Toolkit and use the hot cursor to see how it works.", + 2 * 28, 8 * 32, 400); + items.addElement(new ORGate(17 * 28 + 10, 32 + 12, room)); + room.AddArrow(17 * 28, 0, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 28, OR workshop + Room room = rooms.elementAt(28); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Wire the OR-gate output to the Antenna INPUT.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("The antenna beeps when the key is above OR left of the sensor.", + 5 * 28, 10 * 32, 400); + items.addElement(new Key(3 * 28, 7 * 32, room, Color.blue)); + DirectionalSensor sensor = new DirectionalSensor(8 * 28, 6 * 32, room, + new Key(0, 0, null, Color.white)); + items.addElement(sensor); + ORGate og = new ORGate(4 * 28, 4 * 32, room); + items.addElement(og); + items.addElement(new Antenna(2 * 28, 2 * 32, room, Color.white)); + Wire wire = new Wire(sensor.ports[0], og.ports[1]); + wire = new Wire(sensor.ports[3], og.ports[0]); + } + { // Room 29, Paths to AND & XOR + Room room = rooms.elementAt(29); + room.RoomArray = new int[][]{ + {4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} + }; + room.AddArrow(9 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(5 * 28, 0, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 30, AND gate intro + Room room = rooms.elementAt(30); + room.RoomArray = new int[][]{ + {2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("An AND-gate turns on when its left AND right INPUTS are on.", + 5 * 28, 2 * 32, 300); + room.AddTextBox("Take a AND-gate from the Toolkit and test it with the hot cursor.", + 5 * 28, 6 * 32, 400); + items.addElement(new ANDGate(17 * 28 + 10, 32 + 12, room)); + room.AddArrow(3 * 28, 0, Arrow.DIR_UP, 28, Color.white); + } + { // Room 31, AND gate workshop + Room room = rooms.elementAt(31); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Wire the AND-gate output to the Antenna INPUT.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("The antenna beeps when the key is left AND up from this DIRECTIONAL sensor.", + 5 * 28, 9 * 32, 400); + items.addElement(new Key(3 * 28, 7 * 32, room, Color.blue)); + DirectionalSensor sensor = new DirectionalSensor(5 * 28, 6 * 32, room, + new Key(0, 0, null, Color.white)); + items.addElement(sensor); + ANDGate ag = new ANDGate(4 * 28, 4 * 32, room); + items.addElement(ag); + items.addElement(new Antenna(2 * 28, 2 * 32, room, Color.white)); + Wire wire = new Wire(sensor.ports[0], ag.ports[1]); + wire = new Wire(sensor.ports[3], ag.ports[0]); + } + { // Room 32, XOR gate intro + Room room = rooms.elementAt(32); + room.RoomArray = new int[][]{ + {2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2} + }; + room.AddTextBox("An EXCLUSIVE-OR- gate (XOR-gate) turns on when one OR the other INPUT is on, NOT both.", + 7 * 28, 2 * 32, 250); + room.AddTextBox("Take an XOR-gate from the Toolkit and test it with the hot cursor.", + 2 * 28, 9 * 32, 400); + items.addElement(new XORGate(17 * 28 + 10, 32 + 12, room)); + room.AddArrow(17 * 28, 0, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 33, XOR workshop + Room room = rooms.elementAt(33); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Wire the XOR-gate output to the Antenna INPUT.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("The antenna beeps when either the key or the crystal is in the room, but not both.", + 5 * 28, 9 * 32, 400); + items.addElement(new Key(2 * 28, 9 * 32, room, Color.blue)); + items.addElement(new Crystal(2 * 28, 7 * 32, room, 100000)); + RoomSensor sensor1 = new RoomSensor(8 * 28, 6 * 32, room, new Key(0, 0, null, Color.white)); + RoomSensor sensor2 = new RoomSensor(8 * 28, 7 * 32, room, new Crystal(0, 0, null, 0)); + sensor1.rotate(1); + sensor1.rotate(1); + sensor2.rotate(1); + sensor2.rotate(1); + items.addElement(sensor1); + items.addElement(sensor2); + XORGate xg = new XORGate(4 * 28, 4 * 32, room); + items.addElement(xg); + items.addElement(new Antenna(2 * 28, 2 * 32, room, Color.white)); + Wire wire = new Wire(sensor1.ports[0], xg.ports[1]); + wire = new Wire(sensor2.ports[0], xg.ports[0]); + } + { // Room 34, Circuit Ideas I + Room room = rooms.elementAt(34); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("Try these robot circuits in the robot below.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("LEFT WALL CRAWLER", + 3 * 28, 4 * 32, 500); + room.AddTextBox("Rewire the NOT gate to the thruster on the right.", + 4 * 28, 4 * 32 + 16, 400); + room.AddTextBox("PING-PONG", + 3 * 28, 7 * 32, 500); + room.AddTextBox("Unwire the NOT-gate. Use a second flipflop wired the same way as the robot in the flipflop example above.", + 4 * 28, 7 * 32 + 16, 400); + room.AddTextBox("MORE CIRCUIT IDEAS", + 0, 9 * 32, 100); + room.AddTextBox("ROBOT", + 9 * 28, 11 * 32, 400); + room.AddArrow(10 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 35, Circuit Ideas II + Room room = rooms.elementAt(35); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("KEY-PHOBE", + 2 * 28, 2 * 32, 450); + room.AddTextBox("Wire a key DIRECTIONAL sensor's outputs to the thrusters they point toward.", + 3 * 28, 2 * 32 + 16, 450); + room.AddTextBox("NON-KEY-GRABBER", + 2 * 28, 5 * 32, 450); + room.AddTextBox("Wire a key CONTACT sensor to a NOT-gate. Wire the NOT-gate to the grabber input.", + 3 * 28, 5 * 32 + 16, 450); + room.AddTextBox("CRYSTAL-SIGNALER", + 2 * 28, 8 * 32, 450); + room.AddTextBox("Wire the crystal IN-SAME-ROOM sensor to the antenna.", + 3 * 28, 8 * 32 + 16, 450); + } + { // Room 36, Robot Play area 1 + Room room = rooms.elementAt(36); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3} + }; + WhiteRobot robot = new WhiteRobot(0, 6 * 32, room); + items.addElement(robot); + NOTGate ng = new NOTGate(3 * 28, 5 * 32, robot.InternalRoom); + items.addElement(ng); + ng.rotate(1); + ng.rotate(1); + FlipFlop ff = new FlipFlop(10 * 28, 4 * 32, robot.InternalRoom); + items.addElement(ff); + Wire wire = new Wire(robot.devices[3].ports[0], ng.ports[1]); + wire = new Wire(robot.devices[6].ports[0], ff.ports[0]); + wire = new Wire(ff.ports[1], robot.devices[4].ports[0]); + wire = new Wire(ff.ports[2], robot.devices[2].ports[0]); + wire = new Wire(ff.ports[3], robot.devices[0].ports[0]); + ContactSensor sensor = new ContactSensor(15 * 28, 6 * 32, robot.InternalRoom, + new Button(0, 0, null, Color.white)); + items.addElement(sensor); + robot.thrusterPower = true; + items.addElement(new Key(2 * 28, 9 * 32, room, Color.blue)); + items.addElement(new Crystal(4 * 28, 9 * 32, room, 100000)); + } + { // Room 37, Robot Play area 2 + Room room = rooms.elementAt(37); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0}, + {3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0}, + {3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0}, + {3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0}, + {3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + items.addElement(new Button(16 * 28, 32 + 16, room, new Color(255, 128, 0))); + } + { // Room 38, Robot Play area 3 + Room room = rooms.elementAt(38); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 3, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + items.addElement(new Button(12 * 28, 5 * 32, room, new Color(0, 0, 255))); + } + { // Room 39, End + Room room = rooms.elementAt(39); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Now you know how to use the Solderpen, Remote Control, and Toolkit.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("You also know how nodes, flipflops, and logic gates work.", + 2 * 28, 3 * 32 + 16, 500); + room.AddTextBox("You can use these to design and build robots in ROBOTROPOLIS and the INNOVATION LAB.", + 2 * 28, 6 * 32, 500); + room.AddTextBox("Go to CHIP DESIGN.", + 6 * 28, 9 * 32, 500); + room.AddTextBox("Return to MAIN MENU.", + 6 * 28, 11 * 32, 500); + } + { // Room 40, Wire Flipping + Room room = rooms.elementAt(40); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("Wires are normally drawn as a horizontal line and a vertical line attached to the 1st and 2nd ports. But these can be 'flipped' without having to remove the wire.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Become the Soldering Pen and move the tip over any wired port until the tip turns green and then press F.", + 2 * 28, 6 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + NOTGate ng1 = new NOTGate(6 * 28, 10 * 32, room); + items.addElement(ng1); + ng1.rotate(1); + NOTGate ng2 = new NOTGate(12 * 28, 8 * 32, room); + items.addElement(ng2); + Wire wire = new Wire(ng1.ports[1], ng2.ports[0]); + } + { // Room 41, Gate Flipping + Room room = rooms.elementAt(41); + room.RoomArray = new int[][]{ + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("AND, OR, XOR, and FlipFlops can also be flipped so their inputs (and outputs) can switch connections without having to rewire them.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Become the cursor and pick up a gate, and then press F.", + 2 * 28, 5 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + NOTGate ng1 = new NOTGate(4 * 28, 10 * 32, room); + ng1.rotate(1); + items.addElement(ng1); + NOTGate ng2 = new NOTGate(8 * 28, 10 * 32, room); + ng2.rotate(-1); + items.addElement(ng2); + NOTGate ng3 = new NOTGate(10 * 28, 10 * 32, room); + ng3.rotate(1); + items.addElement(ng3); + NOTGate ng4 = new NOTGate(14 * 28, 10 * 32, room); + ng4.rotate(-1); + items.addElement(ng4); + ANDGate ag = new ANDGate(6 * 28, 8 * 32, room); + ag.rotate(1); + items.addElement(ag); + XORGate xg = new XORGate(12 * 28, 8 * 32, room); + xg.rotate(-1); + items.addElement(xg); + FlipFlop ff = new FlipFlop(9 * 28, 7 * 32, room); + items.addElement(ff); + ORGate og = new ORGate(12 * 28, 6 * 32, room); + og.rotate(1); + items.addElement(og); + new Wire(ag.ports[0], ng1.ports[1]); + new Wire(ng2.ports[1], ag.ports[1]); + new Wire(ng3.ports[1], xg.ports[0]); + new Wire(xg.ports[1], ng4.ports[1]); + new Wire(ag.ports[2], ff.ports[0]); + new Wire(xg.ports[2], ff.ports[1]); + new Wire(og.ports[0], ff.ports[2]); + new Wire(og.ports[1], ff.ports[3]); + } + + + int[] list1 = {1, 2, 3, 4, 5, 6}; + LinkRoomsHorizontally(list1); + int[] list2 = {11, 10, 9, 8, 7}; + LinkRoomsHorizontally(list2); + int[] list3 = {12, 13, 14, 15, 16, 40, 41, 17, 18, 24, 29}; + LinkRoomsHorizontally(list3); + int[] list4 = {23, 22, 19, 18, 34, 36, 39, 1}; + LinkRoomsVertically(list4); + int[] list5 = {26, 25, 24, 27, 28}; + LinkRoomsVertically(list5); + int[] list6 = {31, 30, 29, 32, 33}; + LinkRoomsVertically(list6); + LinkRoomsLeftRight(21, 20); + LinkRoomsLeftRight(20, 19); + LinkRoomsLeftRight(35, 34); + LinkRoomsLeftRight(37, 36); + LinkRoomsUpDown(4, 10); + LinkRoomsUpDown(6, 7); + LinkRoomsUpDown(11, 12); + LinkRoomsUpDown(37, 38); + + gameCursor = new LabCursor(16 * 28 + 14, 5 * 32 + 16, rooms.elementAt(1)); + helpCam = new HelpCam(rooms.elementAt(0)); + solderingPen = new SolderingPen(); + remote = new Remote(); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + player = gameCursor; + currentViewer = player; + } } diff --git a/src/com/droidquest/levels/ROTut3.java b/src/com/droidquest/levels/ROTut3.java index 8fe969a..69bee15 100644 --- a/src/com/droidquest/levels/ROTut3.java +++ b/src/com/droidquest/levels/ROTut3.java @@ -1,1312 +1,1234 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.Wire; -import com.droidquest.avatars.HelpCam; -import com.droidquest.avatars.LabCursor; -import com.droidquest.avatars.PaintBrush; -import com.droidquest.avatars.Remote; -import com.droidquest.avatars.SolderingPen; +import com.droidquest.avatars.*; import com.droidquest.chipstuff.Port; import com.droidquest.decorations.Arrow; -import com.droidquest.devices.Antenna; -import com.droidquest.devices.ContactSensor; -import com.droidquest.devices.DirectionalSensor; -import com.droidquest.devices.NOTGate; -import com.droidquest.devices.Node; -import com.droidquest.devices.PortDevice; -import com.droidquest.devices.PrototypeChip; -import com.droidquest.devices.RoomSensor; -import com.droidquest.devices.SmallChip; -import com.droidquest.items.AutoWire; -import com.droidquest.items.BlueRobot; -import com.droidquest.items.Burner; -import com.droidquest.items.Crystal; -import com.droidquest.items.Factory; -import com.droidquest.items.Hexagon; -import com.droidquest.items.MazeControl; -import com.droidquest.items.MazeCreator; -import com.droidquest.items.MazeLock; -import com.droidquest.items.OrangeRobot; -import com.droidquest.items.Square; -import com.droidquest.items.ToolBox; -import com.droidquest.items.Triangle; -import com.droidquest.items.WhiteRobot; -import com.droidquest.items.WireTester; -import com.droidquest.materials.ChipTester; -import com.droidquest.materials.ChipTrash; -import com.droidquest.materials.CrystalRecharger; -import com.droidquest.materials.Material; -import com.droidquest.materials.Portal; -import com.droidquest.materials.ShapeEditor; +import com.droidquest.devices.*; +import com.droidquest.items.*; +import com.droidquest.materials.*; -class ROTut3 extends Level -{ -public ROTut3(RoomDisplay rd) - { - super(rd); - - // Material 0, Blank - materials.addElement(new Material(true, false)); - // Material 1, Green Wall - materials.addElement(new Material(new Color(0,255,0),false, true)); - // Material 2, Light Blue Wall - materials.addElement(new Material(new Color(190,190,255),false,true)); - // Material 3, Blue Wall - materials.addElement(new Material(new Color(0,0,255),false, true)); - // Material 4, LightOrange Wall - materials.addElement(new Material(new Color(255,224,192),false, true)); - // Material 5, Red Wall - materials.addElement(new Material(new Color(255,0,0),false, true)); - // Material 6, Recharger - materials.addElement(new CrystalRecharger()); - // Material 7, Crystal Shape Editor - materials.addElement(new ShapeEditor(new Crystal(0,0,null,0))); - // Material 8, Hexagon Shape Editor - materials.addElement(new ShapeEditor(new Hexagon(0,0,null,Color.blue))); - // Material 9, Square Shape Editor - materials.addElement(new ShapeEditor(new Square(0,0,null,Color.white))); - // Material 10, Triangle Shape Editor - materials.addElement(new ShapeEditor(new Triangle(0,0,null,new Color(255,128,0)))); - // Material 11, Portal to Innovation Lab; - materials.addElement(new Portal("ROLab.lvl",false, true)); - // Material 12, Portal to Main Menu; - materials.addElement(new Portal("MainMenu.lvl",false, true)); - // Material 13, Trash - materials.addElement(new ChipTrash()); - // Material 14, ChipTester - materials.addElement(new ChipTester()); - // Material 15, MazeLock - materials.addElement(new MazeLock()); - - for (int a=0; a<42; a++) - rooms.addElement(new Room()); +import java.awt.*; - { // Room 0, Help Screen - Room room = (Room) rooms.elementAt(0); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} - }; - room.RoomArray = table; - room.AddTextBox("INNOVATION LAB Chip Functions",3*28, 2*32, 500); - room.AddTextBox("BURN:", - 2*28, 4*32, 500); - room.AddTextBox("Wire prototype. Position chips in Burner Room. Activate burn button.", - 6*28, 4*32, 400); - room.AddTextBox("SAVE:", - 2*28, 6*32, 500); - room.AddTextBox("Pick up Chip. Press S", - 6*28, 6*32, 500); - room.AddTextBox("LOAD:", - 2*28, 7*32, 500); - room.AddTextBox("Pick up chip. Press L", - 6*28, 7*32, 500); - room.AddTextBox("RECORD:", - 2*28, 8*32, 500); - room.AddTextBox("Pick up chip. Press ?", - 6*28, 8*32, 500); - room.AddTextBox("To continue, press RETURN.", 4*28, 11*32, 500); - } - { // Room 1, Title Screen - Room room = (Room) rooms.elementAt(1); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("{BIG} Chip Design", 4*28+16, 2*32, 500); - room.AddTextBox("Welcome! Here you will learn about things you can do in the INNOVATION LAB. You'll learn how to use the:", - 2*28, 3*32, 500); - room.AddTextBox("- Chips", 6*28, 5*32, 500); - room.AddTextBox("- Paintbrush", 6*28, 6*32, 500); - room.AddTextBox("- Factories", 6*28, 7*32, 500); - room.AddTextBox("- Shape Editor", 6*28, 8*32, 500); - room.AddTextBox("If you don't know about ROBOT ANATOMY and TOOLKIT, return to the Main Menu by using the menubar.", - 2*28, 9*32, 500); - room.AddArrow(559,7*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 2, Crossroads - Room room = (Room) rooms.elementAt(2); - int[][] table = { - {2,0,0,0,0,2,2,2,0,0,0,0,2,2,2,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,2}, - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("{BIG} CROSSROADS", 5*28, 5*32, 500); - room.AddTextBox("PAINTBRUSH", 28+14, 2*32, 500); - room.AddTextBox("FACTORY", 8*28+14, 2*32, 100); - room.AddTextBox("SHAPE EDITOR", 16*28, 2*32, 100); - room.AddTextBox("CHIPS", 16*28, 8*32-8, 500); - room.AddTextBox("When you have learned about the Paintbrush, shape editor, and chips, go this way.", - 5*28, 9*32, 400); - room.AddArrow(3*28,0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(10*28,0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(17*28,0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(559,7*32+16, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(10*28,383, Arrow.DIR_DOWN, 28, Color.white); - toolbox = new ToolBox(28,10*32,room); - items.addElement(toolbox); - } - { // Room 3, Paths to Paintbrush & Shape Editor - Room room = (Room) rooms.elementAt(3); - int[][] table = { - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2}, - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2}, - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2}, - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2}, - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2}, - {0,0,0,0,0,2,2,2,0,0,0,0,2,2,2,0,0,0,0,0}, - {0,0,0,0,0,2,2,2,0,0,0,0,2,2,2,0,0,0,0,0}, - {0,0,0,0,0,2,2,2,0,0,0,0,2,2,2,0,0,0,0,0}, - {2,0,0,0,0,2,2,2,0,0,0,0,2,2,2,0,0,0,0,2}, - {2,0,0,0,0,2,2,2,0,0,0,0,2,2,2,0,0,0,0,2}, - {2,0,0,0,0,2,2,2,0,0,0,0,2,2,2,0,0,0,0,2}, - {2,0,0,0,0,2,2,2,0,0,0,0,2,2,2,0,0,0,0,2} - }; - room.RoomArray = table; - room.AddArrow(0,6*32+16, Arrow.DIR_LEFT, 28, Color.white); - room.AddArrow(10*28,0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(559,6*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 4, Paintbrush intro - Room room = (Room) rooms.elementAt(4); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("This is a PAINTBRUSH.", - 2*28, 2*32, 300); - room.AddTextBox("Use it in special rooms in the INNOVATION LAB to design mazes.", - 2*28, 3*32, 400); - room.AddTextBox("Press P to become the Paintbrush.", - 2*28, 8*32, 500); - room.AddTextBox("Press C to become the Cursor.", - 2*28, 10*32, 500); -// PaintBrush pb = new PaintBrush(); -// pb.x = 17*28+10; -// pb.y = 44; -// pb.room = room; -// items.addElement(pb); - room.AddArrow(0,6*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 5, Paintbrush intro 2 - Room room = (Room) rooms.elementAt(5); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Try painting and erasing walls in the maze rooms below.", - 2*28, 2*32, 500); - room.AddTextBox("To paint, press the SPACEBAR and move the paintbrush.", - 2*28, 4*32, 500); - room.AddTextBox("To erase, sit on a wall and press SPACEBAR as you move.", - 2*28, 6*32, 500); - room.AddTextBox("Paintable Maze Rooms", - 1*28, 9*32, 100); - room.AddTextBox("Return to the Cross- roads when you have finished your maze.", - 9*28, 9*32, 300); - room.AddArrow(3*28,383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 6, Maze Top Left - Room room = (Room) rooms.elementAt(6); - int[][] table = { - {5,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0}, - {5,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5} - }; - room.RoomArray = table; - room.editable=true; - } - { // Room 7, Maze Top Right - Room room = (Room) rooms.elementAt(7); - int[][] table = { - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,5}, - {5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,5} - }; - room.RoomArray = table; - room.editable=true; - } - { // Room 8, Maze Bottom Left - Room room = (Room) rooms.elementAt(8); - int[][] table = { - {5,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5} - }; - room.RoomArray = table; - room.editable=true; - } - { // Room 9, Maze Bottom Right - Room room = (Room) rooms.elementAt(9); - int[][] table = { - {5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5} - }; - room.RoomArray = table; - room.editable=true; - } - { // Room 10, Shape Editor intro - Room room = (Room) rooms.elementAt(10); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("The INNOVATION LAB contains a SHAPE EDITOR like the one next door.", - 2*28, 2*32, 500); - room.AddTextBox("You can use the shape editor to change the shapes of the sensors and the objects they detect.", - 2*28, 5*32, 500); - room.AddTextBox("Go try the shape editor. Take the crystal or sensor with you.", - 2*28, 10*32, 500); - room.AddArrow(559,6*32+16, Arrow.DIR_RIGHT, 28, Color.white); - items.addElement(new Crystal(5*28, 8*32, room, 100000)); - items.addElement(new DirectionalSensor(11*28, 6*32, room, new Crystal(0,0,null,0))); - } - { // Room 11, Shape Editor room - Room room = (Room) rooms.elementAt(11); - int[][] table = { - {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 0, 7, 0, 0, 0, 0, 8, 0, 0, 0, 0, 9, 0, 0, 0, 0,10, 0, 4}, - {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, - {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} - }; - room.RoomArray = table; - room.AddTextBox("Shape Editor", 7*28, 2*32, 200); - room.AddTextBox("Shape Icons", 7*28, 8*32, 200); - room.AddTextBox("Pass a sensor or item over one of the shape icons to change it to that shape.", - 2*28, 3*32, 500); - room.AddArrow(559,6*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 12, Shape Editor workshop - Room room = (Room) rooms.elementAt(12); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("This robot will beep when it touches an energy crystal. Try it.", - 2*28, 2*32, 400); - room.AddTextBox("Now, unwire the sensor in the robot and change its shape to a triangle.", - 2*28, 5*32, 400); - room.AddTextBox("Wire it up again and make it beep when it touches the triangle.", - 2*28, 8*32, 500); - room.AddTextBox("Then return to the Crossroads.", - 2*28, 10*32, 500); - BlueRobot robot = new BlueRobot(16*28, 2*32, room); - items.addElement(robot); - ContactSensor sensor = new ContactSensor(4*28, 6*32, robot.InternalRoom, new Crystal(0,0,null,0)); - items.addElement(sensor); - Wire wire = new Wire(robot.devices[8].ports[0], sensor.ports[0]); - items.addElement(new Triangle(15*28, 4*32, room, new Color(255,128,0))); - items.addElement(new Crystal(17*28, 4*32, room, 100000)); - } - { // Room 13, Prototype Intro - Room room = (Room) rooms.elementAt(13); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("This is a PROTOTYPE CHIP. It has 8 pins that can be soldered to wires.", - 2*28, 2*32, 250); - room.AddTextBox("Notice how the pins are numbered.", - 2*28, 5*32, 250); - room.AddTextBox("CROSSROADS", - 36, 7*32+24, 300); - room.AddTextBox("The pins on this chip are neither outputs nor inputs because the chip isn't wired.", - 2*28, 10*32, 550); - room.AddTextBox("1 2 3 4", - 13*28, 2*32, 30); - room.AddTextBox("8 7 6 5", - 18*28, 2*32, 30); - room.AddArrow(0,7*32+16, Arrow.DIR_LEFT, 28, Color.white); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - items.addElement(new PrototypeChip(14*28, 2*32-8,room)); - } - { // Room 14, Prototype Intro 2 - Room room = (Room) rooms.elementAt(14); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("But chips can be wired inside!", - 2*28, 2*32, 500); - room.AddTextBox("You can create circuits inside a prototype chip (using nodes, fliplflops, and logic gates) and connect them to the pins inside.", - 2*28, 4*32, 480); - room.AddTextBox("When a chip is wired, pins change to outputs or inputs, depending on how they are wired. Unwired pins remain neutral.", - 2*28, 8*32, 480); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 15, Prototype Chip - Room room = (Room) rooms.elementAt(15); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("This prototype chip has a circuit inside.", - 2*28, 2*32, 400); - room.AddTextBox("This circuit sends out pulses of electricity. Go inside the chip and see.", - 2*28, 5*32, 400); - room.AddTextBox("Because of the circuit wiring, pin 1 is now an input on the inside and an output on the outside.", - 2*28, 8*32, 500); - room.AddTextBox("Take the chip with you.", - 2*28, 11*32, 500); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - PrototypeChip pc = new PrototypeChip(14*28, 2*32-8,room); - items.addElement(pc); - Node node = new Node(4*28, 2*32, pc.InternalRoom, Node.TYPE_STRAIGHT); - items.addElement(node); - NOTGate ng = new NOTGate(6*28, 3*32, pc.InternalRoom); - items.addElement(ng); - Wire wire = new Wire(node.ports[0], ng.ports[1]); - wire = new Wire(ng.ports[0], node.ports[2]); - wire = new Wire(pc.portdevices[0].ports[0], node.ports[1]); - } - { // Room 16, Antenna - Room room = (Room) rooms.elementAt(16); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2} - }; - room.RoomArray = table; - room.AddTextBox("You can use a chip with a circuit inside to activate a robot part.", - 5*28, 2*32, 350); - room.AddTextBox("Solder pin 1 to the INPUT of this antenna. Notice how the antenna pulses on and off.", - 5*28, 9*32, 300); - room.AddArrow(559,6*32+16, Arrow.DIR_RIGHT, 28, Color.white); - items.addElement(new Antenna(2*28, 2*32, room, Color.white)); - } - { // Room 17, Antenna & SmallChip - Room room = (Room) rooms.elementAt(17); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,2} - }; - room.RoomArray = table; - room.AddTextBox("This SMALL CHIP was created by 'burning' into it a copy of the prototype chip's circuit.", - 6*28, 2*32, 400); - room.AddTextBox("It work's just like a prototype chip, but you can't go inside.", - 6*28, 5*32, 400); - room.AddTextBox("Solder pin 1 (upper left pin) to the antenna INPUT. Does it work like the prototype chip?", - 2*28, 9*32, 450); - room.AddArrow(17*28+14,383, Arrow.DIR_DOWN, 28, Color.white); - items.addElement(new Antenna(2*28, 2*32, room, Color.white)); - SmallChip sc = new SmallChip(4*28, 4*32, room, "1"); - items.addElement(sc); - sc.LoadChip("chips/oscillator.chip"); - } - { // Room 18, Burner Intro - Room room = (Room) rooms.elementAt(18); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Small chips are 'burned' in the Burner Room of the INNOVATION LAB.", - 2*28, 2*32, 400); - room.AddTextBox("Go look at the burner room at the left.", - 2*28, 5*32, 400); - room.AddTextBox("Look here", - 0, 6*32, 100); - room.AddTextBox("To burn a chip, become the cursor and sit on the burn button. Then press SPACEBAR. Try it now and see what happens.", - 5*28, 9*32, 400); - room.AddArrow(0,7*32, Arrow.DIR_LEFT, 28, Color.white); - room.AddArrow(2*28+14,383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 19, Burner Room - Room room = (Room) rooms.elementAt(19); - int[][] table = { - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, - {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4}, - {4,0,4,0,0,0,0,4,0,0,0,0,0,0,0,0,4,0,0,0}, - {4,0,4,0,0,0,0,4,0,0,0,0,0,0,0,0,4,0,0,0}, - {4,0,4,0,0,0,0,4,0,0,0,4,0,0,4,0,4,0,0,0}, - {4,0,4,4,4,4,4,4,0,0,0,4,0,0,4,0,4,0,0,0}, - {4,0,0,0,4,4,0,0,0,0,0,4,4,4,4,0,4,0,0,4}, - {4,0,0,0,4,4,0,0,0,0,0,0,4,4,0,0,4,0,0,4}, - {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4} - }; - room.RoomArray = table; - room.AddTextBox("Burner Room", - 2*28, 2*32, 400); - room.AddTextBox("Prototype chip goes here.", - 2*28, 4*32, 250); - room.AddTextBox("Small chip goes here.", - 11*28, 6*32, 170); - room.AddTextBox("BURN BUTTON", - 17*28, 8*32, 100); - room.AddArrow(5*28,5*32+16, Arrow.DIR_DOWN, 28, Color.white); - room.AddArrow(13*28,7*32+16, Arrow.DIR_DOWN, 28, Color.white); - room.AddArrow(18*28+14,9*32+16, Arrow.DIR_DOWN, 28, Color.white); - PrototypeChip pc = new PrototypeChip(3*28+4, 5*32+12, room); - items.addElement(pc); - pc.inBurner = true; - SmallChip sc = new SmallChip(13*28-13, 8*32-15, room, "1"); - items.addElement(sc); - sc.inBurner = true; - items.addElement(new Burner(18*28, 10*32+2, room)); - } - { // Room 20, Nesting - Room room = (Room) rooms.elementAt(20); - int[][] table = { - {2,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("You can use small chips as part of a circuit inside the prototype chip. This is called 'nesting'.", - 4*28, 2*32, 400); - room.AddArrow(0,6*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 21, Nesting II - Room room = (Room) rooms.elementAt(21); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Take the shortcut up. Bring back the prototype chip and the small chip.", - 2*28, 3*32, 400); - room.AddTextBox("Disconnect the wires in the prototype chip.", - 2*28, 6*32, 400); - room.AddTextBox("Take both chips next door to try nesting the small chip inside the prototype chip.", - 2*28, 9*32, 500); - room.AddTextBox("SHORTCUT", - 14*28, 32-8, 100); - room.AddArrow(18*28+14,0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(0,6*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 22, Nesting III - Room room = (Room) rooms.elementAt(22); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Take the small chip inside the prototype chip. Solder it's pin 1 to the prototype's pin 1.", - 2*28, 2*32, 500); - room.AddTextBox("Next, solder a NOT-gate's OUTPUT to the prototype's pin 3.", - 2*28, 5*32, 500); - room.AddTextBox("Come outside and take the chip into the next room.", - 2*28, 9*32, 500); - room.AddArrow(0,6*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 23, Nesting workshop - Room room = (Room) rooms.elementAt(23); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Put the prototype chip in the robot and solder the pins as shown:", - 2*28, 2*32, 500); - room.AddTextBox("Pin 1 to the antenna INPUT Pin 2 to the left thruster", - 3*28, 4*32, 350); - room.AddTextBox("Close the robot's thruster switch.", - 5*28, 8*32, 400); - room.AddTextBox("Now you have a robot that moves right and beeps.", - 5*28, 10*32, 400); - room.AddArrow(2*28+14,383, Arrow.DIR_DOWN, 28, Color.white); - OrangeRobot robot = new OrangeRobot(16*28, 3*32, room); - items.addElement(robot); - items.addElement(new RoomSensor(8*28, 3*32, robot.InternalRoom, - new Square(0,0,null,Color.white))); - items.addElement(new ContactSensor(10*28, 5*32, robot.InternalRoom, - new Hexagon(0,0,null,Color.white))); - } - { // Room 24, Wallhugger intro - Room room = (Room) rooms.elementAt(24); - int[][] table = { - {2,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("By nesting chips inside chips, you can create very complex circuits.", - 6*28, 2*32, 400); - room.AddTextBox("This WALLHUGGER chip is an example of a complex circuit. It is wired with 16 logic gates and one nested chip.", - 6*28, 5*32, 400); - room.AddTextBox("Take the chip with you.", - 6*28, 10*32, 500); - room.AddArrow(0,9*32+16, Arrow.DIR_LEFT, 28, Color.white); - SmallChip sc = new SmallChip(4*28, 5*32, room, "3"); - items.addElement(sc); - sc.LoadChip("chips/WallHugger.chip"); - } - { // Room 25, Wallhugger wiring - Room room = (Room) rooms.elementAt(25); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("You can use chips inside robots.", - 2*28, 2*32, 400); - room.AddTextBox("Take the WALLHUGGER chip inside this robot.", - 2*28, 3*32, 400); - room.AddTextBox("Solder the pins as shown.", - 2*28, 5*32, 400); - room.AddTextBox("PIN TO PIN TO", - 2*28, 6*32, 400); - room.AddTextBox("1 top thruster 2 left bumper 3 left thruster 4 bottom bumper", - 3*28, 6*32+16, 250); - room.AddTextBox("8 top bumper 7 right thruster 6 right bumper 5 bottom thruster", - 11*28, 6*32+16, 240); - room.AddArrow(0,9*32+16, Arrow.DIR_LEFT, 28, Color.white); - WhiteRobot robot = new WhiteRobot(16*28, 3*32, room); - items.addElement(robot); - items.addElement(new DirectionalSensor(8*28, 3*32, robot.InternalRoom, - new Crystal(0,0,null,0))); - items.addElement(new ContactSensor(10*28, 5*32, robot.InternalRoom, - new Crystal(0,0,null,0))); - } - { // Room 26, Wallhugger intro II - Room room = (Room) rooms.elementAt(26); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,2} - }; - room.RoomArray = table; - room.AddTextBox("Take the robot to the maze below. Close the thruster switch.", - 2*28, 2*32, 400); - room.AddTextBox("How does the WALLHUGGER chip work in this kind of maze?", - 2*28, 5*32, 400); - room.AddTextBox("Maze", - 16*28, 11*32, 400); - room.AddArrow(17*28,383, Arrow.DIR_DOWN, 28, Color.white); - room.AddArrow(0,9*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 27, Wallhugger maze - Room room = (Room) rooms.elementAt(27); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,2}, - {2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,2,2,2,2}, - {2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,0,0,0,0,2,0,0,0,0,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - } - { // Room 28, Chip speed - Room room = (Room) rooms.elementAt(28); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Chips can also be set to run faster than normal circuits.", - 2*28, 2*32, 500); - room.AddTextBox("The Burner Room in the INNOVATION LAB has a SPEED SETTING that can be changed by using the Up and Down arrows in the Burner Room. A chip receives this speed setting when it's burned.", - 2*28, 4*32, 500); - room.AddTextBox("A chip's speed sets the number of times the chip will be processed in one INSTANT. One instant is the time it takes for a gate (outside a chip) to process its inputs and send an output.", - 2*28, 8*32, 500); - room.AddArrow(0,9*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 29, Chip talk - Room room = (Room) rooms.elementAt(29); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Here are some special uses of chips.", - 2*28, 2*32, 500); - room.AddTextBox("Chips can be wired inside other chips to create very complex chips.", - 3*28, 3*32, 450); - room.AddTextBox("Chips can be transferred to ROBOTROPOLIS where you can use them to help you escape.", - 3*28, 5*32, 450); - room.AddTextBox("Chips can be used to save space in a robot.", - 3*28, 7*32, 450); - room.AddTextBox("Chips can be used to make complex circuits run as fast as a single gate.", - 3*28, 9*32, 450); - room.AddArrow(0,9*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 30, Chip Record - Room room = (Room) rooms.elementAt(30); - int[][] table = { - {3,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("You can make a RECORD of a chip's circuit. You can then review the chip's record whenever you want.", - 4*28, 2*32, 400); - room.AddTextBox("Pick up this chip and press ? to see and edit its record.", - 4*28, 5*32, 400); - room.AddTextBox("You can also use the record to change the label on the small chip. Just change the letter in the top right field and press Save.", - 4*28, 7*32, 400); - room.AddArrow(2*28+14,0, Arrow.DIR_UP, 28, Color.white); - SmallChip sc = new SmallChip(2*28, 5*32, room, "5"); - items.addElement(sc); - sc.LoadChip("chips/gates.chip"); - } - { // Room 31, Chip Save - Room room = (Room) rooms.elementAt(31); - int[][] table = { - {3,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("You can also save a chip's circuit for later use.", - 4*28, 2*32, 400); - room.AddTextBox("To save a chip's circuit, pick up a chip in the INNOVATION LAB and press S.", - 4*28, 4*32+16, 400); - room.AddTextBox("You can recycle small chips. First save the old version of the chip. Then burn in a new circuit.", - 4*28, 8*32, 400); - room.AddArrow(2*28+14,0, Arrow.DIR_UP, 28, Color.white); - } - { // Room 32, Chip Load - Room room = (Room) rooms.elementAt(32); - int[][] table = { - {3,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("You can LOAD circuits you have saved into small chips.", - 4*28, 3*32, 400); - room.AddTextBox("To load a chip, pick up a chip and press L. A dialog box of circuit names will appear. Select the one you want.", - 4*28, 5*32, 400); - room.AddTextBox("Chips can be loaded in the INNOVATION LAB or in ROBOTROPOLIS where you can use them to help you escape.", - 4*28, 8*32, 400); - room.AddArrow(2*28+14,0, Arrow.DIR_UP, 28, Color.white); - } - { // Room 33, Exit - Room room = (Room) rooms.elementAt(33); - int[][] table = { - {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} - }; - room.RoomArray = table; - room.AddTextBox("You have learned how to use many features of the INNOVATION LAB.", - 2*28, 3*32, 500); - room.AddTextBox("Go to the INNOVATION LAB.", - 6*28, 7*32, 500); - room.AddTextBox("Return to the MAIN MENU.", - 6*28, 9*32, 500); - room.AddTextBox("Press ? for help or hints.", - 2*28, 11*32, 500); - } - { // Room 34, Paintbrush colors - Room room = (Room) rooms.elementAt(34); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("The Paintbrush can also paint walls of different colors and properties. Press P to change colors.", - 2*28, 2*32, 500); - room.AddTextBox("{255,000,000} RED {128,128,128} walls block all robots and are detectable.", - 3*28, 5*32, 500); - room.AddTextBox("{000,255,000} GREEN {128,128,128} walls block all robots and are not detectable.", - 3*28, 7*32, 450); - room.AddTextBox("{255,128,000} ORANGE, {255,255,255} WHITE, {128,128,128} and {000,000,255} BLUE {128,128,128} walls block their respectivly colored robots, and are not detectable.", - 3*28, 9*32, 500); - } +class ROTut3 extends Level { + public ROTut3(RoomDisplay rd) { + super(rd); - { // Room 35, Factory Intro - Room room = (Room) rooms.elementAt(35); - int[][] table = { - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,0,0,0,0,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("The INNOVATION LAB has two FACTORIES for creating chips, shapes, and sensors.", - 2*28, 2*32, 500); - room.AddTextBox("Factories also have TRASH containers, which you can use to dispose of items that you no longer need.", - 2*28, 5*32, 500); - room.AddTextBox("Go try the factory in the next room.", - 2*28, 8*32, 500); - room.AddArrow(11*28,0, Arrow.DIR_UP, 28, Color.white); - } - { // Room 36, Factory - Room room = (Room) rooms.elementAt(36); - int[][] table = { - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2,13,13,13,13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2,13,13,13,13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2,13,13,13,13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2,13,13,13,13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2} - }; - room.RoomArray = table; - room.AddTextBox("FACTORY", - 8*28+14, 2*32, 500); - room.AddTextBox("Press to summon an Energy Crystal", - 5*28, 3*32+24, 500); - items.addElement(new Factory(2*28,3*32,room,new Crystal(0,0,null,100000))); - room.AddArrow(3*28+14, 4*28, Arrow.DIR_LEFT, 28, Color.white); - room.AddTextBox("Drag crystal into Trash to dispose.", - 2*28, 6*32-8, 500); - room.AddTextBox("TRASH", - 2*28, 9*32, 500); - room.AddArrow(3*28, 7*32, Arrow.DIR_DOWN, 28, Color.white); - room.AddTextBox("Return to the Crossroads.", - 12*28, 10*32, 200); - } - { // Room 37, Unburning - Room room = (Room) rooms.elementAt(37); - int[][] table = { - {2,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("Chips can also be unburned.", - 2*28, 2*32, 500); - room.AddTextBox("To unburn a chip, place a burned or loaded chip into the right holder, and an empty Prototype chip in the left. Then press the UNBURN button.", - 2*28, 4*32, 500); - room.AddTextBox("The Prototype chip will automatically be wired to match the small chip's circutry.", - 2*28, 8*32, 500); - room.AddArrow(2*28+14,559, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 38, ChipTest intro - Room room = (Room) rooms.elementAt(38); - int[][] table = { - {3,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {3,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("To the Crossroads", - 28, 32+16, 500); - room.AddTextBox("The Innovation Lab also has a CHIP TESTER for testing prototype chips and small chips.", - 4*28, 3*32, 450); - room.AddTextBox("Place a chip in the holder and then press the AUTOWIRE button. The chip will be wired to the tester, and the buttons can be used to set or display port values.", - 4*28, 6*32, 450); - room.AddTextBox("Press the autowire button again to unwire the chip.", - 4*28, 10*32, 450); - room.AddArrow(28+14,0, Arrow.DIR_UP, 28, Color.white); - } - { // Room 39, Chip Testing - Room room = (Room) rooms.elementAt(39); - int[][] table = { - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 2,14,14,14,14,14,14, 2, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 2,14,14,14,14,14,14, 2, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 2,14,14,14,14,14,14, 2, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 2,14,14,14,14,14,14, 2, 0, 0, 0, 0, 0, 2}, - {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, - {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} - }; - room.RoomArray = table; - room.AddTextBox("Chip Tester", 2*28, 32+24, 500); - PortDevice[] portdevices = new PortDevice[8]; - portdevices[0] = new PortDevice(6*28,3*32+8,room,28,Port.TYPE_UNDEFINED); - portdevices[1] = new PortDevice(6*28,4*32+8,room,28,Port.TYPE_UNDEFINED); - portdevices[2] = new PortDevice(6*28,5*32+8,room,28,Port.TYPE_UNDEFINED); - portdevices[3] = new PortDevice(6*28,6*32+8,room,28,Port.TYPE_UNDEFINED); - portdevices[4] = new PortDevice(12*28+8,6*32+8,room,28,Port.TYPE_UNDEFINED); - portdevices[5] = new PortDevice(12*28+8,5*32+8,room,28,Port.TYPE_UNDEFINED); - portdevices[6] = new PortDevice(12*28+8,4*32+8,room,28,Port.TYPE_UNDEFINED); - portdevices[7] = new PortDevice(12*28+8,3*32+8,room,28,Port.TYPE_UNDEFINED); - portdevices[0].rotate(1); - portdevices[1].rotate(1); - portdevices[2].rotate(1); - portdevices[3].rotate(1); - portdevices[4].rotate(-1); - portdevices[5].rotate(-1); - portdevices[6].rotate(-1); - portdevices[7].rotate(-1); - for (int a=0; a<8; a++) - items.addElement(portdevices[a]); - items.addElement(new AutoWire(2*28,10*32,room)); - items.addElement(new WireTester(5*28,3*32,room,portdevices[0])); - items.addElement(new WireTester(5*28,4*32,room,portdevices[1])); - items.addElement(new WireTester(5*28,5*32,room,portdevices[2])); - items.addElement(new WireTester(5*28,6*32,room,portdevices[3])); - items.addElement(new WireTester(14*28+2,6*32,room,portdevices[4])); - items.addElement(new WireTester(14*28+2,5*32,room,portdevices[5])); - items.addElement(new WireTester(14*28+2,4*32,room,portdevices[6])); - items.addElement(new WireTester(14*28+2,3*32,room,portdevices[7])); - room.AddArrow(3*28,10*32+16,Arrow.DIR_LEFT,28,Color.white); - room.AddTextBox("Autowirer",4*28,11*32-8,200); - } - { // Room 40, Maze Control - Room room = (Room) rooms.elementAt(40); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; - room.AddTextBox("The Maze can also be changed to whatever size you want.", - 2*28, 2*32, 500); - room.AddTextBox("The Innovation Lab's MAZE CONTROL ROOM has five buttons that allow you to set the size the maze, and a sixth button that locks the maze by preventing the cursor from becoming the paintbrush.", - 2*28, 4*32, 500); - room.AddTextBox("You can use this to create your own puzzles and share them with your friends.", - 2*28, 8*32, 500); - room.AddTextBox("Try it in the next room.", - 2*28, 11*32, 500); - } - { // Room 41, Maze Control - Room room = (Room) rooms.elementAt(41); - int[][] table = { - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2}, - {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,2}, - {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} - }; - room.RoomArray = table; + // Material 0, Blank + materials.addElement(new Material(true, false)); + // Material 1, Green Wall + materials.addElement(new Material(new Color(0, 255, 0), false, true)); + // Material 2, Light Blue Wall + materials.addElement(new Material(new Color(190, 190, 255), false, true)); + // Material 3, Blue Wall + materials.addElement(new Material(new Color(0, 0, 255), false, true)); + // Material 4, LightOrange Wall + materials.addElement(new Material(new Color(255, 224, 192), false, true)); + // Material 5, Red Wall + materials.addElement(new Material(new Color(255, 0, 0), false, true)); + // Material 6, Recharger + materials.addElement(new CrystalRecharger()); + // Material 7, Crystal Shape Editor + materials.addElement(new ShapeEditor(new Crystal(0, 0, null, 0))); + // Material 8, Hexagon Shape Editor + materials.addElement(new ShapeEditor(new Hexagon(0, 0, null, Color.blue))); + // Material 9, Square Shape Editor + materials.addElement(new ShapeEditor(new Square(0, 0, null, Color.white))); + // Material 10, Triangle Shape Editor + materials.addElement(new ShapeEditor(new Triangle(0, 0, null, new Color(255, 128, 0)))); + // Material 11, Portal to Innovation Lab; + materials.addElement(new Portal("ROLab.lvl", false, true)); + // Material 12, Portal to Main Menu; + materials.addElement(new Portal("MainMenu.lvl", false, true)); + // Material 13, Trash + materials.addElement(new ChipTrash()); + // Material 14, ChipTester + materials.addElement(new ChipTester()); + // Material 15, MazeLock + materials.addElement(new MazeLock()); + + for (int a = 0; a < 42; a++) { + rooms.addElement(new Room()); + } + + { // Room 0, Help Screen + Room room = rooms.elementAt(0); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + }; + room.AddTextBox("INNOVATION LAB Chip Functions", 3 * 28, 2 * 32, 500); + room.AddTextBox("BURN:", + 2 * 28, 4 * 32, 500); + room.AddTextBox("Wire prototype. Position chips in Burner Room. Activate burn button.", + 6 * 28, 4 * 32, 400); + room.AddTextBox("SAVE:", + 2 * 28, 6 * 32, 500); + room.AddTextBox("Pick up Chip. Press S", + 6 * 28, 6 * 32, 500); + room.AddTextBox("LOAD:", + 2 * 28, 7 * 32, 500); + room.AddTextBox("Pick up chip. Press L", + 6 * 28, 7 * 32, 500); + room.AddTextBox("RECORD:", + 2 * 28, 8 * 32, 500); + room.AddTextBox("Pick up chip. Press ?", + 6 * 28, 8 * 32, 500); + room.AddTextBox("To continue, press RETURN.", 4 * 28, 11 * 32, 500); + } + { // Room 1, Title Screen + Room room = rooms.elementAt(1); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("{BIG} Chip Design", 4 * 28 + 16, 2 * 32, 500); + room.AddTextBox("Welcome! Here you will learn about things you can do in the INNOVATION LAB. You'll learn how to use the:", + 2 * 28, 3 * 32, 500); + room.AddTextBox("- Chips", 6 * 28, 5 * 32, 500); + room.AddTextBox("- Paintbrush", 6 * 28, 6 * 32, 500); + room.AddTextBox("- Factories", 6 * 28, 7 * 32, 500); + room.AddTextBox("- Shape Editor", 6 * 28, 8 * 32, 500); + room.AddTextBox("If you don't know about ROBOT ANATOMY and TOOLKIT, return to the Main Menu by using the menubar.", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 7 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 2, Crossroads + Room room = rooms.elementAt(2); + room.RoomArray = new int[][]{ + {2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("{BIG} CROSSROADS", 5 * 28, 5 * 32, 500); + room.AddTextBox("PAINTBRUSH", 28 + 14, 2 * 32, 500); + room.AddTextBox("FACTORY", 8 * 28 + 14, 2 * 32, 100); + room.AddTextBox("SHAPE EDITOR", 16 * 28, 2 * 32, 100); + room.AddTextBox("CHIPS", 16 * 28, 8 * 32 - 8, 500); + room.AddTextBox("When you have learned about the Paintbrush, shape editor, and chips, go this way.", + 5 * 28, 9 * 32, 400); + room.AddArrow(3 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(10 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(17 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(559, 7 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(10 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + toolbox = new ToolBox(28, 10 * 32, room); + items.addElement(toolbox); + } + { // Room 3, Paths to Paintbrush & Shape Editor + Room room = rooms.elementAt(3); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 2} + }; + room.AddArrow(0, 6 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + room.AddArrow(10 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 4, Paintbrush intro + Room room = rooms.elementAt(4); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("This is a PAINTBRUSH.", + 2 * 28, 2 * 32, 300); + room.AddTextBox("Use it in special rooms in the INNOVATION LAB to design mazes.", + 2 * 28, 3 * 32, 400); + room.AddTextBox("Press P to become the Paintbrush.", + 2 * 28, 8 * 32, 500); + room.AddTextBox("Press C to become the Cursor.", + 2 * 28, 10 * 32, 500); + room.AddArrow(0, 6 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 5, Paintbrush intro 2 + Room room = rooms.elementAt(5); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Try painting and erasing walls in the maze rooms below.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("To paint, press the SPACEBAR and move the paintbrush.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("To erase, sit on a wall and press SPACEBAR as you move.", + 2 * 28, 6 * 32, 500); + room.AddTextBox("Paintable Maze Rooms", + 1 * 28, 9 * 32, 100); + room.AddTextBox("Return to the Cross- roads when you have finished your maze.", + 9 * 28, 9 * 32, 300); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 6, Maze Top Left + Room room = rooms.elementAt(6); + room.RoomArray = new int[][]{ + {5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5} + }; + room.editable = true; + } + { // Room 7, Maze Top Right + Room room = rooms.elementAt(7); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5} + }; + room.editable = true; + } + { // Room 8, Maze Bottom Left + Room room = rooms.elementAt(8); + room.RoomArray = new int[][]{ + {5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5} + }; + room.editable = true; + } + { // Room 9, Maze Bottom Right + Room room = rooms.elementAt(9); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5} + }; + room.editable = true; + } + { // Room 10, Shape Editor intro + Room room = rooms.elementAt(10); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("The INNOVATION LAB contains a SHAPE EDITOR like the one next door.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("You can use the shape editor to change the shapes of the sensors and the objects they detect.", + 2 * 28, 5 * 32, 500); + room.AddTextBox("Go try the shape editor. Take the crystal or sensor with you.", + 2 * 28, 10 * 32, 500); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new Crystal(5 * 28, 8 * 32, room, 100000)); + items.addElement(new DirectionalSensor(11 * 28, 6 * 32, room, new Crystal(0, 0, null, 0))); + } + { // Room 11, Shape Editor room + Room room = rooms.elementAt(11); + room.RoomArray = new int[][]{ + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 7, 0, 0, 0, 0, 8, 0, 0, 0, 0, 9, 0, 0, 0, 0, 10, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} + }; + room.AddTextBox("Shape Editor", 7 * 28, 2 * 32, 200); + room.AddTextBox("Shape Icons", 7 * 28, 8 * 32, 200); + room.AddTextBox("Pass a sensor or item over one of the shape icons to change it to that shape.", + 2 * 28, 3 * 32, 500); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 12, Shape Editor workshop + Room room = rooms.elementAt(12); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("This robot will beep when it touches an energy crystal. Try it.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Now, unwire the sensor in the robot and change its shape to a triangle.", + 2 * 28, 5 * 32, 400); + room.AddTextBox("Wire it up again and make it beep when it touches the triangle.", + 2 * 28, 8 * 32, 500); + room.AddTextBox("Then return to the Crossroads.", + 2 * 28, 10 * 32, 500); + BlueRobot robot = new BlueRobot(16 * 28, 2 * 32, room); + items.addElement(robot); + ContactSensor sensor = new ContactSensor(4 * 28, 6 * 32, robot.InternalRoom, new Crystal(0, 0, null, 0)); + items.addElement(sensor); + Wire wire = new Wire(robot.devices[8].ports[0], sensor.ports[0]); + items.addElement(new Triangle(15 * 28, 4 * 32, room, new Color(255, 128, 0))); + items.addElement(new Crystal(17 * 28, 4 * 32, room, 100000)); + } + { // Room 13, Prototype Intro + Room room = rooms.elementAt(13); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("This is a PROTOTYPE CHIP. It has 8 pins that can be soldered to wires.", + 2 * 28, 2 * 32, 250); + room.AddTextBox("Notice how the pins are numbered.", + 2 * 28, 5 * 32, 250); + room.AddTextBox("CROSSROADS", + 36, 7 * 32 + 24, 300); + room.AddTextBox("The pins on this chip are neither outputs nor inputs because the chip isn't wired.", + 2 * 28, 10 * 32, 550); + room.AddTextBox("1 2 3 4", + 13 * 28, 2 * 32, 30); + room.AddTextBox("8 7 6 5", + 18 * 28, 2 * 32, 30); + room.AddArrow(0, 7 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new PrototypeChip(14 * 28, 2 * 32 - 8, room)); + } + { // Room 14, Prototype Intro 2 + Room room = rooms.elementAt(14); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("But chips can be wired inside!", + 2 * 28, 2 * 32, 500); + room.AddTextBox("You can create circuits inside a prototype chip (using nodes, fliplflops, and logic gates) and connect them to the pins inside.", + 2 * 28, 4 * 32, 480); + room.AddTextBox("When a chip is wired, pins change to outputs or inputs, depending on how they are wired. Unwired pins remain neutral.", + 2 * 28, 8 * 32, 480); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 15, Prototype Chip + Room room = rooms.elementAt(15); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("This prototype chip has a circuit inside.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("This circuit sends out pulses of electricity. Go inside the chip and see.", + 2 * 28, 5 * 32, 400); + room.AddTextBox("Because of the circuit wiring, pin 1 is now an input on the inside and an output on the outside.", + 2 * 28, 8 * 32, 500); + room.AddTextBox("Take the chip with you.", + 2 * 28, 11 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + PrototypeChip pc = new PrototypeChip(14 * 28, 2 * 32 - 8, room); + items.addElement(pc); + Node node = new Node(4 * 28, 2 * 32, pc.InternalRoom, Node.TYPE_STRAIGHT); + items.addElement(node); + NOTGate ng = new NOTGate(6 * 28, 3 * 32, pc.InternalRoom); + items.addElement(ng); + Wire wire = new Wire(node.ports[0], ng.ports[1]); + wire = new Wire(ng.ports[0], node.ports[2]); + wire = new Wire(pc.portdevices[0].ports[0], node.ports[1]); + } + { // Room 16, Antenna + Room room = rooms.elementAt(16); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2} + }; + room.AddTextBox("You can use a chip with a circuit inside to activate a robot part.", + 5 * 28, 2 * 32, 350); + room.AddTextBox("Solder pin 1 to the INPUT of this antenna. Notice how the antenna pulses on and off.", + 5 * 28, 9 * 32, 300); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new Antenna(2 * 28, 2 * 32, room, Color.white)); + } + { // Room 17, Antenna & SmallChip + Room room = rooms.elementAt(17); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2} + }; + room.AddTextBox("This SMALL CHIP was created by 'burning' into it a copy of the prototype chip's circuit.", + 6 * 28, 2 * 32, 400); + room.AddTextBox("It work's just like a prototype chip, but you can't go inside.", + 6 * 28, 5 * 32, 400); + room.AddTextBox("Solder pin 1 (upper left pin) to the antenna INPUT. Does it work like the prototype chip?", + 2 * 28, 9 * 32, 450); + room.AddArrow(17 * 28 + 14, 383, Arrow.DIR_DOWN, 28, Color.white); + items.addElement(new Antenna(2 * 28, 2 * 32, room, Color.white)); + SmallChip sc = new SmallChip(4 * 28, 4 * 32, room, "1"); + items.addElement(sc); + sc.LoadChip("chips/oscillator.chip"); + } + { // Room 18, Burner Intro + Room room = rooms.elementAt(18); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Small chips are 'burned' in the Burner Room of the INNOVATION LAB.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Go look at the burner room at the left.", + 2 * 28, 5 * 32, 400); + room.AddTextBox("Look here", + 0, 6 * 32, 100); + room.AddTextBox("To burn a chip, become the cursor and sit on the burn button. Then press SPACEBAR. Try it now and see what happens.", + 5 * 28, 9 * 32, 400); + room.AddArrow(0, 7 * 32, Arrow.DIR_LEFT, 28, Color.white); + room.AddArrow(2 * 28 + 14, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 19, Burner Room + Room room = rooms.elementAt(19); + room.RoomArray = new int[][]{ + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}, + {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4}, + {4, 0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {4, 0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, + {4, 0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 4, 0, 4, 0, 0, 0}, + {4, 0, 4, 4, 4, 4, 4, 4, 0, 0, 0, 4, 0, 0, 4, 0, 4, 0, 0, 0}, + {4, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 4, 0, 0, 4}, + {4, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 4, 0, 0, 4}, + {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} + }; + room.AddTextBox("Burner Room", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Prototype chip goes here.", + 2 * 28, 4 * 32, 250); + room.AddTextBox("Small chip goes here.", + 11 * 28, 6 * 32, 170); + room.AddTextBox("BURN BUTTON", + 17 * 28, 8 * 32, 100); + room.AddArrow(5 * 28, 5 * 32 + 16, Arrow.DIR_DOWN, 28, Color.white); + room.AddArrow(13 * 28, 7 * 32 + 16, Arrow.DIR_DOWN, 28, Color.white); + room.AddArrow(18 * 28 + 14, 9 * 32 + 16, Arrow.DIR_DOWN, 28, Color.white); + PrototypeChip pc = new PrototypeChip(3 * 28 + 4, 5 * 32 + 12, room); + items.addElement(pc); + pc.inBurner = true; + SmallChip sc = new SmallChip(13 * 28 - 13, 8 * 32 - 15, room, "1"); + items.addElement(sc); + sc.inBurner = true; + items.addElement(new Burner(18 * 28, 10 * 32 + 2, room)); + } + { // Room 20, Nesting + Room room = rooms.elementAt(20); + room.RoomArray = new int[][]{ + {2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("You can use small chips as part of a circuit inside the prototype chip. This is called 'nesting'.", + 4 * 28, 2 * 32, 400); + room.AddArrow(0, 6 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 21, Nesting II + Room room = rooms.elementAt(21); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Take the shortcut up. Bring back the prototype chip and the small chip.", + 2 * 28, 3 * 32, 400); + room.AddTextBox("Disconnect the wires in the prototype chip.", + 2 * 28, 6 * 32, 400); + room.AddTextBox("Take both chips next door to try nesting the small chip inside the prototype chip.", + 2 * 28, 9 * 32, 500); + room.AddTextBox("SHORTCUT", + 14 * 28, 32 - 8, 100); + room.AddArrow(18 * 28 + 14, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(0, 6 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 22, Nesting III + Room room = rooms.elementAt(22); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Take the small chip inside the prototype chip. Solder it's pin 1 to the prototype's pin 1.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Next, solder a NOT-gate's OUTPUT to the prototype's pin 3.", + 2 * 28, 5 * 32, 500); + room.AddTextBox("Come outside and take the chip into the next room.", + 2 * 28, 9 * 32, 500); + room.AddArrow(0, 6 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 23, Nesting workshop + Room room = rooms.elementAt(23); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Put the prototype chip in the robot and solder the pins as shown:", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Pin 1 to the antenna INPUT Pin 2 to the left thruster", + 3 * 28, 4 * 32, 350); + room.AddTextBox("Close the robot's thruster switch.", + 5 * 28, 8 * 32, 400); + room.AddTextBox("Now you have a robot that moves right and beeps.", + 5 * 28, 10 * 32, 400); + room.AddArrow(2 * 28 + 14, 383, Arrow.DIR_DOWN, 28, Color.white); + OrangeRobot robot = new OrangeRobot(16 * 28, 3 * 32, room); + items.addElement(robot); + items.addElement(new RoomSensor(8 * 28, 3 * 32, robot.InternalRoom, + new Square(0, 0, null, Color.white))); + items.addElement(new ContactSensor(10 * 28, 5 * 32, robot.InternalRoom, + new Hexagon(0, 0, null, Color.white))); + } + { // Room 24, Wallhugger intro + Room room = rooms.elementAt(24); + room.RoomArray = new int[][]{ + {2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("By nesting chips inside chips, you can create very complex circuits.", + 6 * 28, 2 * 32, 400); + room.AddTextBox("This WALLHUGGER chip is an example of a complex circuit. It is wired with 16 logic gates and one nested chip.", + 6 * 28, 5 * 32, 400); + room.AddTextBox("Take the chip with you.", + 6 * 28, 10 * 32, 500); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + SmallChip sc = new SmallChip(4 * 28, 5 * 32, room, "3"); + items.addElement(sc); + sc.LoadChip("chips/WallHugger.chip"); + } + { // Room 25, Wallhugger wiring + Room room = rooms.elementAt(25); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("You can use chips inside robots.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Take the WALLHUGGER chip inside this robot.", + 2 * 28, 3 * 32, 400); + room.AddTextBox("Solder the pins as shown.", + 2 * 28, 5 * 32, 400); + room.AddTextBox("PIN TO PIN TO", + 2 * 28, 6 * 32, 400); + room.AddTextBox("1 top thruster 2 left bumper 3 left thruster 4 bottom bumper", + 3 * 28, 6 * 32 + 16, 250); + room.AddTextBox("8 top bumper 7 right thruster 6 right bumper 5 bottom thruster", + 11 * 28, 6 * 32 + 16, 240); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + WhiteRobot robot = new WhiteRobot(16 * 28, 3 * 32, room); + items.addElement(robot); + items.addElement(new DirectionalSensor(8 * 28, 3 * 32, robot.InternalRoom, + new Crystal(0, 0, null, 0))); + items.addElement(new ContactSensor(10 * 28, 5 * 32, robot.InternalRoom, + new Crystal(0, 0, null, 0))); + } + { // Room 26, Wallhugger intro II + Room room = rooms.elementAt(26); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2} + }; + room.AddTextBox("Take the robot to the maze below. Close the thruster switch.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("How does the WALLHUGGER chip work in this kind of maze?", + 2 * 28, 5 * 32, 400); + room.AddTextBox("Maze", + 16 * 28, 11 * 32, 400); + room.AddArrow(17 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 27, Wallhugger maze + Room room = rooms.elementAt(27); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + } + { // Room 28, Chip speed + Room room = rooms.elementAt(28); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Chips can also be set to run faster than normal circuits.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("The Burner Room in the INNOVATION LAB has a SPEED SETTING that can be changed by using the Up and Down arrows in the Burner Room. A chip receives this speed setting when it's burned.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("A chip's speed sets the number of times the chip will be processed in one INSTANT. One instant is the time it takes for a gate (outside a chip) to process its inputs and send an output.", + 2 * 28, 8 * 32, 500); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 29, Chip talk + Room room = rooms.elementAt(29); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Here are some special uses of chips.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Chips can be wired inside other chips to create very complex chips.", + 3 * 28, 3 * 32, 450); + room.AddTextBox("Chips can be transferred to ROBOTROPOLIS where you can use them to help you escape.", + 3 * 28, 5 * 32, 450); + room.AddTextBox("Chips can be used to save space in a robot.", + 3 * 28, 7 * 32, 450); + room.AddTextBox("Chips can be used to make complex circuits run as fast as a single gate.", + 3 * 28, 9 * 32, 450); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 30, Chip Record + Room room = rooms.elementAt(30); + room.RoomArray = new int[][]{ + {3, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("You can make a RECORD of a chip's circuit. You can then review the chip's record whenever you want.", + 4 * 28, 2 * 32, 400); + room.AddTextBox("Pick up this chip and press ? to see and edit its record.", + 4 * 28, 5 * 32, 400); + room.AddTextBox("You can also use the record to change the label on the small chip. Just change the letter in the top right field and press Save.", + 4 * 28, 7 * 32, 400); + room.AddArrow(2 * 28 + 14, 0, Arrow.DIR_UP, 28, Color.white); + SmallChip sc = new SmallChip(2 * 28, 5 * 32, room, "5"); + items.addElement(sc); + sc.LoadChip("chips/gates.chip"); + } + { // Room 31, Chip Save + Room room = rooms.elementAt(31); + room.RoomArray = new int[][]{ + {3, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("You can also save a chip's circuit for later use.", + 4 * 28, 2 * 32, 400); + room.AddTextBox("To save a chip's circuit, pick up a chip in the INNOVATION LAB and press S.", + 4 * 28, 4 * 32 + 16, 400); + room.AddTextBox("You can recycle small chips. First save the old version of the chip. Then burn in a new circuit.", + 4 * 28, 8 * 32, 400); + room.AddArrow(2 * 28 + 14, 0, Arrow.DIR_UP, 28, Color.white); + } + { // Room 32, Chip Load + Room room = rooms.elementAt(32); + room.RoomArray = new int[][]{ + {3, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("You can LOAD circuits you have saved into small chips.", + 4 * 28, 3 * 32, 400); + room.AddTextBox("To load a chip, pick up a chip and press L. A dialog box of circuit names will appear. Select the one you want.", + 4 * 28, 5 * 32, 400); + room.AddTextBox("Chips can be loaded in the INNOVATION LAB or in ROBOTROPOLIS where you can use them to help you escape.", + 4 * 28, 8 * 32, 400); + room.AddArrow(2 * 28 + 14, 0, Arrow.DIR_UP, 28, Color.white); + } + { // Room 33, Exit + Room room = rooms.elementAt(33); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("You have learned how to use many features of the INNOVATION LAB.", + 2 * 28, 3 * 32, 500); + room.AddTextBox("Go to the INNOVATION LAB.", + 6 * 28, 7 * 32, 500); + room.AddTextBox("Return to the MAIN MENU.", + 6 * 28, 9 * 32, 500); + room.AddTextBox("Press ? for help or hints.", + 2 * 28, 11 * 32, 500); + } + { // Room 34, Paintbrush colors + Room room = rooms.elementAt(34); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("The Paintbrush can also paint walls of different colors and properties. Press P to change colors.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("{255,000,000} RED {128,128,128} walls block all robots and are detectable.", + 3 * 28, 5 * 32, 500); + room.AddTextBox("{000,255,000} GREEN {128,128,128} walls block all robots and are not detectable.", + 3 * 28, 7 * 32, 450); + room.AddTextBox("{255,128,000} ORANGE, {255,255,255} WHITE, {128,128,128} and {000,000,255} BLUE {128,128,128} walls block their respectivly colored robots, and are not detectable.", + 3 * 28, 9 * 32, 500); + } + + { // Room 35, Factory Intro + Room room = rooms.elementAt(35); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("The INNOVATION LAB has two FACTORIES for creating chips, shapes, and sensors.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Factories also have TRASH containers, which you can use to dispose of items that you no longer need.", + 2 * 28, 5 * 32, 500); + room.AddTextBox("Go try the factory in the next room.", + 2 * 28, 8 * 32, 500); + room.AddArrow(11 * 28, 0, Arrow.DIR_UP, 28, Color.white); + } + { // Room 36, Factory + Room room = rooms.elementAt(36); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 13, 13, 13, 13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 13, 13, 13, 13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 13, 13, 13, 13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 13, 13, 13, 13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("FACTORY", + 8 * 28 + 14, 2 * 32, 500); + room.AddTextBox("Press to summon an Energy Crystal", + 5 * 28, 3 * 32 + 24, 500); + items.addElement(new Factory(2 * 28, 3 * 32, room, new Crystal(0, 0, null, 100000))); + room.AddArrow(3 * 28 + 14, 4 * 28, Arrow.DIR_LEFT, 28, Color.white); + room.AddTextBox("Drag crystal into Trash to dispose.", + 2 * 28, 6 * 32 - 8, 500); + room.AddTextBox("TRASH", + 2 * 28, 9 * 32, 500); + room.AddArrow(3 * 28, 7 * 32, Arrow.DIR_DOWN, 28, Color.white); + room.AddTextBox("Return to the Crossroads.", + 12 * 28, 10 * 32, 200); + } + { // Room 37, Unburning + Room room = rooms.elementAt(37); + room.RoomArray = new int[][]{ + {2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Chips can also be unburned.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("To unburn a chip, place a burned or loaded chip into the right holder, and an empty Prototype chip in the left. Then press the UNBURN button.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("The Prototype chip will automatically be wired to match the small chip's circutry.", + 2 * 28, 8 * 32, 500); + room.AddArrow(2 * 28 + 14, 559, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 38, ChipTest intro + Room room = rooms.elementAt(38); + room.RoomArray = new int[][]{ + {3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {3, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("To the Crossroads", + 28, 32 + 16, 500); + room.AddTextBox("The Innovation Lab also has a CHIP TESTER for testing prototype chips and small chips.", + 4 * 28, 3 * 32, 450); + room.AddTextBox("Place a chip in the holder and then press the AUTOWIRE button. The chip will be wired to the tester, and the buttons can be used to set or display port values.", + 4 * 28, 6 * 32, 450); + room.AddTextBox("Press the autowire button again to unwire the chip.", + 4 * 28, 10 * 32, 450); + room.AddArrow(28 + 14, 0, Arrow.DIR_UP, 28, Color.white); + } + { // Room 39, Chip Testing + Room room = rooms.elementAt(39); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 2, 14, 14, 14, 14, 14, 14, 2, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 2, 14, 14, 14, 14, 14, 14, 2, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 2, 14, 14, 14, 14, 14, 14, 2, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 2, 14, 14, 14, 14, 14, 14, 2, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("Chip Tester", 2 * 28, 32 + 24, 500); + PortDevice[] portdevices = new PortDevice[8]; + portdevices[0] = new PortDevice(6 * 28, 3 * 32 + 8, room, 28, Port.TYPE_UNDEFINED); + portdevices[1] = new PortDevice(6 * 28, 4 * 32 + 8, room, 28, Port.TYPE_UNDEFINED); + portdevices[2] = new PortDevice(6 * 28, 5 * 32 + 8, room, 28, Port.TYPE_UNDEFINED); + portdevices[3] = new PortDevice(6 * 28, 6 * 32 + 8, room, 28, Port.TYPE_UNDEFINED); + portdevices[4] = new PortDevice(12 * 28 + 8, 6 * 32 + 8, room, 28, Port.TYPE_UNDEFINED); + portdevices[5] = new PortDevice(12 * 28 + 8, 5 * 32 + 8, room, 28, Port.TYPE_UNDEFINED); + portdevices[6] = new PortDevice(12 * 28 + 8, 4 * 32 + 8, room, 28, Port.TYPE_UNDEFINED); + portdevices[7] = new PortDevice(12 * 28 + 8, 3 * 32 + 8, room, 28, Port.TYPE_UNDEFINED); + portdevices[0].rotate(1); + portdevices[1].rotate(1); + portdevices[2].rotate(1); + portdevices[3].rotate(1); + portdevices[4].rotate(-1); + portdevices[5].rotate(-1); + portdevices[6].rotate(-1); + portdevices[7].rotate(-1); + for (int a = 0; a < 8; a++) { + items.addElement(portdevices[a]); + } + items.addElement(new AutoWire(2 * 28, 10 * 32, room)); + items.addElement(new WireTester(5 * 28, 3 * 32, room, portdevices[0])); + items.addElement(new WireTester(5 * 28, 4 * 32, room, portdevices[1])); + items.addElement(new WireTester(5 * 28, 5 * 32, room, portdevices[2])); + items.addElement(new WireTester(5 * 28, 6 * 32, room, portdevices[3])); + items.addElement(new WireTester(14 * 28 + 2, 6 * 32, room, portdevices[4])); + items.addElement(new WireTester(14 * 28 + 2, 5 * 32, room, portdevices[5])); + items.addElement(new WireTester(14 * 28 + 2, 4 * 32, room, portdevices[6])); + items.addElement(new WireTester(14 * 28 + 2, 3 * 32, room, portdevices[7])); + room.AddArrow(3 * 28, 10 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + room.AddTextBox("Autowirer", 4 * 28, 11 * 32 - 8, 200); + } + { // Room 40, Maze Control + Room room = rooms.elementAt(40); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; + room.AddTextBox("The Maze can also be changed to whatever size you want.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("The Innovation Lab's MAZE CONTROL ROOM has five buttons that allow you to set the size the maze, and a sixth button that locks the maze by preventing the cursor from becoming the paintbrush.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("You can use this to create your own puzzles and share them with your friends.", + 2 * 28, 8 * 32, 500); + room.AddTextBox("Try it in the next room.", + 2 * 28, 11 * 32, 500); + } + { // Room 41, Maze Control + Room room = rooms.elementAt(41); + room.RoomArray = new int[][]{ + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}, + {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 2}, + {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2} + }; // room.AddTextBox("", // 2*28, 2*32, 500); - room.AddTextBox("Maze Control Room", 178, 2*32, 300); - room.AddTextBox("4x2", 262, 5*32+24, 500); - items.addElement(new MazeControl(9*28+14,3*32+6,room,MazeControl.DIR_UP)); - items.addElement(new MazeControl(9*28+14,7*32,room,MazeControl.DIR_DOWN)); - items.addElement(new MazeControl(7*28+2,5*32+4,room,MazeControl.DIR_LEFT)); - items.addElement(new MazeControl(12*28,5*32+4,room,MazeControl.DIR_RIGHT)); - items.addElement(new MazeCreator(2*28, 10*32, room)); - room.AddArrow(3*28+14,10*32+12, Arrow.DIR_LEFT, 28, Color.white); - room.AddTextBox("Press to resize Maze", 5*28, 10*32+18, 500); - room.AddArrow(18*28+14,10*32, Arrow.DIR_DOWN, 28, Color.white); - room.AddTextBox("Lock", 17*28+4, 9*32-4, 100); - room.AddTextBox("These arrows change the size of the maze.", 2*28, 4*32, 150); - } + room.AddTextBox("Maze Control Room", 178, 2 * 32, 300); + room.AddTextBox("4x2", 262, 5 * 32 + 24, 500); + items.addElement(new MazeControl(9 * 28 + 14, 3 * 32 + 6, room, MazeControl.DIR_UP)); + items.addElement(new MazeControl(9 * 28 + 14, 7 * 32, room, MazeControl.DIR_DOWN)); + items.addElement(new MazeControl(7 * 28 + 2, 5 * 32 + 4, room, MazeControl.DIR_LEFT)); + items.addElement(new MazeControl(12 * 28, 5 * 32 + 4, room, MazeControl.DIR_RIGHT)); + items.addElement(new MazeCreator(2 * 28, 10 * 32, room)); + room.AddArrow(3 * 28 + 14, 10 * 32 + 12, Arrow.DIR_LEFT, 28, Color.white); + room.AddTextBox("Press to resize Maze", 5 * 28, 10 * 32 + 18, 500); + room.AddArrow(18 * 28 + 14, 10 * 32, Arrow.DIR_DOWN, 28, Color.white); + room.AddTextBox("Lock", 17 * 28 + 4, 9 * 32 - 4, 100); + room.AddTextBox("These arrows change the size of the maze.", 2 * 28, 4 * 32, 150); + } - int[] list1 = {1,2,13,14,15,16,17}; - LinkRoomsHorizontally(list1); - - int[] list2 = {36,35,3,2,33}; - LinkRoomsVertically(list2); - - int[] list3 = {17,18,37,20}; - LinkRoomsVertically(list3); - LinkRoomsUpDown(16,21); - LinkRoomsLeftRight(19,18); - - int[] list4 = {23,22,21,20}; - LinkRoomsHorizontally(list4); + int[] list1 = {1, 2, 13, 14, 15, 16, 17}; + LinkRoomsHorizontally(list1); - int[] list5 = {30,29,28,26,25,24}; - LinkRoomsHorizontally(list5); - LinkRoomsUpDown(23,24); - LinkRoomsUpDown(26,27); - - int[] list6 = {13,38,32,31,30}; - LinkRoomsVertically(list6); - LinkRoomsLeftRight(38,39); + int[] list2 = {36, 35, 3, 2, 33}; + LinkRoomsVertically(list2); - int[] list7 = {41,40,34,5,4,3,10,11,12}; - LinkRoomsHorizontally(list7); - - int[][] grid = { - {6,7}, - {8,9} - }; - LinkRoomsGrid(grid); - LinkRoomsUpDown(5,6); - - - { // Paintbrush code comes after Robots are constructed - Room room = (Room) rooms.elementAt(4); - PaintBrush pb = new PaintBrush(); - pb.x = 17*28+10; - pb.y = 44; - pb.room = room; - items.addElement(pb); - } + int[] list3 = {17, 18, 37, 20}; + LinkRoomsVertically(list3); + LinkRoomsUpDown(16, 21); + LinkRoomsLeftRight(19, 18); - - gameCursor = new LabCursor(16*28+14,5*32+16,(Room) rooms.elementAt(1)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - solderingPen = new SolderingPen(); - remote = new Remote(); - paintbrush = new PaintBrush(); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - items.addElement(paintbrush); - player = gameCursor; - currentViewer = player; - - } + int[] list4 = {23, 22, 21, 20}; + LinkRoomsHorizontally(list4); + + int[] list5 = {30, 29, 28, 26, 25, 24}; + LinkRoomsHorizontally(list5); + LinkRoomsUpDown(23, 24); + LinkRoomsUpDown(26, 27); + + int[] list6 = {13, 38, 32, 31, 30}; + LinkRoomsVertically(list6); + LinkRoomsLeftRight(38, 39); + + int[] list7 = {41, 40, 34, 5, 4, 3, 10, 11, 12}; + LinkRoomsHorizontally(list7); + + int[][] grid = { + {6, 7}, + {8, 9} + }; + LinkRoomsGrid(grid); + LinkRoomsUpDown(5, 6); + + + { // Paintbrush code comes after Robots are constructed + Room room = rooms.elementAt(4); + PaintBrush pb = new PaintBrush(); + pb.x = 17 * 28 + 10; + pb.y = 44; + pb.room = room; + items.addElement(pb); + } + + + gameCursor = new LabCursor(16 * 28 + 14, 5 * 32 + 16, rooms.elementAt(1)); + helpCam = new HelpCam(rooms.elementAt(0)); + solderingPen = new SolderingPen(); + remote = new Remote(); + paintbrush = new PaintBrush(); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + items.addElement(paintbrush); + player = gameCursor; + currentViewer = player; + + } } \ No newline at end of file diff --git a/src/com/droidquest/levels/ROTutA.java b/src/com/droidquest/levels/ROTutA.java index 40db85a..2ab0e35 100644 --- a/src/com/droidquest/levels/ROTutA.java +++ b/src/com/droidquest/levels/ROTutA.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.Wire; @@ -13,497 +11,490 @@ import com.droidquest.decorations.Arrow; import com.droidquest.devices.FlipFlop; import com.droidquest.devices.NOTGate; import com.droidquest.devices.RoomSensor; -import com.droidquest.items.BlueRobot; -import com.droidquest.items.Crystal; -import com.droidquest.items.GenericRobot; -import com.droidquest.items.Key; -import com.droidquest.items.Magnet; -import com.droidquest.items.OrangeRobot; -import com.droidquest.items.Sentry; -import com.droidquest.items.SentryT1; -import com.droidquest.items.Triangle; -import com.droidquest.items.WhiteRobot; +import com.droidquest.items.*; import com.droidquest.materials.CrystalRecharger; import com.droidquest.materials.Lock; import com.droidquest.materials.Material; import com.droidquest.materials.Portal; -class ROTutA extends Level -{ -public ROTutA(RoomDisplay rd) - { - super(rd); - - // Material 0, Blank - materials.addElement(new Material(true, false)); - // Material 1, LightBlue Wall - materials.addElement(new Material(new Color(192,192,255),false, true)); - // Material 2, Green Wall - materials.addElement(new Material(new Color(0,255,0),false, true)); - // Material 3, Orange Wall - materials.addElement(new Material(new Color(255,128,0),false, true)); - // Material 4, LightOrange Wall - materials.addElement(new Material(new Color(255,224,192),false, true)); - // Material 5, CrystalRecharger - materials.addElement(new CrystalRecharger()); - // Material 6, Blue Wall - materials.addElement(new Material(new Color(0,0,255),false, true)); - // Material 7, LockT1 - int[][] lockProgram = { - {Lock.NARROW}, - {12,10,0 }, - {12,9,0, 12,6,1}, - {12,8,0, 12,5,1}, - {Lock.NARROW}, - {12,5,0, 12,8,1}, - {12,6,0, 12,9,1}, - {12,10,1}, - }; - materials.addElement(new Lock(Color.white, Color.blue, lockProgram)); - // Material 8, Portal to First Level; - materials.addElement(new Portal("RO1.lvl",false, true)); - // Material 9, Portal to Tutorial B; - materials.addElement(new Portal("ROTutB.lvl",false, true)); - // Material 10, Portal to Main Menu; - materials.addElement(new Portal("MainMenu.lvl",false, true)); +import java.awt.*; - for (int a=0; a<27; a++) - rooms.addElement(new Room()); - - { // Room 0, Help Screen - Room room = (Room) rooms.elementAt(0); - room.SetMaterialOutline(0,0,19,11,2); - room.AddTextBox("Use the ARROW KEYS or LEFT MOUSE BUTTON to move.", - 2*28, 2*32, 500); - room.AddTextBox("Use SPACEBAR or RIGHT MOUSE BUTTON to pick up objects.", - 2*28, 4*32, 500); - room.AddTextBox("Use R to turn the Remote Control on or off.", - 2*28, 6*32, 500); - room.AddTextBox("Use C to change to Cursor", - 2*28, 8*32, 500); - room.AddTextBox("Use the Menubar above to control sound, or to return to the Main Menu level.", - 2*28, 9*32, 450); - room.AddTextBox("To continue, press RETURN", - 5*28, 11*32, 500); - } - { // Room 1, Title Screen - Room room = (Room) rooms.elementAt(1); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(19,5,19,7,0); - room.SetMaterial(0,10,0); - room.AddTextBox("{BIG} ROBOT ANATOMY", 4*28, 2*32, 500); - room.AddTextBox("Welcome Traveller!", 2*28, 3*32, 16*32); - room.AddTextBox("Before you venture into Robotropolis, we suggest you take our brief tour. We'll show you how to use robots to help you escape the Sewer (Level 1) of Robotropolis.", - 2*28, 5*32, 500); - room.AddTextBox("Press ? for special keys.", 5*28, 10*32, 500); - room.AddArrow(559,6*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 2, Movement - Room room = (Room) rooms.elementAt(2); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialFill(0,5,19,7,0); - room.AddTextBox("You can move the cursor using the Arrow keys on your keyboard, or by clicking anywhere on the screen with the mouse.", - 2*28, 2*32, 500); - room.AddTextBox("Click here", 3*28, 8*32, 500); - room.AddArrow(5*28,6*32+16, Arrow.DIR_UP, 28, Color.white) ; - room.AddTextBox("Double-Click here", 12*28+14, 8*32, 160); - room.AddArrow(15*28,6*32+16, Arrow.DIR_UP, 28, Color.white) ; - room.AddArrow(559,6*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 3, Movement 2 - Room room = (Room) rooms.elementAt(3); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialFill(0,5,19,7,0); - room.AddTextBox("Double-Clicking the mouse on one side of the cursor starts your cursor moving in that direction until it reaches a wall or the next room.", - 2*28, 2*32, 500); - room.AddArrow(559,6*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 4, Pick up Key - Room room = (Room) rooms.elementAt(4); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,5,0,7,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("You can pick up and drop objects.", - 2*28, 2*32, 500); - room.AddTextBox("To pick up an object, move on top of it and press the SPACEBAR (or Right-Click the mouse).", - 2*28, 3*32, 500); - room.AddTextBox("Pick up this key and move it around. To drop it, press the SPACEBAR again.", - 2*28, 8*32, 500); - room.AddTextBox("Take the Key with you", - 6*28, 10*32+16, 500); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - items.addElement(new Key(9*28, 5*32, room, Color.blue)); - } - { // Room 5, Locked Sentry - Room room = (Room) rooms.elementAt(5); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterialOutline(8,11,11,11,0); - room.SetMaterialOutline(12,7,19,11,1); - room.SetMaterial(12,7,7); - room.AddTextBox("You can move in small steps. Press the control key and the cursor keys at the same time.", - 2*28, 2*32, 500); - room.AddTextBox("This sentry is trapped.", - 2*28, 4*32+16, 500); - room.AddTextBox("To let it out, hold the key by the HANDLE. Use small steps to put the key in the lock.", - 2*28, 6*32, 500); - room.AddArrow(10*28, 383, Arrow.DIR_DOWN, 28, Color.white) ; - items.addElement(new SentryT1(17*28, 9*32+16, room)); - } - { // Room 6, Command Summary - Room room = (Room) rooms.elementAt(6); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialOutline(8,0,11,0,0); - room.SetMaterialOutline(15,11,18,11,0); - room.AddTextBox("S and T are two commands you won't need till later. If you press S you will change to a Solderpen. Just press C to change back to the Cursor.", - 2*28, 3*32, 500); - room.AddTextBox("If you press T you will get a Toolkit.", - 2*28, 6*32, 500); - room.AddArrow(17*28, 383, Arrow.DIR_DOWN, 28, Color.white) ; - } - { // Room 7, Scanner - Room room = (Room) rooms.elementAt(7); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(15,0,18,0,0); - room.SetMaterialOutline(19,4,19,6,0); - room.AddTextBox("This robot will help you escape from the Sewer. Its name is Scanner.", - 2*28, 3*32, 350); - room.AddTextBox("Go inside it by moving on top of it and pressing E.", - 2*28, 7*32, 500); - room.AddTextBox("Then come back out and carry Scanner with you.", - 2*28, 9*32, 500); - room.AddArrow(559, 5*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - - GenericRobot robot = new BlueRobot(13*28,3*32,room); - items.addElement(robot); - { - robot.charge = 0; - robot.thrusterPower=true; - NOTGate ng = new NOTGate(5*28,4*32,robot.InternalRoom); - items.addElement(ng); - Wire dummy; - dummy = new Wire(ng.ports[1], robot.devices[0].ports[0]); - robot.InternalRoom.AddTextBox("Scanner", 8*28, 2*32, 200); - robot.InternalRoom.AddTextBox("EYE", 13*28, 3*32-8, 100); - robot.InternalRoom.AddArrow(16*28, 2*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - robot.charge = 100000; - robot.thrusterPower = false; - robot.InternalRoom.AddTextBox("Go through one of the four exits or press X to leave.", - 5*28, 9*32, 350); - } - } - { // Room 8, Periscope - Room room = (Room) rooms.elementAt(8); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,4,0,6,0); - room.SetMaterialOutline(19,2,19,4,0); - room.AddTextBox("You can be inside a robot and still see outside.", - 2*28, 3*32, 500); - room.AddTextBox("Go inside Scanner. Sit on the robot's EYE to use its periscope. Move off the eye to see inside the robot again. Come outside when you are done.", - 2*28, 7*32, 500); - room.AddTextBox("Take Scanner with you.", - 2*28, 10*32, 500); - room.AddArrow(559, 3*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 9, Magnet - Room room = (Room) rooms.elementAt(9); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,2,0,4,0); - room.SetMaterialOutline(19,7,19,9,0); - room.SetMaterialOutline(18,11,18,11,0); - items.addElement(new Magnet(11*28, 7*32, room)); - room.AddTextBox("Robots make handy carrying bags for objects.", - 2*28, 2*32, 500); - room.AddTextBox("Put this magnet inside Scanner.", - 2*28, 7*32, 200); - room.AddTextBox("For now, leave Scanner here.", - 2*28, 10*32, 500); - room.AddArrow(559, 8*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 10, Sparky - Room room = (Room) rooms.elementAt(10); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,7,0,9,0); - room.SetMaterialOutline(1,11,4,11,0); - room.SetMaterialOutline(13,0,19,5,1); - room.SetMaterialOutline(16,5,18,5,0); - room.AddTextBox("Robots can move only if the Remote Control (the antenna above you) is on. Press R to turn it on and off.", - 2*28, 2*32, 300); - room.AddTextBox("Meet Sparky!", - 15*28, 4*32, 120); - room.AddTextBox("Take Sparky with you.", - 5*28, 10*32, 500); - room.AddArrow(3*28, 383, Arrow.DIR_DOWN, 28, Color.white) ; - OrangeRobot robot = new OrangeRobot(17*28,2*32,room); - robot.charge=100000; - robot.thrusterPower=true; - items.addElement(robot); - NOTGate ng = new NOTGate(7*28,1*32+16,robot.InternalRoom); - ng.rotate(1); ng.rotate(1); - items.addElement(ng); - FlipFlop ff = new FlipFlop(9*28,6*32,robot.InternalRoom); - items.addElement(ff); - new Wire(ng.ports[1], robot.devices[9].ports[0]); - new Wire(robot.devices[7].ports[0], ff.ports[0]); - new Wire(robot.devices[5].ports[0], ff.ports[1]); - new Wire(robot.devices[3].ports[0], ff.ports[2]); - new Wire(robot.devices[1].ports[0], ff.ports[3]); - robot.InternalRoom.AddTextBox("Sparky", 9*28, 2*32, 200); - robot.InternalRoom.AddTextBox("GRABBER", 6*28, 4*32-8, 200); - robot.InternalRoom.AddTextBox("BUMPER", 6*28, 10*32, 200); - robot.InternalRoom.AddTextBox("THRUSTER", 13*28, 5*32, 200); - robot.InternalRoom.AddTextBox("THRUSTER SWITCH", 12*28, 9*32, 150); - robot.InternalRoom.AddArrow(5*28, 3*32, Arrow.DIR_UP, 28, Color.white) ; - robot.InternalRoom.AddArrow(16*28, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 11, Sparky talk 1 - Room room = (Room) rooms.elementAt(11); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(1,0,4,11,0); - room.AddTextBox("Go inside Sparky to see the wires and other parts that make it move.", - 5*28, 2*32, 400); - room.AddTextBox("In the Robotropolis Sewer you won't need to change any wires. Just look at how each robot moves and choose the right one for the job.", - 5*28, 6*32, 400); - room.AddTextBox("Take Sparky with you.", - 5*28, 10*32, 400); - room.AddArrow(3*28, 383, Arrow.DIR_DOWN, 28, Color.white) ; - } - { // Room 12, Bumper talk - Room room = (Room) rooms.elementAt(12); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(1,0,4,11,0); - room.AddTextBox("The four white lines outside the robot are its BUMPERS. They detect walls that robots bump into. Inside the robot, the bumpers are crescent- shaped with arrows. Go inside Sparky to see.", - 5*28, 2*32, 400); - room.AddTextBox("Take Sparky with you.", - 5*28, 10*32, 400); - room.AddArrow(3*28, 383, Arrow.DIR_DOWN, 28, Color.white) ; - } - { // Room 13, Thruster talk - Room room = (Room) rooms.elementAt(13); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(1,0,4,0,0); - room.SetMaterialOutline(0,4,0,6,0); - room.AddTextBox("Robots are moved by four THRUSTERS. Inside the robot the thrusters look like triangles. Electricity flows through wires to make the robot move.", - 5*28, 2*32, 400); - room.AddArrow(0, 5*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - } - { // Room 14, Thruster Switch talk - Room room = (Room) rooms.elementAt(14); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,4,19,6,0); - room.AddTextBox("The Remote Control stops or starts all the robots at once. If you want the thrusters in only one robot off, use the THRUSTER SWITCH inside.", - 2*28, 2*32, 450); - room.AddTextBox("To turn the switch on or off, sit on it and press SPACEBAR. When it is closed (orange), the thrusters can work. When it is open (white), the robot won't move even if the Remote Control is on.", - 2*28, 7*32+16, 450); - room.AddArrow(0, 5*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - } - { // Room 15, Get Scanner - Room room = (Room) rooms.elementAt(15); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialOutline(0,4,19,6,0); - room.SetMaterialOutline(18,0,18,0,0); - room.AddTextBox("Get Scanner from the room above. Experiment with the Remote Control and thruster switches.", - 2*28, 2*32, 500); - room.AddTextBox("The Remote Control turns ALL the robots on or off; the thruster switch controls the thrusters on only one roobt.", - 2*28, 8*32, 500); - room.AddTextBox("Put Scanner inside Sparky and carry both robots with you.", - 2*28, 10*32, 500); - room.AddArrow(0, 5*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - } - { // Room 16, Before Sentry - Room room = (Room) rooms.elementAt(16); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialOutline(0,4,19,6,0); - room.SetMaterialOutline(4,4,4,6,3); - room.AddTextBox("Some places in Robotropolis are guarded by sentries like the one in the next room. Try to get past it!", - 2*28, 2*32, 500); - room.AddTextBox("In the Sewer you can ride inside a robot to sneak past a sentry.", - 2*28, 8*32, 500); - room.AddTextBox("Take Sparky with you to see how.", - 2*28, 10*32, 500); - room.AddArrow(0, 5*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - } - { // Room 17, Sentry - Room room = (Room) rooms.elementAt(17); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,4,19,6,0); - room.SetMaterialOutline(1,0,1,0,0); - room.SetMaterialOutline(18,0,18,0,0); - room.AddTextBox("First be sure the Remote Control is off. Then go inside Sparky. Turn the thruster switch on. Sit on the eye.", - 2*28, 2*32, 300); - room.AddTextBox("While you sit on the eye, press R to turn the Remote Control on. Off you go! Press R again to stop.", - 2*28, 8*32, 300); - room.AddArrow(0, 5*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - int[] pace = {16*28,2*32, 16*28, 10*32}; - int[] program = {4*28,1*32, 10*28,10*32, 0,5*32, - 11*28,1*32, 17*28,10*32, 19*28,5*32}; - items.addElement(new Sentry(16*28,2*32,room,pace,program,false)); - } - { // Room 18, Smiley bypass - Room room = (Room) rooms.elementAt(18); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,0,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,0,1}, - {1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1}, - {1,0,0,0,1,0,0,0,1,1,1,1,0,0,0,0,1,0,0,1}, - {1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1}, - {1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - {1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1} - }; - room.RoomArray = table; - } - { // Room 19, Grabber talk - Room room = (Room) rooms.elementAt(19); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(19,4,19,6,0); - room.SetMaterialOutline(14,0,17,0,0); - room.AddTextBox("Each robot is equipped with a claw shaped GRABBER. Sparky is prewired to grab an object its body touches (not its grabber). Go inside to see the grabber control.", - 2*28, 2*32, 400); - room.AddTextBox("To pick up the triangle, turn the Remote Control on. Then bump Sparky into it.", - 2*28, 9*32, 400); - items.addElement(new Triangle(4*28,6*32,room, new Color(255,128,0))); - room.AddArrow(16*28, 0, Arrow.DIR_UP, 28, Color.white) ; - } - { // Room 20, Checkers - Room room = (Room) rooms.elementAt(20); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(14,11,17,11,0); - room.SetMaterialOutline(0,8,0,10,0); - room.AddTextBox("Robots get energy from BATTERIES. Look at the battery and empty energy level inside Checkers.", - 2*28, 2*32, 500); - room.AddTextBox("Batteries drain quickly in Robotopolis, so turn off the thruster switches and Remote Control to conserve energy whenever possible.", - 2*28, 5*32, 400); - room.AddTextBox("Take Checkers with you.", - 2*28, 10*32, 400); - room.AddTextBox("Meet Checkers!", - 15*28, 8*32, 120); - room.AddArrow(0, 9*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - WhiteRobot robot = new WhiteRobot(15*28,6*32,room); - items.addElement(robot); - RoomSensor rs = new RoomSensor(7*28,3*32,robot.InternalRoom, - new Crystal(0,0,null,0)); - items.addElement(rs); - rs.rotate(1); rs.rotate(1); - new Wire(rs.ports[0], robot.devices[8].ports[0]); - robot.charge = 0; - robot.thrusterPower = false; - robot.InternalRoom.AddTextBox("Checkers", 8*28+14, 2*32, 200); - robot.InternalRoom.AddTextBox("ANTENNA", 4*28, 5*32, 200); - robot.InternalRoom.AddTextBox("ENERGY LEVEL", 3*28, 8*32+16, 200); - robot.InternalRoom.AddTextBox("BATTERY", 6*28+16, 9*32+16, 200); - robot.InternalRoom.AddArrow(3*28+14,4*32,Arrow.DIR_UP, 28, Color.white); - robot.InternalRoom.AddArrow(2*28+14,8*32+16,Arrow.DIR_DOWN, 28, Color.white); - robot.InternalRoom.AddArrow(5*28,9*32+12,Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 21, Crystals - Room room = (Room) rooms.elementAt(21); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(19,8,19,10,0); - room.SetMaterialOutline(0,5,0,7,0); - room.AddTextBox("A dead battery can be recharged with an ENERGY CRYSTAL like this one.", - 2*28, 2*32, 350); - room.AddTextBox("Take the crystal inside Checkers and hold it over the black crystal shape on the battery.", - 2*28, 4*32, 500); - room.AddTextBox("The crystal's energy drains into the battery to recharge it. The energy level fills to the top.", - 2*28, 7*32, 500); - room.AddTextBox("Take Checkers with you.", - 2*28, 10*32, 400); - room.AddArrow(0, 6*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - items.addElement(new Crystal(16*28, 2*32, room, 100000)); - } - { // Room 22, Antenna - Room room = (Room) rooms.elementAt(22); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(19,5,19,7,0); - room.SetMaterialOutline(0,8,0,10,0); - room.AddTextBox("Each robot is equipped with a radio ANTENNA. Checkers' antenna beeps when it is in a room with an energy crystal. (You will see why later.) Take the energy crystal outside of checkers and drop it in this room.", - 2*28, 2*32, 500); - room.AddTextBox("Turn the Remote Control on and off and listen to the antenna.", - 4*28, 8*32, 400); - room.AddTextBox("Put the crystal inside Checkers and take it with you.", - 4*28, 10*32, 400); - room.AddArrow(0, 9*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - } - { // Room 23, Recharger - Room room = (Room) rooms.elementAt(23); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(19,8,19,10,0); - room.SetMaterialOutline(17,0,18,0,0); - room.SetMaterial(2,9,5); - room.AddTextBox("Dead energy crystals can be recharged with RECHARGERS like this one. Get the energy crystal and pass it over the recharger.", - 2*28, 2*32, 400); - room.AddTextBox("Regrettably there is no recharger in the Sewer, but you may find one in higher levels.", - 2*28, 6*32, 400); - room.AddArrow(18*28, 0, Arrow.DIR_UP, 28, Color.white) ; - } - { // Room 24, End - Room room = (Room) rooms.elementAt(24); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(17,11,18,11,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("Now you are ready for a great adventure in the Sewer. Save your game often so you won't have to start from the beginning when you get stuck.", - 2*28, 2*32, 500); - room.AddTextBox("Conquor the Sewer. Then learn more about robot wiring to prepare for higher game levels.", - 2*28, 5*32, 450); - } - { // Room 25, Portals - Room room = (Room) rooms.elementAt(25); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterial(19,10,0); - room.SetMaterial(4,2,8); - room.SetMaterial(4,5,9); - room.SetMaterial(4,8,10); - room.AddTextBox("Go to the Robotropolis Sewer", - 5*28, 3*32, 400); - room.AddTextBox("Learn about Robot Wiring", - 5*28, 6*32, 400); - room.AddTextBox("Return to the Main Menu", - 5*28, 9*32, 400); - } - { // Room 26, Shortcut - Room room = (Room) rooms.elementAt(26); - room.SetMaterialOutline(0,0,19,9,1); - room.SetMaterialOutline(0,11,19,11,1); - room.SetMaterial(0,10,0); - room.SetMaterial(19,10,0); - room.AddTextBox("{BIG} {000,255,000} SHORTCUT", - 172, 6*32, 400); - } - - int[] list1 = {24,25,26,1,2,3,4,5}; - LinkRoomsHorizontally(list1); - LinkRoomsUpDown(5,6); - LinkRoomsUpDown(6,7); - int[] list2 = {7,8,9,10}; - LinkRoomsHorizontally(list2); - int[] list3 = {10,11,12,13}; - LinkRoomsVertically(list3); - int[] list4 = {19,17,16,15,14,13}; - LinkRoomsHorizontally(list4); - LinkRoomsUpDown(9,15); - LinkRoomsUpDown(18,17); - LinkRoomsUpDown(20,19); - int[] list5 = {23,22,21,20}; - LinkRoomsHorizontally(list5); - LinkRoomsUpDown(24,23); - - gameCursor = new GameCursor(9*28+14,8*32+16,(Room) rooms.elementAt(1)); - solderingPen = new SolderingPen(); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - remote = new Remote(); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - player = gameCursor; - currentViewer = player; - - } +class ROTutA extends Level { + public ROTutA(RoomDisplay rd) { + super(rd); + + // Material 0, Blank + materials.addElement(new Material(true, false)); + // Material 1, LightBlue Wall + materials.addElement(new Material(new Color(192, 192, 255), false, true)); + // Material 2, Green Wall + materials.addElement(new Material(new Color(0, 255, 0), false, true)); + // Material 3, Orange Wall + materials.addElement(new Material(new Color(255, 128, 0), false, true)); + // Material 4, LightOrange Wall + materials.addElement(new Material(new Color(255, 224, 192), false, true)); + // Material 5, CrystalRecharger + materials.addElement(new CrystalRecharger()); + // Material 6, Blue Wall + materials.addElement(new Material(new Color(0, 0, 255), false, true)); + // Material 7, LockT1 + int[][] lockProgram = { + {Lock.NARROW}, + {12, 10, 0}, + {12, 9, 0, 12, 6, 1}, + {12, 8, 0, 12, 5, 1}, + {Lock.NARROW}, + {12, 5, 0, 12, 8, 1}, + {12, 6, 0, 12, 9, 1}, + {12, 10, 1}, + }; + materials.addElement(new Lock(Color.white, Color.blue, lockProgram)); + // Material 8, Portal to First Level; + materials.addElement(new Portal("RO1.lvl", false, true)); + // Material 9, Portal to Tutorial B; + materials.addElement(new Portal("ROTutB.lvl", false, true)); + // Material 10, Portal to Main Menu; + materials.addElement(new Portal("MainMenu.lvl", false, true)); + + for (int a = 0; a < 27; a++) { + rooms.addElement(new Room()); + } + + { // Room 0, Help Screen + Room room = rooms.elementAt(0); + room.SetMaterialOutline(0, 0, 19, 11, 2); + room.AddTextBox("Use the ARROW KEYS or LEFT MOUSE BUTTON to move.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Use SPACEBAR or RIGHT MOUSE BUTTON to pick up objects.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("Use R to turn the Remote Control on or off.", + 2 * 28, 6 * 32, 500); + room.AddTextBox("Use C to change to Cursor", + 2 * 28, 8 * 32, 500); + room.AddTextBox("Use the Menubar above to control sound, or to return to the Main Menu level.", + 2 * 28, 9 * 32, 450); + room.AddTextBox("To continue, press RETURN", + 5 * 28, 11 * 32, 500); + } + { // Room 1, Title Screen + Room room = rooms.elementAt(1); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(19, 5, 19, 7, 0); + room.SetMaterial(0, 10, 0); + room.AddTextBox("{BIG} ROBOT ANATOMY", 4 * 28, 2 * 32, 500); + room.AddTextBox("Welcome Traveller!", 2 * 28, 3 * 32, 16 * 32); + room.AddTextBox("Before you venture into Robotropolis, we suggest you take our brief tour. We'll show you how to use robots to help you escape the Sewer (Level 1) of Robotropolis.", + 2 * 28, 5 * 32, 500); + room.AddTextBox("Press ? for special keys.", 5 * 28, 10 * 32, 500); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 2, Movement + Room room = rooms.elementAt(2); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialFill(0, 5, 19, 7, 0); + room.AddTextBox("You can move the cursor using the Arrow keys on your keyboard, or by clicking anywhere on the screen with the mouse.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Click here", 3 * 28, 8 * 32, 500); + room.AddArrow(5 * 28, 6 * 32 + 16, Arrow.DIR_UP, 28, Color.white); + room.AddTextBox("Double-Click here", 12 * 28 + 14, 8 * 32, 160); + room.AddArrow(15 * 28, 6 * 32 + 16, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 3, Movement 2 + Room room = rooms.elementAt(3); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialFill(0, 5, 19, 7, 0); + room.AddTextBox("Double-Clicking the mouse on one side of the cursor starts your cursor moving in that direction until it reaches a wall or the next room.", + 2 * 28, 2 * 32, 500); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 4, Pick up Key + Room room = rooms.elementAt(4); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 5, 0, 7, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("You can pick up and drop objects.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("To pick up an object, move on top of it and press the SPACEBAR (or Right-Click the mouse).", + 2 * 28, 3 * 32, 500); + room.AddTextBox("Pick up this key and move it around. To drop it, press the SPACEBAR again.", + 2 * 28, 8 * 32, 500); + room.AddTextBox("Take the Key with you", + 6 * 28, 10 * 32 + 16, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new Key(9 * 28, 5 * 32, room, Color.blue)); + } + { // Room 5, Locked Sentry + Room room = rooms.elementAt(5); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterialOutline(8, 11, 11, 11, 0); + room.SetMaterialOutline(12, 7, 19, 11, 1); + room.SetMaterial(12, 7, 7); + room.AddTextBox("You can move in small steps. Press the control key and the cursor keys at the same time.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("This sentry is trapped.", + 2 * 28, 4 * 32 + 16, 500); + room.AddTextBox("To let it out, hold the key by the HANDLE. Use small steps to put the key in the lock.", + 2 * 28, 6 * 32, 500); + room.AddArrow(10 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + items.addElement(new SentryT1(17 * 28, 9 * 32 + 16, room)); + } + { // Room 6, Command Summary + Room room = rooms.elementAt(6); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialOutline(8, 0, 11, 0, 0); + room.SetMaterialOutline(15, 11, 18, 11, 0); + room.AddTextBox("S and T are two commands you won't need till later. If you press S you will change to a Solderpen. Just press C to change back to the Cursor.", + 2 * 28, 3 * 32, 500); + room.AddTextBox("If you press T you will get a Toolkit.", + 2 * 28, 6 * 32, 500); + room.AddArrow(17 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 7, Scanner + Room room = rooms.elementAt(7); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(15, 0, 18, 0, 0); + room.SetMaterialOutline(19, 4, 19, 6, 0); + room.AddTextBox("This robot will help you escape from the Sewer. Its name is Scanner.", + 2 * 28, 3 * 32, 350); + room.AddTextBox("Go inside it by moving on top of it and pressing E.", + 2 * 28, 7 * 32, 500); + room.AddTextBox("Then come back out and carry Scanner with you.", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 5 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + + GenericRobot robot = new BlueRobot(13 * 28, 3 * 32, room); + items.addElement(robot); + { + robot.charge = 0; + robot.thrusterPower = true; + NOTGate ng = new NOTGate(5 * 28, 4 * 32, robot.InternalRoom); + items.addElement(ng); + Wire dummy; + dummy = new Wire(ng.ports[1], robot.devices[0].ports[0]); + robot.InternalRoom.AddTextBox("Scanner", 8 * 28, 2 * 32, 200); + robot.InternalRoom.AddTextBox("EYE", 13 * 28, 3 * 32 - 8, 100); + robot.InternalRoom.AddArrow(16 * 28, 2 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + robot.charge = 100000; + robot.thrusterPower = false; + robot.InternalRoom.AddTextBox("Go through one of the four exits or press X to leave.", + 5 * 28, 9 * 32, 350); + } + } + { // Room 8, Periscope + Room room = rooms.elementAt(8); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 4, 0, 6, 0); + room.SetMaterialOutline(19, 2, 19, 4, 0); + room.AddTextBox("You can be inside a robot and still see outside.", + 2 * 28, 3 * 32, 500); + room.AddTextBox("Go inside Scanner. Sit on the robot's EYE to use its periscope. Move off the eye to see inside the robot again. Come outside when you are done.", + 2 * 28, 7 * 32, 500); + room.AddTextBox("Take Scanner with you.", + 2 * 28, 10 * 32, 500); + room.AddArrow(559, 3 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 9, Magnet + Room room = rooms.elementAt(9); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 2, 0, 4, 0); + room.SetMaterialOutline(19, 7, 19, 9, 0); + room.SetMaterialOutline(18, 11, 18, 11, 0); + items.addElement(new Magnet(11 * 28, 7 * 32, room)); + room.AddTextBox("Robots make handy carrying bags for objects.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Put this magnet inside Scanner.", + 2 * 28, 7 * 32, 200); + room.AddTextBox("For now, leave Scanner here.", + 2 * 28, 10 * 32, 500); + room.AddArrow(559, 8 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 10, Sparky + Room room = rooms.elementAt(10); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 7, 0, 9, 0); + room.SetMaterialOutline(1, 11, 4, 11, 0); + room.SetMaterialOutline(13, 0, 19, 5, 1); + room.SetMaterialOutline(16, 5, 18, 5, 0); + room.AddTextBox("Robots can move only if the Remote Control (the antenna above you) is on. Press R to turn it on and off.", + 2 * 28, 2 * 32, 300); + room.AddTextBox("Meet Sparky!", + 15 * 28, 4 * 32, 120); + room.AddTextBox("Take Sparky with you.", + 5 * 28, 10 * 32, 500); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + OrangeRobot robot = new OrangeRobot(17 * 28, 2 * 32, room); + robot.charge = 100000; + robot.thrusterPower = true; + items.addElement(robot); + NOTGate ng = new NOTGate(7 * 28, 1 * 32 + 16, robot.InternalRoom); + ng.rotate(1); + ng.rotate(1); + items.addElement(ng); + FlipFlop ff = new FlipFlop(9 * 28, 6 * 32, robot.InternalRoom); + items.addElement(ff); + new Wire(ng.ports[1], robot.devices[9].ports[0]); + new Wire(robot.devices[7].ports[0], ff.ports[0]); + new Wire(robot.devices[5].ports[0], ff.ports[1]); + new Wire(robot.devices[3].ports[0], ff.ports[2]); + new Wire(robot.devices[1].ports[0], ff.ports[3]); + robot.InternalRoom.AddTextBox("Sparky", 9 * 28, 2 * 32, 200); + robot.InternalRoom.AddTextBox("GRABBER", 6 * 28, 4 * 32 - 8, 200); + robot.InternalRoom.AddTextBox("BUMPER", 6 * 28, 10 * 32, 200); + robot.InternalRoom.AddTextBox("THRUSTER", 13 * 28, 5 * 32, 200); + robot.InternalRoom.AddTextBox("THRUSTER SWITCH", 12 * 28, 9 * 32, 150); + robot.InternalRoom.AddArrow(5 * 28, 3 * 32, Arrow.DIR_UP, 28, Color.white); + robot.InternalRoom.AddArrow(16 * 28, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 11, Sparky talk 1 + Room room = rooms.elementAt(11); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(1, 0, 4, 11, 0); + room.AddTextBox("Go inside Sparky to see the wires and other parts that make it move.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("In the Robotropolis Sewer you won't need to change any wires. Just look at how each robot moves and choose the right one for the job.", + 5 * 28, 6 * 32, 400); + room.AddTextBox("Take Sparky with you.", + 5 * 28, 10 * 32, 400); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 12, Bumper talk + Room room = rooms.elementAt(12); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(1, 0, 4, 11, 0); + room.AddTextBox("The four white lines outside the robot are its BUMPERS. They detect walls that robots bump into. Inside the robot, the bumpers are crescent- shaped with arrows. Go inside Sparky to see.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("Take Sparky with you.", + 5 * 28, 10 * 32, 400); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 13, Thruster talk + Room room = rooms.elementAt(13); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(1, 0, 4, 0, 0); + room.SetMaterialOutline(0, 4, 0, 6, 0); + room.AddTextBox("Robots are moved by four THRUSTERS. Inside the robot the thrusters look like triangles. Electricity flows through wires to make the robot move.", + 5 * 28, 2 * 32, 400); + room.AddArrow(0, 5 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 14, Thruster Switch talk + Room room = rooms.elementAt(14); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 4, 19, 6, 0); + room.AddTextBox("The Remote Control stops or starts all the robots at once. If you want the thrusters in only one robot off, use the THRUSTER SWITCH inside.", + 2 * 28, 2 * 32, 450); + room.AddTextBox("To turn the switch on or off, sit on it and press SPACEBAR. When it is closed (orange), the thrusters can work. When it is open (white), the robot won't move even if the Remote Control is on.", + 2 * 28, 7 * 32 + 16, 450); + room.AddArrow(0, 5 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 15, Get Scanner + Room room = rooms.elementAt(15); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialOutline(0, 4, 19, 6, 0); + room.SetMaterialOutline(18, 0, 18, 0, 0); + room.AddTextBox("Get Scanner from the room above. Experiment with the Remote Control and thruster switches.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("The Remote Control turns ALL the robots on or off; the thruster switch controls the thrusters on only one roobt.", + 2 * 28, 8 * 32, 500); + room.AddTextBox("Put Scanner inside Sparky and carry both robots with you.", + 2 * 28, 10 * 32, 500); + room.AddArrow(0, 5 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 16, Before Sentry + Room room = rooms.elementAt(16); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialOutline(0, 4, 19, 6, 0); + room.SetMaterialOutline(4, 4, 4, 6, 3); + room.AddTextBox("Some places in Robotropolis are guarded by sentries like the one in the next room. Try to get past it!", + 2 * 28, 2 * 32, 500); + room.AddTextBox("In the Sewer you can ride inside a robot to sneak past a sentry.", + 2 * 28, 8 * 32, 500); + room.AddTextBox("Take Sparky with you to see how.", + 2 * 28, 10 * 32, 500); + room.AddArrow(0, 5 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 17, Sentry + Room room = rooms.elementAt(17); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 4, 19, 6, 0); + room.SetMaterialOutline(1, 0, 1, 0, 0); + room.SetMaterialOutline(18, 0, 18, 0, 0); + room.AddTextBox("First be sure the Remote Control is off. Then go inside Sparky. Turn the thruster switch on. Sit on the eye.", + 2 * 28, 2 * 32, 300); + room.AddTextBox("While you sit on the eye, press R to turn the Remote Control on. Off you go! Press R again to stop.", + 2 * 28, 8 * 32, 300); + room.AddArrow(0, 5 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + int[] pace = {16 * 28, 2 * 32, 16 * 28, 10 * 32}; + int[] program = {4 * 28, 1 * 32, 10 * 28, 10 * 32, 0, 5 * 32, + 11 * 28, 1 * 32, 17 * 28, 10 * 32, 19 * 28, 5 * 32}; + items.addElement(new Sentry(16 * 28, 2 * 32, room, pace, program, false)); + } + { // Room 18, Smiley bypass + Room room = rooms.elementAt(18); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1}, + {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1}, + {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1} + }; + } + { // Room 19, Grabber talk + Room room = rooms.elementAt(19); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(19, 4, 19, 6, 0); + room.SetMaterialOutline(14, 0, 17, 0, 0); + room.AddTextBox("Each robot is equipped with a claw shaped GRABBER. Sparky is prewired to grab an object its body touches (not its grabber). Go inside to see the grabber control.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("To pick up the triangle, turn the Remote Control on. Then bump Sparky into it.", + 2 * 28, 9 * 32, 400); + items.addElement(new Triangle(4 * 28, 6 * 32, room, new Color(255, 128, 0))); + room.AddArrow(16 * 28, 0, Arrow.DIR_UP, 28, Color.white); + } + { // Room 20, Checkers + Room room = rooms.elementAt(20); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(14, 11, 17, 11, 0); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.AddTextBox("Robots get energy from BATTERIES. Look at the battery and empty energy level inside Checkers.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Batteries drain quickly in Robotopolis, so turn off the thruster switches and Remote Control to conserve energy whenever possible.", + 2 * 28, 5 * 32, 400); + room.AddTextBox("Take Checkers with you.", + 2 * 28, 10 * 32, 400); + room.AddTextBox("Meet Checkers!", + 15 * 28, 8 * 32, 120); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + WhiteRobot robot = new WhiteRobot(15 * 28, 6 * 32, room); + items.addElement(robot); + RoomSensor rs = new RoomSensor(7 * 28, 3 * 32, robot.InternalRoom, + new Crystal(0, 0, null, 0)); + items.addElement(rs); + rs.rotate(1); + rs.rotate(1); + new Wire(rs.ports[0], robot.devices[8].ports[0]); + robot.charge = 0; + robot.thrusterPower = false; + robot.InternalRoom.AddTextBox("Checkers", 8 * 28 + 14, 2 * 32, 200); + robot.InternalRoom.AddTextBox("ANTENNA", 4 * 28, 5 * 32, 200); + robot.InternalRoom.AddTextBox("ENERGY LEVEL", 3 * 28, 8 * 32 + 16, 200); + robot.InternalRoom.AddTextBox("BATTERY", 6 * 28 + 16, 9 * 32 + 16, 200); + robot.InternalRoom.AddArrow(3 * 28 + 14, 4 * 32, Arrow.DIR_UP, 28, Color.white); + robot.InternalRoom.AddArrow(2 * 28 + 14, 8 * 32 + 16, Arrow.DIR_DOWN, 28, Color.white); + robot.InternalRoom.AddArrow(5 * 28, 9 * 32 + 12, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 21, Crystals + Room room = rooms.elementAt(21); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.SetMaterialOutline(0, 5, 0, 7, 0); + room.AddTextBox("A dead battery can be recharged with an ENERGY CRYSTAL like this one.", + 2 * 28, 2 * 32, 350); + room.AddTextBox("Take the crystal inside Checkers and hold it over the black crystal shape on the battery.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("The crystal's energy drains into the battery to recharge it. The energy level fills to the top.", + 2 * 28, 7 * 32, 500); + room.AddTextBox("Take Checkers with you.", + 2 * 28, 10 * 32, 400); + room.AddArrow(0, 6 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + items.addElement(new Crystal(16 * 28, 2 * 32, room, 100000)); + } + { // Room 22, Antenna + Room room = rooms.elementAt(22); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(19, 5, 19, 7, 0); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.AddTextBox("Each robot is equipped with a radio ANTENNA. Checkers' antenna beeps when it is in a room with an energy crystal. (You will see why later.) Take the energy crystal outside of checkers and drop it in this room.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Turn the Remote Control on and off and listen to the antenna.", + 4 * 28, 8 * 32, 400); + room.AddTextBox("Put the crystal inside Checkers and take it with you.", + 4 * 28, 10 * 32, 400); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 23, Recharger + Room room = rooms.elementAt(23); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.SetMaterialOutline(17, 0, 18, 0, 0); + room.SetMaterial(2, 9, 5); + room.AddTextBox("Dead energy crystals can be recharged with RECHARGERS like this one. Get the energy crystal and pass it over the recharger.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Regrettably there is no recharger in the Sewer, but you may find one in higher levels.", + 2 * 28, 6 * 32, 400); + room.AddArrow(18 * 28, 0, Arrow.DIR_UP, 28, Color.white); + } + { // Room 24, End + Room room = rooms.elementAt(24); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(17, 11, 18, 11, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("Now you are ready for a great adventure in the Sewer. Save your game often so you won't have to start from the beginning when you get stuck.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Conquor the Sewer. Then learn more about robot wiring to prepare for higher game levels.", + 2 * 28, 5 * 32, 450); + } + { // Room 25, Portals + Room room = rooms.elementAt(25); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterial(19, 10, 0); + room.SetMaterial(4, 2, 8); + room.SetMaterial(4, 5, 9); + room.SetMaterial(4, 8, 10); + room.AddTextBox("Go to the Robotropolis Sewer", + 5 * 28, 3 * 32, 400); + room.AddTextBox("Learn about Robot Wiring", + 5 * 28, 6 * 32, 400); + room.AddTextBox("Return to the Main Menu", + 5 * 28, 9 * 32, 400); + } + { // Room 26, Shortcut + Room room = rooms.elementAt(26); + room.SetMaterialOutline(0, 0, 19, 9, 1); + room.SetMaterialOutline(0, 11, 19, 11, 1); + room.SetMaterial(0, 10, 0); + room.SetMaterial(19, 10, 0); + room.AddTextBox("{BIG} {000,255,000} SHORTCUT", + 172, 6 * 32, 400); + } + + int[] list1 = {24, 25, 26, 1, 2, 3, 4, 5}; + LinkRoomsHorizontally(list1); + LinkRoomsUpDown(5, 6); + LinkRoomsUpDown(6, 7); + int[] list2 = {7, 8, 9, 10}; + LinkRoomsHorizontally(list2); + int[] list3 = {10, 11, 12, 13}; + LinkRoomsVertically(list3); + int[] list4 = {19, 17, 16, 15, 14, 13}; + LinkRoomsHorizontally(list4); + LinkRoomsUpDown(9, 15); + LinkRoomsUpDown(18, 17); + LinkRoomsUpDown(20, 19); + int[] list5 = {23, 22, 21, 20}; + LinkRoomsHorizontally(list5); + LinkRoomsUpDown(24, 23); + + gameCursor = new GameCursor(9 * 28 + 14, 8 * 32 + 16, rooms.elementAt(1)); + solderingPen = new SolderingPen(); + helpCam = new HelpCam(rooms.elementAt(0)); + remote = new Remote(); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + player = gameCursor; + currentViewer = player; + + } } diff --git a/src/com/droidquest/levels/ROTutB.java b/src/com/droidquest/levels/ROTutB.java index c48836c..de66378 100644 --- a/src/com/droidquest/levels/ROTutB.java +++ b/src/com/droidquest/levels/ROTutB.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.Wire; @@ -19,417 +17,418 @@ import com.droidquest.items.WhiteRobot; import com.droidquest.materials.Material; import com.droidquest.materials.Portal; -class ROTutB extends Level -{ -public ROTutB(RoomDisplay rd) - { - super(rd); - - // Material 0, Blank - materials.addElement(new Material(true, false)); - // Material 1, LightBlue Wall - materials.addElement(new Material(new Color(192,192,255),false, true)); - // Material 2, Green Wall - materials.addElement(new Material(new Color(0,255,0),false, true)); - // Material 3, Orange Wall - materials.addElement(new Material(new Color(255,128,0),false, true)); - // Material 4, LightOrange Wall - materials.addElement(new Material(new Color(255,224,192),false, true)); - // Material 5, Blue Wall - materials.addElement(new Material(new Color(0,0,255),false, true)); - // Material 6, Portal to Tutorial C; - materials.addElement(new Portal("ROTutC.lvl",false, true)); - // Material 7, Portal to Main Menu; - materials.addElement(new Portal("MainMenu.lvl",false, true)); - - for (int a=0; a<26; a++) - rooms.addElement(new Room()); - - { // Room 0, Help Screen - Room room = (Room) rooms.elementAt(0); - room.SetMaterialOutline(0,0,19,11,2); - room.AddTextBox("Circuits are made of wires connected to INPUTS and OUTPUTS. Circuits make robots move, grab objects, and send signals.", - 2*28, 2*32, 500); - room.AddTextBox("Press S to use the Solderpen to connect an INPUT to an OUTPUT.", - 2*28, 4*32, 500); - room.AddTextBox("Press C to become the Cursor again.", - 2*28, 6*32, 500); - room.AddTextBox("Use SPACEBAR or RIGHT BUTTON to connect or disconnect wires from INPUTS or OUTPUTS when soldering.", - 2*28, 8*32, 500); - room.AddTextBox("To continue, press RETURN", - 5*28, 11*32, 500); - } - { // Room 1, Title Screen - Room room = (Room) rooms.elementAt(1); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(19,5,19,7,0); - room.SetMaterial(0,10,0); - room.AddTextBox("{BIG} ROBOT WIRING", 4*28, 2*32, 500); - room.AddTextBox("The robots in the Robotropolis Sewer are prewired to work for you. In the subway and higher levels of Robotropolis you need to change the wiring.", - 2*28, 4*32, 500); - room.AddTextBox("Here you will find out how to wire a robot.", - 2*28, 8*32, 500); - room.AddArrow(559,6*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 2, Circuit basics - Room room = (Room) rooms.elementAt(2); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,5,0,7,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("The wiring inside a robot makes it move, pick up objects, and send signals. This wiring is called a CIRCUIT.", - 2*28, 2*32, 500); - room.AddTextBox("To create a circuit in a robot you solder wires to the INPUTS and OUTPUTS of various robot parts.", - 2*28, 5*32, 500); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 3, Input & Scanner - Room room = (Room) rooms.elementAt(3); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,0,3,3,1); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("This is an INPUT. Go inside Scanner and look for all the INPUTS. You will see them on the four thrusters, the grabber control, and the antenna control.", - 5*28, 2*32, 375); - room.AddTextBox("Take Scanner with you.", - 5*28, 7*32, 500); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - items.addElement(new BlueRobot(9*28, 8*32, room)); - PortDevice pd=new PortDevice(2*28-8,24,room, 24, Port.TYPE_INPUT); - items.addElement(pd); - pd.rotate(1); pd.rotate(1); - } - { // Room 4, Output - Room room = (Room) rooms.elementAt(4); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,0,3,3,1); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("This is an OUTPUT. Inside the robot you will see outputs on the graber control, the four bumpers, and the antenna control. When a robot part is activated, electricity flows OUT of it's OUTPUT.", - 5*28, 2*32, 400); - room.AddTextBox("Take Scanner with you.", - 5*28, 8*32, 500); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - PortDevice pd=new PortDevice(2*28-8,24,room, 24, Port.TYPE_OUTPUT); - items.addElement(pd); - pd.rotate(1); pd.rotate(1); - } - { // Room 5, First demo - Room room = (Room) rooms.elementAt(5); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterialOutline(7,11,10,11,0); - room.SetMaterial(19,10,0); - room.AddTextBox("Move Scanner so one bumper just touches a wall. (Be sure the Remote Control is on.) The robot squawks and the outside bumper turns orange. Go inside and look at the output for that bumper. It is also orange. Electricity is flowing OUT of it's OUTPUT.", - 2*28, 2*32, 450); - room.AddTextBox("Leave Scanner here.", - 2*28, 8*32, 500); - room.AddArrow(9*28,383, Arrow.DIR_DOWN, 28, Color.white) ; - } - { // Room 6, Solderpen - Room room = (Room) rooms.elementAt(6); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,0,5,3,1); - room.SetMaterialOutline(7,0,10,0,0); - room.SetMaterialOutline(5,11,8,11,0); - room.AddTextBox("The Solderpen is used to wire OUTPUTS to INPUTS.", - 11*28, 2*32, 230); - room.AddTextBox("Press S to become the Solderpen.", - 11*28, 6*32, 230); - room.AddArrow(7*28,383, Arrow.DIR_DOWN, 28, Color.white); - SolderingPen sp = new SolderingPen(); - sp.x = 3*28+14; - sp.y = 32+16; - sp.room = room; - items.addElement(sp); - room.AddTextBox("TIP", 1*28, 2*32+10, 200); - room.AddArrow(3*28+12,2*32+4,Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 7, Attach wires - Room room = (Room) rooms.elementAt(7); - int[][] table = { - {1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0} - }; - room.RoomArray = table; - room.AddTextBox("Move the Solderpen to the INPUT until the tip glows orange.", - 2*28, 2*32, 400); - room.AddTextBox("Press Spacebar or RIGHT BUTTON to begin soldering. Move the Solderpen to the OUTPUT. (A wire will follow you.) When the tip glows orange press SPACEBAR to conenct the wire.", - 2*28, 7*32, 400); - room.AddArrow(0, 3*32+16, Arrow.DIR_LEFT, 28, Color.white); - items.addElement(new Thruster(17*28, 9*32, room, Port.ROT_RIGHT, Color.blue)); - PortDevice pd = new PortDevice(15*28, 10*32, room, 28, Port.TYPE_OUTPUT); - pd.value=true; - items.addElement(pd); - } - { // Room 8, Detatch wires - Room room = (Room) rooms.elementAt(8); - int[][] table = { - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, - {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0}, - {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0} - }; - room.RoomArray = table; - room.AddTextBox("It's easy to disconnect a wire.", - 2*28, 2*32, 400); - room.AddTextBox("Move the tip of the Solderpen to either the INPUT or OUTPUT. Press the SPACEBAR when the tip glows green.", - 2*28, 8*32, 350); - room.AddArrow(0, 5*32+16, Arrow.DIR_LEFT, 28, Color.white); - Thruster thruster = new Thruster(17*28, 9*32, room, Port.ROT_RIGHT, Color.blue); - items.addElement(thruster); - PortDevice pd = new PortDevice(15*28, 10*32, room, 28, Port.TYPE_OUTPUT); - pd.value=true; - items.addElement(pd); - Wire wire = new Wire(thruster.ports[0], pd.ports[0]); - } - { // Room 9, Sparky - Room room = (Room) rooms.elementAt(9); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(19,4,19,6,0); - room.SetMaterialOutline(8,11,11,11,0); - room.AddTextBox("Now you are ready to create a circuit in a robot. Press C to use the cursor again.", - 2*28, 2*32, 500); - room.AddTextBox("Take Sparky with you through the next few rooms to make a wall-hugging robot.", - 2*28, 8*32, 300); - room.AddArrow(10*28,383, Arrow.DIR_DOWN, 28, Color.white); - OrangeRobot robot = new OrangeRobot(14*28,8*32,room); - robot.charge = 100000; - robot.thrusterPower = true; - robot.InternalRoom.AddTextBox("A",3*28,8*32,100); - robot.InternalRoom.AddTextBox("B",6*28,11*32,100); - robot.InternalRoom.AddTextBox("C",14*28,11*32,100); - robot.InternalRoom.AddTextBox("D",16*28,8*32,100); - robot.InternalRoom.AddTextBox("E",16*28,5*32,100); - robot.InternalRoom.AddTextBox("F",15*28,2*32,100); - robot.InternalRoom.AddTextBox("G",7*28,2*32,100); - robot.InternalRoom.AddTextBox("H",3*28,5*32,100); - items.addElement(robot); - } - { // Room 10, A to B - Room room = (Room) rooms.elementAt(10); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(8,0,11,0,0); - room.SetMaterialOutline(15,11,18,11,0); - room.AddTextBox("Press S to use the Solderpen again.", - 2*28, 2*32, 300); - room.AddTextBox("Go inside Sparky and connect the left thruster (marked A) to the bottom bumper (marked B). Be sure the Remote Control and the robot thruster switch are on.", - 2*28, 6*32, 300); - room.AddArrow(17*28,383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 11, First test - Room room = (Room) rooms.elementAt(11); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialOutline(15,0,18,0,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("Place Sparky next to the bottom wall so it's bumper just touches the wall. When the bumper touches the wall, electricity flows from the bumper to the thruster, propelling the robot.", - 2*28, 2*32, 300); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 12, Continuing - Room room = (Room) rooms.elementAt(12); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialOutline(0,8,19,10,0); - room.AddTextBox("When the left thruster is on, Sparky moves to the right. The thruster pushes the robot in the opposite direction.", - 2*28, 2*32, 500); - room.AddTextBox("What will happen when the right thruster is on?", - 2*28, 5*32, 450); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 13, C to D - Room room = (Room) rooms.elementAt(13); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterialOutline(15,0,18,0,0); - room.AddTextBox("Sparky stops at the right wall. To make Sparky move up, connect a wire between the bottom thruster (C) and the right bumper (D). Now since Sparky is touching the right wall, electricity flows into the bottom thruster and Sparky moves up.", - 2*28, 2*32, 300); - room.AddArrow(17*28,0, Arrow.DIR_UP, 28, Color.white); - } - { // Room 14, Flipping wires - Room room = (Room) rooms.elementAt(14); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(14,4,19,4,1); - room.SetMaterialOutline(15,11,18,11,0); - room.SetMaterialOutline(19,1,19,3,0); - room.AddTextBox("The wire between C and D is hard to see. Move the Solderpen over the INPUT or OUTPUT until the tip turns green. Press F. This will flip the wire so it will be easier to see.", - 2*28, 2*32, 300); - room.AddArrow(559,2*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 15, E to F, H to G - Room room = (Room) rooms.elementAt(15); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(12,6,19,11,1); - room.SetMaterialOutline(0,1,0,3,0); - room.SetMaterialOutline(5,0,8,0,0); - room.SetMaterial(12,10,0); - room.AddTextBox("Now go back inside Sparky and connect E to F and H to G. Put Sparky in the small chamber so one bumper touches a wall and watch it go!", - 9*28, 2*32, 300); - room.AddTextBox("You have just created you first robot circuit!", - 2*28, 8*32, 200); - room.AddArrow(7*28,0, Arrow.DIR_UP, 28, Color.white); - } - { // Room 16, Clockwise? - Room room = (Room) rooms.elementAt(16); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(12,6,19,11,1); - room.SetMaterial(12,10,0); - room.SetMaterialOutline(5,11,8,11,0); - room.SetMaterialOutline(6,0,9,0,0); - room.SetMaterialOutline(19,3,19,4,0); - room.AddTextBox("Sparky moves counter- clockwise.", - 2*28, 2*32, 200); - room.AddTextBox("Can you rewire it to go clockwise instead?", - 2*28, 5*32, 200); - room.AddTextBox("Leave Sparky here when you are done.", - 2*28, 9*32, 200); - room.AddTextBox("SOLUTION", - 15*28, 4*32+8, 300); - room.AddArrow(8*28,0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(559,4*32, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 17, Clockwise solution - Room room = (Room) rooms.elementAt(17); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(0,3,0,4,0); - room.AddTextBox("To make a clockwise wall-hugging robot, connect A to F, D to G, E to B, and H to C.", - 4*28, 4*32, 400); - } - { // Room 18, Checkers - Room room = (Room) rooms.elementAt(18); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(6,11,9,11,0); - room.SetMaterialOutline(13,0,16,0,0); - room.AddTextBox("Robot can signal other robots with their antennas. Connect a wire from Checker's left bumper (A) to it's antenna INPUT (B).", - 2*28, 2*32, 300); - room.AddTextBox("Take Checkers with you.", - 11*28, 10*32, 200); - room.AddArrow(15*28,0, Arrow.DIR_UP, 28, Color.white); - WhiteRobot robot = new WhiteRobot(3*28,9*32,room); - items.addElement(robot); - robot.charge = 100000; - robot.InternalRoom.AddTextBox("A",3*28,5*32,100); - robot.InternalRoom.AddTextBox("B",4*28,4*32,100); - } - { // Room 19, X marks the spot - Room room = (Room) rooms.elementAt(19); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(13,11,16,11,0); - room.SetMaterialOutline(19,7,19,9,0); - room.SetMaterial(1,0,0); - room.AddTextBox("Take the short cut and bring back Scanner. Connect a wire from Scanner's antenna OUTPUT to one of it's thrusters.", - 4*28, 3*32, 450); - room.AddTextBox("Now bump Checkers into the wall on the left and watch Scanner move! Put Scanner on the X and take Checkers with you.", - 4*28, 6*32, 450); - room.AddTextBox("SHORT CUT", - 2*28, 2*32, 300); - room.AddTextBox("{BIG} {000,255,000} X", - 7*28, 9*32, 300); - room.AddArrow(559,8*32+16, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(28+14,32, Arrow.DIR_UP, 28, Color.white); - } - { // Room 20, Shortcut - Room room = (Room) rooms.elementAt(20); - room.SetMaterialFill(0,0,19,11,5); - room.SetMaterial(0,10,0); - room.SetMaterial(1,10,0); - room.SetMaterial(1,11,0); - } - { // Room 21, Antenna talk - Room room = (Room) rooms.elementAt(21); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(0,7,0,9,0); - room.SetMaterialOutline(8,11,11,11,0); - room.AddTextBox("An antenna signal is tranmitted to all the robots at once, even if they aren't in the same room. Bump Checkers into the left wall again so the antenna beeps. Then look back into the previous room. Scanner is no longer on the X.", - 2*28, 2*32, 450); - room.AddArrow(10*28,383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 22, more radio talk - Room room = (Room) rooms.elementAt(22); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(8,0,11,0,0); - room.SetMaterialOutline(19,7,19,9,0); - room.AddTextBox("Robot radios have only one channel. That means that if all the robots try to send signals at once, only one robot's signal gets through.", - 2*28, 5*32, 400); - room.AddArrow(559,8*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 23, End of tutorial - Room room = (Room) rooms.elementAt(23); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(0,7,0,9,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("Now you know the basics of wiring circuits in robots. Before returning to Robotropolis, we suggest you learn how to use Sensors and parts from the Toolkit to make some useful robot circuits.", - 2*28, 2*32, 500); - } - { // Room 24, Portals - Room room = (Room) rooms.elementAt(24); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterial(19,10,0); - room.SetMaterial(4,2,6); - room.SetMaterial(4,5,7); - room.AddTextBox("Learn about Robot Wiring", - 5*28, 3*32, 400); - room.AddTextBox("Return to the Main Menu", - 5*28, 6*32, 400); - } - { // Room 25, Shortcut to beginning - Room room = (Room) rooms.elementAt(25); - room.SetMaterialOutline(0,0,19,9,1); - room.SetMaterialOutline(0,11,19,11,1); - room.SetMaterial(0,10,0); - room.SetMaterial(19,10,0); - room.AddTextBox("{BIG} {000,255,000} SHORTCUT", - 172, 6*32, 400); - } - - - int[] list1 = {22,23,24,25,1,2,3,4,5,20}; - LinkRoomsHorizontally(list1); - LinkRoomsUpDown(5,6); - LinkRoomsUpDown(6,7); - LinkRoomsLeftRight(8,7); - LinkRoomsLeftRight(9,8); - LinkRoomsUpDown(9,10); - LinkRoomsUpDown(10,11); - LinkRoomsLeftRight(11,12); - LinkRoomsLeftRight(12,13); - LinkRoomsUpDown(14,13); - LinkRoomsLeftRight(14,15); - int[] list2 = {20,19,18,16,15}; - LinkRoomsVertically(list2); - LinkRoomsLeftRight(16,17); - LinkRoomsLeftRight(19,21); - LinkRoomsUpDown(21,22); - - - gameCursor = new GameCursor(9*28+14,9*32+16,(Room) rooms.elementAt(1)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - solderingPen = new SolderingPen(); - remote = new Remote(); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - player = gameCursor; - currentViewer = player; - - } +import java.awt.*; + +class ROTutB extends Level { + public ROTutB(RoomDisplay rd) { + super(rd); + + // Material 0, Blank + materials.addElement(new Material(true, false)); + // Material 1, LightBlue Wall + materials.addElement(new Material(new Color(192, 192, 255), false, true)); + // Material 2, Green Wall + materials.addElement(new Material(new Color(0, 255, 0), false, true)); + // Material 3, Orange Wall + materials.addElement(new Material(new Color(255, 128, 0), false, true)); + // Material 4, LightOrange Wall + materials.addElement(new Material(new Color(255, 224, 192), false, true)); + // Material 5, Blue Wall + materials.addElement(new Material(new Color(0, 0, 255), false, true)); + // Material 6, Portal to Tutorial C; + materials.addElement(new Portal("ROTutC.lvl", false, true)); + // Material 7, Portal to Main Menu; + materials.addElement(new Portal("MainMenu.lvl", false, true)); + + for (int a = 0; a < 26; a++) { + rooms.addElement(new Room()); + } + + { // Room 0, Help Screen + Room room = rooms.elementAt(0); + room.SetMaterialOutline(0, 0, 19, 11, 2); + room.AddTextBox("Circuits are made of wires connected to INPUTS and OUTPUTS. Circuits make robots move, grab objects, and send signals.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Press S to use the Solderpen to connect an INPUT to an OUTPUT.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("Press C to become the Cursor again.", + 2 * 28, 6 * 32, 500); + room.AddTextBox("Use SPACEBAR or RIGHT BUTTON to connect or disconnect wires from INPUTS or OUTPUTS when soldering.", + 2 * 28, 8 * 32, 500); + room.AddTextBox("To continue, press RETURN", + 5 * 28, 11 * 32, 500); + } + { // Room 1, Title Screen + Room room = rooms.elementAt(1); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(19, 5, 19, 7, 0); + room.SetMaterial(0, 10, 0); + room.AddTextBox("{BIG} ROBOT WIRING", 4 * 28, 2 * 32, 500); + room.AddTextBox("The robots in the Robotropolis Sewer are prewired to work for you. In the subway and higher levels of Robotropolis you need to change the wiring.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("Here you will find out how to wire a robot.", + 2 * 28, 8 * 32, 500); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 2, Circuit basics + Room room = rooms.elementAt(2); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 5, 0, 7, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("The wiring inside a robot makes it move, pick up objects, and send signals. This wiring is called a CIRCUIT.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("To create a circuit in a robot you solder wires to the INPUTS and OUTPUTS of various robot parts.", + 2 * 28, 5 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 3, Input & Scanner + Room room = rooms.elementAt(3); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 0, 3, 3, 1); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("This is an INPUT. Go inside Scanner and look for all the INPUTS. You will see them on the four thrusters, the grabber control, and the antenna control.", + 5 * 28, 2 * 32, 375); + room.AddTextBox("Take Scanner with you.", + 5 * 28, 7 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new BlueRobot(9 * 28, 8 * 32, room)); + PortDevice pd = new PortDevice(2 * 28 - 8, 24, room, 24, Port.TYPE_INPUT); + items.addElement(pd); + pd.rotate(1); + pd.rotate(1); + } + { // Room 4, Output + Room room = rooms.elementAt(4); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 0, 3, 3, 1); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("This is an OUTPUT. Inside the robot you will see outputs on the graber control, the four bumpers, and the antenna control. When a robot part is activated, electricity flows OUT of it's OUTPUT.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("Take Scanner with you.", + 5 * 28, 8 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + PortDevice pd = new PortDevice(2 * 28 - 8, 24, room, 24, Port.TYPE_OUTPUT); + items.addElement(pd); + pd.rotate(1); + pd.rotate(1); + } + { // Room 5, First demo + Room room = rooms.elementAt(5); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterialOutline(7, 11, 10, 11, 0); + room.SetMaterial(19, 10, 0); + room.AddTextBox("Move Scanner so one bumper just touches a wall. (Be sure the Remote Control is on.) The robot squawks and the outside bumper turns orange. Go inside and look at the output for that bumper. It is also orange. Electricity is flowing OUT of it's OUTPUT.", + 2 * 28, 2 * 32, 450); + room.AddTextBox("Leave Scanner here.", + 2 * 28, 8 * 32, 500); + room.AddArrow(9 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 6, Solderpen + Room room = rooms.elementAt(6); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 0, 5, 3, 1); + room.SetMaterialOutline(7, 0, 10, 0, 0); + room.SetMaterialOutline(5, 11, 8, 11, 0); + room.AddTextBox("The Solderpen is used to wire OUTPUTS to INPUTS.", + 11 * 28, 2 * 32, 230); + room.AddTextBox("Press S to become the Solderpen.", + 11 * 28, 6 * 32, 230); + room.AddArrow(7 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + SolderingPen sp = new SolderingPen(); + sp.x = 3 * 28 + 14; + sp.y = 32 + 16; + sp.room = room; + items.addElement(sp); + room.AddTextBox("TIP", 1 * 28, 2 * 32 + 10, 200); + room.AddArrow(3 * 28 + 12, 2 * 32 + 4, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 7, Attach wires + Room room = rooms.elementAt(7); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0} + }; + room.AddTextBox("Move the Solderpen to the INPUT until the tip glows orange.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Press Spacebar or RIGHT BUTTON to begin soldering. Move the Solderpen to the OUTPUT. (A wire will follow you.) When the tip glows orange press SPACEBAR to conenct the wire.", + 2 * 28, 7 * 32, 400); + room.AddArrow(0, 3 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + items.addElement(new Thruster(17 * 28, 9 * 32, room, Port.ROT_RIGHT, Color.blue)); + PortDevice pd = new PortDevice(15 * 28, 10 * 32, room, 28, Port.TYPE_OUTPUT); + pd.value = true; + items.addElement(pd); + } + { // Room 8, Detatch wires + Room room = rooms.elementAt(8); + room.RoomArray = new int[][]{ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0} + }; + room.AddTextBox("It's easy to disconnect a wire.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Move the tip of the Solderpen to either the INPUT or OUTPUT. Press the SPACEBAR when the tip glows green.", + 2 * 28, 8 * 32, 350); + room.AddArrow(0, 5 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + Thruster thruster = new Thruster(17 * 28, 9 * 32, room, Port.ROT_RIGHT, Color.blue); + items.addElement(thruster); + PortDevice pd = new PortDevice(15 * 28, 10 * 32, room, 28, Port.TYPE_OUTPUT); + pd.value = true; + items.addElement(pd); + Wire wire = new Wire(thruster.ports[0], pd.ports[0]); + } + { // Room 9, Sparky + Room room = rooms.elementAt(9); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(19, 4, 19, 6, 0); + room.SetMaterialOutline(8, 11, 11, 11, 0); + room.AddTextBox("Now you are ready to create a circuit in a robot. Press C to use the cursor again.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Take Sparky with you through the next few rooms to make a wall-hugging robot.", + 2 * 28, 8 * 32, 300); + room.AddArrow(10 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + OrangeRobot robot = new OrangeRobot(14 * 28, 8 * 32, room); + robot.charge = 100000; + robot.thrusterPower = true; + robot.InternalRoom.AddTextBox("A", 3 * 28, 8 * 32, 100); + robot.InternalRoom.AddTextBox("B", 6 * 28, 11 * 32, 100); + robot.InternalRoom.AddTextBox("C", 14 * 28, 11 * 32, 100); + robot.InternalRoom.AddTextBox("D", 16 * 28, 8 * 32, 100); + robot.InternalRoom.AddTextBox("E", 16 * 28, 5 * 32, 100); + robot.InternalRoom.AddTextBox("F", 15 * 28, 2 * 32, 100); + robot.InternalRoom.AddTextBox("G", 7 * 28, 2 * 32, 100); + robot.InternalRoom.AddTextBox("H", 3 * 28, 5 * 32, 100); + items.addElement(robot); + } + { // Room 10, A to B + Room room = rooms.elementAt(10); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(8, 0, 11, 0, 0); + room.SetMaterialOutline(15, 11, 18, 11, 0); + room.AddTextBox("Press S to use the Solderpen again.", + 2 * 28, 2 * 32, 300); + room.AddTextBox("Go inside Sparky and connect the left thruster (marked A) to the bottom bumper (marked B). Be sure the Remote Control and the robot thruster switch are on.", + 2 * 28, 6 * 32, 300); + room.AddArrow(17 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 11, First test + Room room = rooms.elementAt(11); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialOutline(15, 0, 18, 0, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("Place Sparky next to the bottom wall so it's bumper just touches the wall. When the bumper touches the wall, electricity flows from the bumper to the thruster, propelling the robot.", + 2 * 28, 2 * 32, 300); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 12, Continuing + Room room = rooms.elementAt(12); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialOutline(0, 8, 19, 10, 0); + room.AddTextBox("When the left thruster is on, Sparky moves to the right. The thruster pushes the robot in the opposite direction.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("What will happen when the right thruster is on?", + 2 * 28, 5 * 32, 450); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 13, C to D + Room room = rooms.elementAt(13); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterialOutline(15, 0, 18, 0, 0); + room.AddTextBox("Sparky stops at the right wall. To make Sparky move up, connect a wire between the bottom thruster (C) and the right bumper (D). Now since Sparky is touching the right wall, electricity flows into the bottom thruster and Sparky moves up.", + 2 * 28, 2 * 32, 300); + room.AddArrow(17 * 28, 0, Arrow.DIR_UP, 28, Color.white); + } + { // Room 14, Flipping wires + Room room = rooms.elementAt(14); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(14, 4, 19, 4, 1); + room.SetMaterialOutline(15, 11, 18, 11, 0); + room.SetMaterialOutline(19, 1, 19, 3, 0); + room.AddTextBox("The wire between C and D is hard to see. Move the Solderpen over the INPUT or OUTPUT until the tip turns green. Press F. This will flip the wire so it will be easier to see.", + 2 * 28, 2 * 32, 300); + room.AddArrow(559, 2 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 15, E to F, H to G + Room room = rooms.elementAt(15); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(12, 6, 19, 11, 1); + room.SetMaterialOutline(0, 1, 0, 3, 0); + room.SetMaterialOutline(5, 0, 8, 0, 0); + room.SetMaterial(12, 10, 0); + room.AddTextBox("Now go back inside Sparky and connect E to F and H to G. Put Sparky in the small chamber so one bumper touches a wall and watch it go!", + 9 * 28, 2 * 32, 300); + room.AddTextBox("You have just created you first robot circuit!", + 2 * 28, 8 * 32, 200); + room.AddArrow(7 * 28, 0, Arrow.DIR_UP, 28, Color.white); + } + { // Room 16, Clockwise? + Room room = rooms.elementAt(16); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(12, 6, 19, 11, 1); + room.SetMaterial(12, 10, 0); + room.SetMaterialOutline(5, 11, 8, 11, 0); + room.SetMaterialOutline(6, 0, 9, 0, 0); + room.SetMaterialOutline(19, 3, 19, 4, 0); + room.AddTextBox("Sparky moves counter- clockwise.", + 2 * 28, 2 * 32, 200); + room.AddTextBox("Can you rewire it to go clockwise instead?", + 2 * 28, 5 * 32, 200); + room.AddTextBox("Leave Sparky here when you are done.", + 2 * 28, 9 * 32, 200); + room.AddTextBox("SOLUTION", + 15 * 28, 4 * 32 + 8, 300); + room.AddArrow(8 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(559, 4 * 32, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 17, Clockwise solution + Room room = rooms.elementAt(17); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(0, 3, 0, 4, 0); + room.AddTextBox("To make a clockwise wall-hugging robot, connect A to F, D to G, E to B, and H to C.", + 4 * 28, 4 * 32, 400); + } + { // Room 18, Checkers + Room room = rooms.elementAt(18); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(6, 11, 9, 11, 0); + room.SetMaterialOutline(13, 0, 16, 0, 0); + room.AddTextBox("Robot can signal other robots with their antennas. Connect a wire from Checker's left bumper (A) to it's antenna INPUT (B).", + 2 * 28, 2 * 32, 300); + room.AddTextBox("Take Checkers with you.", + 11 * 28, 10 * 32, 200); + room.AddArrow(15 * 28, 0, Arrow.DIR_UP, 28, Color.white); + WhiteRobot robot = new WhiteRobot(3 * 28, 9 * 32, room); + items.addElement(robot); + robot.charge = 100000; + robot.InternalRoom.AddTextBox("A", 3 * 28, 5 * 32, 100); + robot.InternalRoom.AddTextBox("B", 4 * 28, 4 * 32, 100); + } + { // Room 19, X marks the spot + Room room = rooms.elementAt(19); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(13, 11, 16, 11, 0); + room.SetMaterialOutline(19, 7, 19, 9, 0); + room.SetMaterial(1, 0, 0); + room.AddTextBox("Take the short cut and bring back Scanner. Connect a wire from Scanner's antenna OUTPUT to one of it's thrusters.", + 4 * 28, 3 * 32, 450); + room.AddTextBox("Now bump Checkers into the wall on the left and watch Scanner move! Put Scanner on the X and take Checkers with you.", + 4 * 28, 6 * 32, 450); + room.AddTextBox("SHORT CUT", + 2 * 28, 2 * 32, 300); + room.AddTextBox("{BIG} {000,255,000} X", + 7 * 28, 9 * 32, 300); + room.AddArrow(559, 8 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(28 + 14, 32, Arrow.DIR_UP, 28, Color.white); + } + { // Room 20, Shortcut + Room room = rooms.elementAt(20); + room.SetMaterialFill(0, 0, 19, 11, 5); + room.SetMaterial(0, 10, 0); + room.SetMaterial(1, 10, 0); + room.SetMaterial(1, 11, 0); + } + { // Room 21, Antenna talk + Room room = rooms.elementAt(21); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(0, 7, 0, 9, 0); + room.SetMaterialOutline(8, 11, 11, 11, 0); + room.AddTextBox("An antenna signal is tranmitted to all the robots at once, even if they aren't in the same room. Bump Checkers into the left wall again so the antenna beeps. Then look back into the previous room. Scanner is no longer on the X.", + 2 * 28, 2 * 32, 450); + room.AddArrow(10 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 22, more radio talk + Room room = rooms.elementAt(22); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(8, 0, 11, 0, 0); + room.SetMaterialOutline(19, 7, 19, 9, 0); + room.AddTextBox("Robot radios have only one channel. That means that if all the robots try to send signals at once, only one robot's signal gets through.", + 2 * 28, 5 * 32, 400); + room.AddArrow(559, 8 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 23, End of tutorial + Room room = rooms.elementAt(23); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(0, 7, 0, 9, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("Now you know the basics of wiring circuits in robots. Before returning to Robotropolis, we suggest you learn how to use Sensors and parts from the Toolkit to make some useful robot circuits.", + 2 * 28, 2 * 32, 500); + } + { // Room 24, Portals + Room room = rooms.elementAt(24); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterial(19, 10, 0); + room.SetMaterial(4, 2, 6); + room.SetMaterial(4, 5, 7); + room.AddTextBox("Learn about Robot Wiring", + 5 * 28, 3 * 32, 400); + room.AddTextBox("Return to the Main Menu", + 5 * 28, 6 * 32, 400); + } + { // Room 25, Shortcut to beginning + Room room = rooms.elementAt(25); + room.SetMaterialOutline(0, 0, 19, 9, 1); + room.SetMaterialOutline(0, 11, 19, 11, 1); + room.SetMaterial(0, 10, 0); + room.SetMaterial(19, 10, 0); + room.AddTextBox("{BIG} {000,255,000} SHORTCUT", + 172, 6 * 32, 400); + } + + + int[] list1 = {22, 23, 24, 25, 1, 2, 3, 4, 5, 20}; + LinkRoomsHorizontally(list1); + LinkRoomsUpDown(5, 6); + LinkRoomsUpDown(6, 7); + LinkRoomsLeftRight(8, 7); + LinkRoomsLeftRight(9, 8); + LinkRoomsUpDown(9, 10); + LinkRoomsUpDown(10, 11); + LinkRoomsLeftRight(11, 12); + LinkRoomsLeftRight(12, 13); + LinkRoomsUpDown(14, 13); + LinkRoomsLeftRight(14, 15); + int[] list2 = {20, 19, 18, 16, 15}; + LinkRoomsVertically(list2); + LinkRoomsLeftRight(16, 17); + LinkRoomsLeftRight(19, 21); + LinkRoomsUpDown(21, 22); + + + gameCursor = new GameCursor(9 * 28 + 14, 9 * 32 + 16, rooms.elementAt(1)); + helpCam = new HelpCam(rooms.elementAt(0)); + solderingPen = new SolderingPen(); + remote = new Remote(); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + player = gameCursor; + currentViewer = player; + + } } \ No newline at end of file diff --git a/src/com/droidquest/levels/ROTutC.java b/src/com/droidquest/levels/ROTutC.java index c15252a..726fa15 100644 --- a/src/com/droidquest/levels/ROTutC.java +++ b/src/com/droidquest/levels/ROTutC.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.avatars.GameCursor; @@ -12,360 +10,356 @@ import com.droidquest.decorations.Arrow; import com.droidquest.devices.ContactSensor; import com.droidquest.devices.DirectionalSensor; import com.droidquest.devices.RoomSensor; -import com.droidquest.items.BlueRobot; -import com.droidquest.items.Crystal; -import com.droidquest.items.Square; -import com.droidquest.items.Token; -import com.droidquest.items.Triangle; -import com.droidquest.items.WhiteRobot; +import com.droidquest.items.*; import com.droidquest.materials.Material; import com.droidquest.materials.Portal; import com.droidquest.materials.ShapeEditor; -class ROTutC extends Level -{ -public ROTutC(RoomDisplay rd) - { - super(rd); - - // Material 0, Blank - materials.addElement(new Material(true, false)); - // Material 1, LightBlue Wall - materials.addElement(new Material(new Color(192,192,255),false, true)); - // Material 2, Green Wall - materials.addElement(new Material(new Color(0,255,0),false, true)); - // Material 3, Orange Wall - materials.addElement(new Material(new Color(255,128,0),false, true)); - // Material 4, LightOrange Wall - materials.addElement(new Material(new Color(255,224,192),false, true)); - // Material 5, Blue Wall - materials.addElement(new Material(new Color(0,0,255),false, true)); - // Material 6, Dark Blue Wall - materials.addElement(new Material(new Color(0,0,128),false, true)); - // Material 7, Shape Editor - materials.addElement(new ShapeEditor(new Square(0,0,null,Color.white))); - // Material 8, Portal to next Tutorial - materials.addElement(new Portal("ROTutD.lvl",false, true)); - // Material 9, Portal to Innovation Lab - materials.addElement(new Portal("ROLab.lvl",false, true)); - // Material 10, Portal to Main Menu - materials.addElement(new Portal("MainMenu.lvl",false, true)); - - for (int a=0; a<22; a++) - rooms.addElement(new Room()); - - { // Room 0, Help Screen - Room room = (Room) rooms.elementAt(0); - room.SetMaterialOutline(0,0,19,11,2); - room.AddTextBox("CONTACT SENSORS detect objects that touch the sensor, or the robot containing the sensor.", - 2*28, 2*32, 500); - room.AddTextBox("IN-SAME-ROOM SENSORS detect objects that are in the same room.", - 2*28, 4*32, 500); - room.AddTextBox("DIRECTIONAL SENSORS point to the direction of an object.", - 2*28, 5*32+16, 500); - room.AddTextBox("For a sensor to detect an object:", - 2*28, 7*32, 500); - room.AddTextBox("1) The Remote Control must be on.", - 2*28, 8*32, 500); - room.AddTextBox("2) The shapes must match.", - 2*28, 9*32, 500); - room.AddTextBox("3) The object must not be held by the cursor or a robot.", - 2*28, 10*32, 500); - } - { // Room 1, Title Screen - Room room = (Room) rooms.elementAt(1); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(19,6,19,8,0); - room.SetMaterial(0,10,0); - room.AddTextBox("{BIG} SENSORS", 7*28, 2*32, 500); - room.AddTextBox("Sometimes in Robotropolis you will want your robot to detect certain objects. For example you might want your robot to \"home in\" on an energy crystal and pick it up for you.", - 2*28, 4*32, 500); - room.AddTextBox("Robots use special detectors called SENSORS to locate objects. You'll learn about them here.", - 4*28, 8*32, 400); - room.AddArrow(559,7*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 2, Intro of all three - Room room = (Room) rooms.elementAt(2); - room.SetMaterialOutline(0,0,19,5,5); - room.SetMaterialOutline(0,9,19,11,5); - room.SetMaterialOutline(1,9,18,10,0); - room.AddTextBox("Directional", - 28+14, 5*32-8, 500); - room.AddTextBox("In-Same-Room", - 8*28, 5*32-8, 500); - room.AddTextBox("Contact", - 15*28, 5*32-8, 500); - room.AddTextBox("There are three types of sensors in Robotropolis. The sensors will help you and the robots find various objects.", - 2*28, 9*32, 500); - room.AddArrow(559,7*32+16, Arrow.DIR_RIGHT, 28, Color.white); - items.addElement(new DirectionalSensor(2*28,1*32,room, - new Crystal(0,0,null,0))); - items.addElement(new RoomSensor(9*28,2*32,room, - new Crystal(0,0,null,0))); - items.addElement(new ContactSensor(15*28,2*32,room, - new Crystal(0,0,null,0))); - } - { // Room 3, Contact Sensor - Room room = (Room) rooms.elementAt(3); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(0,6,19,8,0); - room.AddTextBox("This is a CONTACT sensor. It detects objects that touch it.", - 2*28, 2*32, 420); - room.AddTextBox("Place the energy crystal on the sensor. What happens when you let go?", - 2*28, 4*32, 400); - room.AddTextBox("Sensors only detect objects that are NOT be held. Take the sensor with you.", - 2*28, 9*32, 500); - room.AddArrow(559,7*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - items.addElement(new ContactSensor(16*28,3*32,room, - new Crystal(0,0,null,0))); - items.addElement(new Crystal(10*28,6*32,room,100000)); - } - { // Room 4, Scanner - Room room = (Room) rooms.elementAt(4); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,6,19,8,0); - room.AddTextBox("Carry the sensor into Scanner. Connect a wire from the sensor output to the antenna input. Come back outside.", - 2*28, 2*32, 350); - room.AddTextBox("Drop the crystal on Scanner's body. When a CONTACT sensor is inside a robot, it detects objects that touch the robot's body. Take Scanner with you.", - 2*28, 9*32, 500); - room.AddArrow(559,7*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - items.addElement(new Crystal(10*28,6*32,room,100000)); - items.addElement(new BlueRobot(16*28,2*32,room)); - } - { // Room 5, Contact talk - Room room = (Room) rooms.elementAt(5); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(0,6,19,8,0); - room.AddTextBox("This CONTACT sensor is on because the crystal is touching it. Turn the Remote Control off to freeze electricity. Move the crystal. The sensors work only if the Remote Control is on. Drop the crystal on Scanner's body.", - 2*28, 2*32, 500); - room.AddTextBox("Turn the Remote Control on and off. Electricity in the sensor inside Scanner is frozen unless the Remote Control is on. Take Scanner with you.", - 2*28, 9*32, 500); - room.AddArrow(559,7*32+16, Arrow.DIR_RIGHT, 28, Color.white); - items.addElement(new ContactSensor(10*28+8,6*32,room, - new Crystal(0,0,null,0))); - items.addElement(new Crystal(10*28,6*32,room,100000)); - } - { // Room 6, Triangle Contact - Room room = (Room) rooms.elementAt(6); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,5,0,7,0); - room.SetMaterialOutline(15,11,18,11,0); - room.AddTextBox("This CONTACT sensor is shaped like a triangle. It detects triangles that touch it. Sensors detect objects that detect the object shape.", - 2*28, 2*32, 300); - room.AddTextBox("Can you rewire Scanner to beep when a triangle touches it? Leave Scanner here.", - 2*28, 9*32, 500); - room.AddArrow(17*28,383, Arrow.DIR_DOWN, 28, Color.white) ; - items.addElement(new Triangle(15*28,5*32,room,Color.blue)); - items.addElement(new ContactSensor(14*28,2*32,room, - new Triangle(0,0,null,Color.white))); - } - { // Room 7, Room Sensor - Room room = (Room) rooms.elementAt(7); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(15,0,18,0,0); - room.SetMaterialOutline(0,5,0,7,0); - room.AddTextBox("This is an IN-SAME-ROOM sensor. It detects objects in the same room with it. Since this sensor has a square shape, it detects squares.", - 2*28, 2*32, 400); - room.AddTextBox("It is on now because there is a square in the room. Take the sensor with you into the next room.", - 2*28, 9*32, 500); - room.AddArrow(0, 6*32+16, Arrow.DIR_LEFT, 28, Color.white); - items.addElement(new Square(5*28,6*32,room,Color.blue)); - items.addElement(new RoomSensor(14*28, 6*32, room, - new Square(0,0,null,Color.white))); - } - { // Room 8, Carrying items - Room room = (Room) rooms.elementAt(8); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,5,19,7,0); - room.AddTextBox("Now the sensor is off, since there is no square in the room. Go back and bring the square into this room. Drop the sqaure. Now the sensor comes on.", - 2*28, 2*32, 450); - room.AddTextBox("(Remember that sensors can't detect an object you are holding.) Take the sensor with you.", - 2*28, 9*32, 500); - room.AddArrow(0, 6*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 9, Checkers - Room room = (Room) rooms.elementAt(9); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(19,5,19,7,0); - room.SetMaterialOutline(1,11,4,11,0); - room.AddTextBox("Put the sensor inside Checkers and wire it to the antenna. Now go back and get the square. Checkers will beep when you drop the square. When an IN-SAME-ROOM sensor is inside a robot, it detects objects in the same room as the robot.", - 2*28, 2*32, 500); - room.AddTextBox("Take Checkers with you.", - 7*28, 10*32, 500); - room.AddArrow(3*28,383, Arrow.DIR_DOWN, 28, Color.white); - WhiteRobot robot = new WhiteRobot(10*28,7*32,room); - robot.InternalRoom.AddTextBox("A",16*28,4*32,100); - items.addElement(robot); - } - { // Room 10, Directional Sensor - Room room = (Room) rooms.elementAt(10); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(1,0,4,0,0); - room.SetMaterialOutline(0,4,0,6,0); - room.AddTextBox("This is a DIRECTONAL sensor. It detects the direction of an object in the same room.", - 5*28, 2*32, 300); - room.AddTextBox("Pick up the sensor. Move it around the token. Outputs pointing in the DIRECTION of the token turn on. Put the sensor and the token inside Checkers and carry the robot with you.", - 2*28, 8*32, 500); - room.AddArrow(0, 5*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - items.addElement(new Token(8*28, 5*32, room)); - items.addElement(new DirectionalSensor(15*28,1*32,room, - new Token(0,0,null))); - } - { // Room 11, Movement - Room room = (Room) rooms.elementAt(11); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(19,4,19,6,0); - room.SetMaterialOutline(0,8,0,10,0); - room.AddTextBox("You can use the DIRECTIONAL sensor to make Checkers \"home in\" on the token. Go inside Checkers and connect a wire from the robot's right thruster (A) to the left pointing output of the sensor.", - 2*28, 2*32, 450); - room.AddTextBox("Take the token out of Checkers and drop it left of the robot. Checkers moves left until it is even with the token. Take Checkers with you.", - 5*28, 8*32, 400); - room.AddArrow(0, 9*32+16, Arrow.DIR_LEFT, 28, Color.white) ; - } - { // Room 12, Complete Movement - Room room = (Room) rooms.elementAt(12); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(19,8,19,10,0); - room.SetMaterialOutline(1,11,4,11,0); - room.AddTextBox("Complete the wiring as follows: Left thruster to the right pointing sensor output, top thruster to the bottom output, bottom thruster to the top output.", - 2*28, 2*32, 500); - room.AddTextBox("Experiment by dropping the token in various parts of the room. Watch Checkers home in on it. Put the token inside Checkers and take the robot with you.", - 2*28, 6*32, 500); - room.AddArrow(3*28,383, Arrow.DIR_DOWN, 28, Color.white) ; - } - { // Room 13, Intro to complex behavior - Room room = (Room) rooms.elementAt(13); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(1,0,4,0,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("Now you'll see how to use the homing robot circuit to grab an object. First you need to activate the grabber. Use the IN-SAME-ROOM sensor inside Checkers. First disconnect the sensor from the antenna, and then wire the sensor to the grabber control input.", - 5*28, 2*32, 350); - room.AddTextBox("Take Checkers with you.", - 5*28, 10*32, 500); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 14, Square - Room room = (Room) rooms.elementAt(14); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(0,8,19,10,0); - room.AddTextBox("Because there is a square in this room, The grabber control is on. (Look inside Chekcers to see.)", - 2*28, 2*32, 300); - room.AddTextBox("Now bring the token outside of Checkers. Checkers will home in on it and grab it. Take Checkers into the next room.", - 2*28, 6*32, 300); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - items.addElement(new Square(17*28,2*32,room,new Color(255,128,0))); - } - { // Room 15, Questions - Room room = (Room) rooms.elementAt(15); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterialOutline(19,5,19,7,0); - room.AddTextBox("What happened when Checkers came into this room? Since there is no square in this room, the sensor connected to the grabber control turned off, and Checkers dropped the token.", - 2*28, 2*32, 500); - room.AddArrow(559, 6*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 16, Carrying - Room room = (Room) rooms.elementAt(16); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,5,0,7,0); - room.SetMaterialOutline(15,11,18,11,0); - room.AddTextBox("This DIRECTIONAL sensor is pointing toward the triangle. Since there is a square in the room, Checker's grabber is on. Let Checkers grab the triangle.", - 2*28, 2*32, 500); - room.AddTextBox("Now the DIRECTIONAL sensor is off. Sensors can't detect an object that a robot is holding. Take the sensor with you.", - 2*28, 9*32, 500); - room.AddArrow(17*28,383, Arrow.DIR_DOWN, 28, Color.white); - items.addElement(new Square(18*28,1*32,room,new Color(255,128,0))); - items.addElement(new DirectionalSensor(14*28,4*32,room, - new Triangle(0,0,null,Color.white))); - items.addElement(new Triangle(10*28,6*32,room,new Color(255,128,0))); - } - { // Room 17, Sensor Editor - Room room = (Room) rooms.elementAt(17); - room.SetMaterialOutline(0,0,19,11,4); - room.SetMaterialOutline(15,0,18,0,0); - room.SetMaterialOutline(19,8,19,10,0); - room.SetMaterial(3,2,7); - room.AddTextBox("This is a SHAPE EDITOR. Use it to change the shape of an object.", - 6*28, 2*32, 300); - room.AddTextBox("Pass the DIRECTIONAL sensor over it to change it from a triangle sensor to a square sensor.", - 2*28, 4*32, 400); - room.AddTextBox("You can verify that it senses squares by taking it to the previous room. There is a sensor editor in the Town of Robotropolis, and there are several in the Innovation Lab.", - 2*28, 7*32+16, 450); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 18, Sensor summary - Room room = (Room) rooms.elementAt(18); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,8,19,10,0); - room.AddTextBox("Sensors are very useful. There are just three things to remember about them.", - 2*28, 2*32, 500); - room.AddTextBox("1. Sensors can't detect an object that you or the robot are holding.", - 2*28, 4*32, 500); - room.AddTextBox("2. The object must have the same shape as the sensor to be detected.", - 2*28, 6*32, 500); - room.AddTextBox("3. The Remote Control must be on.", - 2*28, 8*32, 500); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 19, Last - Room room = (Room) rooms.elementAt(19); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,8,19,10,0); - room.AddTextBox("There are a lot of sensors and shape editors in the Innovation Lab. You might want to go there and just experiment with the sensors.", - 2*28, 2*32, 500); - room.AddTextBox("Before you continue in Robotropolis you will find it helpful to learn about the Toolkit and some Robot Circuits. Then you'll be ready for hours of fun in the Subway and Town.", - 2*28, 5*32, 500); - } - { // Room 20, Exit - Room room = (Room) rooms.elementAt(20); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterial(19,10,0); - room.SetMaterial(4,2,8); - room.SetMaterial(4,5,9); - room.SetMaterial(4,8,10); - room.AddTextBox("Learn about the ToolKit", - 5*28, 3*32, 500); - room.AddTextBox("Explore the Innovation Lab", - 5*28, 6*32, 500); - room.AddTextBox("Return to the Main Menu", - 5*28, 9*32, 500); - } - { // Room 21, Shortcut to beginning - Room room = (Room) rooms.elementAt(21); - room.SetMaterialOutline(0,0,19,9,1); - room.SetMaterialOutline(0,11,19,11,1); - room.SetMaterial(0,10,0); - room.SetMaterial(19,10,0); - room.AddTextBox("{BIG} {000,255,000} SHORTCUT", - 172, 6*32, 400); - } +import java.awt.*; - int[] list1 = {17,18,19,20,21,1,2,3,4,5,6}; - LinkRoomsHorizontally(list1); - LinkRoomsUpDown(6,7); - LinkRoomsLeftRight(8,7); - LinkRoomsLeftRight(9,8); - LinkRoomsUpDown(9,10); - LinkRoomsLeftRight(11,10); - LinkRoomsLeftRight(12,11); - LinkRoomsUpDown(12,13); - LinkRoomsLeftRight(13,14); - LinkRoomsLeftRight(14,15); - LinkRoomsLeftRight(15,16); - LinkRoomsUpDown(16,17); - - gameCursor = new GameCursor(17*28+14,6*32+16,(Room) rooms.elementAt(1)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - solderingPen = new SolderingPen(); - remote = new Remote(); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - player = gameCursor; - currentViewer = player; - - } +class ROTutC extends Level { + public ROTutC(RoomDisplay rd) { + super(rd); + + // Material 0, Blank + materials.addElement(new Material(true, false)); + // Material 1, LightBlue Wall + materials.addElement(new Material(new Color(192, 192, 255), false, true)); + // Material 2, Green Wall + materials.addElement(new Material(new Color(0, 255, 0), false, true)); + // Material 3, Orange Wall + materials.addElement(new Material(new Color(255, 128, 0), false, true)); + // Material 4, LightOrange Wall + materials.addElement(new Material(new Color(255, 224, 192), false, true)); + // Material 5, Blue Wall + materials.addElement(new Material(new Color(0, 0, 255), false, true)); + // Material 6, Dark Blue Wall + materials.addElement(new Material(new Color(0, 0, 128), false, true)); + // Material 7, Shape Editor + materials.addElement(new ShapeEditor(new Square(0, 0, null, Color.white))); + // Material 8, Portal to next Tutorial + materials.addElement(new Portal("ROTutD.lvl", false, true)); + // Material 9, Portal to Innovation Lab + materials.addElement(new Portal("ROLab.lvl", false, true)); + // Material 10, Portal to Main Menu + materials.addElement(new Portal("MainMenu.lvl", false, true)); + + for (int a = 0; a < 22; a++) { + rooms.addElement(new Room()); + } + + { // Room 0, Help Screen + Room room = rooms.elementAt(0); + room.SetMaterialOutline(0, 0, 19, 11, 2); + room.AddTextBox("CONTACT SENSORS detect objects that touch the sensor, or the robot containing the sensor.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("IN-SAME-ROOM SENSORS detect objects that are in the same room.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("DIRECTIONAL SENSORS point to the direction of an object.", + 2 * 28, 5 * 32 + 16, 500); + room.AddTextBox("For a sensor to detect an object:", + 2 * 28, 7 * 32, 500); + room.AddTextBox("1) The Remote Control must be on.", + 2 * 28, 8 * 32, 500); + room.AddTextBox("2) The shapes must match.", + 2 * 28, 9 * 32, 500); + room.AddTextBox("3) The object must not be held by the cursor or a robot.", + 2 * 28, 10 * 32, 500); + } + { // Room 1, Title Screen + Room room = rooms.elementAt(1); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(19, 6, 19, 8, 0); + room.SetMaterial(0, 10, 0); + room.AddTextBox("{BIG} SENSORS", 7 * 28, 2 * 32, 500); + room.AddTextBox("Sometimes in Robotropolis you will want your robot to detect certain objects. For example you might want your robot to \"home in\" on an energy crystal and pick it up for you.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("Robots use special detectors called SENSORS to locate objects. You'll learn about them here.", + 4 * 28, 8 * 32, 400); + room.AddArrow(559, 7 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 2, Intro of all three + Room room = rooms.elementAt(2); + room.SetMaterialOutline(0, 0, 19, 5, 5); + room.SetMaterialOutline(0, 9, 19, 11, 5); + room.SetMaterialOutline(1, 9, 18, 10, 0); + room.AddTextBox("Directional", + 28 + 14, 5 * 32 - 8, 500); + room.AddTextBox("In-Same-Room", + 8 * 28, 5 * 32 - 8, 500); + room.AddTextBox("Contact", + 15 * 28, 5 * 32 - 8, 500); + room.AddTextBox("There are three types of sensors in Robotropolis. The sensors will help you and the robots find various objects.", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 7 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new DirectionalSensor(2 * 28, 1 * 32, room, + new Crystal(0, 0, null, 0))); + items.addElement(new RoomSensor(9 * 28, 2 * 32, room, + new Crystal(0, 0, null, 0))); + items.addElement(new ContactSensor(15 * 28, 2 * 32, room, + new Crystal(0, 0, null, 0))); + } + { // Room 3, Contact Sensor + Room room = rooms.elementAt(3); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(0, 6, 19, 8, 0); + room.AddTextBox("This is a CONTACT sensor. It detects objects that touch it.", + 2 * 28, 2 * 32, 420); + room.AddTextBox("Place the energy crystal on the sensor. What happens when you let go?", + 2 * 28, 4 * 32, 400); + room.AddTextBox("Sensors only detect objects that are NOT be held. Take the sensor with you.", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 7 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new ContactSensor(16 * 28, 3 * 32, room, + new Crystal(0, 0, null, 0))); + items.addElement(new Crystal(10 * 28, 6 * 32, room, 100000)); + } + { // Room 4, Scanner + Room room = rooms.elementAt(4); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 6, 19, 8, 0); + room.AddTextBox("Carry the sensor into Scanner. Connect a wire from the sensor output to the antenna input. Come back outside.", + 2 * 28, 2 * 32, 350); + room.AddTextBox("Drop the crystal on Scanner's body. When a CONTACT sensor is inside a robot, it detects objects that touch the robot's body. Take Scanner with you.", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 7 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new Crystal(10 * 28, 6 * 32, room, 100000)); + items.addElement(new BlueRobot(16 * 28, 2 * 32, room)); + } + { // Room 5, Contact talk + Room room = rooms.elementAt(5); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(0, 6, 19, 8, 0); + room.AddTextBox("This CONTACT sensor is on because the crystal is touching it. Turn the Remote Control off to freeze electricity. Move the crystal. The sensors work only if the Remote Control is on. Drop the crystal on Scanner's body.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Turn the Remote Control on and off. Electricity in the sensor inside Scanner is frozen unless the Remote Control is on. Take Scanner with you.", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 7 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new ContactSensor(10 * 28 + 8, 6 * 32, room, + new Crystal(0, 0, null, 0))); + items.addElement(new Crystal(10 * 28, 6 * 32, room, 100000)); + } + { // Room 6, Triangle Contact + Room room = rooms.elementAt(6); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 5, 0, 7, 0); + room.SetMaterialOutline(15, 11, 18, 11, 0); + room.AddTextBox("This CONTACT sensor is shaped like a triangle. It detects triangles that touch it. Sensors detect objects that detect the object shape.", + 2 * 28, 2 * 32, 300); + room.AddTextBox("Can you rewire Scanner to beep when a triangle touches it? Leave Scanner here.", + 2 * 28, 9 * 32, 500); + room.AddArrow(17 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + items.addElement(new Triangle(15 * 28, 5 * 32, room, Color.blue)); + items.addElement(new ContactSensor(14 * 28, 2 * 32, room, + new Triangle(0, 0, null, Color.white))); + } + { // Room 7, Room Sensor + Room room = rooms.elementAt(7); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(15, 0, 18, 0, 0); + room.SetMaterialOutline(0, 5, 0, 7, 0); + room.AddTextBox("This is an IN-SAME-ROOM sensor. It detects objects in the same room with it. Since this sensor has a square shape, it detects squares.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("It is on now because there is a square in the room. Take the sensor with you into the next room.", + 2 * 28, 9 * 32, 500); + room.AddArrow(0, 6 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + items.addElement(new Square(5 * 28, 6 * 32, room, Color.blue)); + items.addElement(new RoomSensor(14 * 28, 6 * 32, room, + new Square(0, 0, null, Color.white))); + } + { // Room 8, Carrying items + Room room = rooms.elementAt(8); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 5, 19, 7, 0); + room.AddTextBox("Now the sensor is off, since there is no square in the room. Go back and bring the square into this room. Drop the sqaure. Now the sensor comes on.", + 2 * 28, 2 * 32, 450); + room.AddTextBox("(Remember that sensors can't detect an object you are holding.) Take the sensor with you.", + 2 * 28, 9 * 32, 500); + room.AddArrow(0, 6 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 9, Checkers + Room room = rooms.elementAt(9); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(19, 5, 19, 7, 0); + room.SetMaterialOutline(1, 11, 4, 11, 0); + room.AddTextBox("Put the sensor inside Checkers and wire it to the antenna. Now go back and get the square. Checkers will beep when you drop the square. When an IN-SAME-ROOM sensor is inside a robot, it detects objects in the same room as the robot.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Take Checkers with you.", + 7 * 28, 10 * 32, 500); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + WhiteRobot robot = new WhiteRobot(10 * 28, 7 * 32, room); + robot.InternalRoom.AddTextBox("A", 16 * 28, 4 * 32, 100); + items.addElement(robot); + } + { // Room 10, Directional Sensor + Room room = rooms.elementAt(10); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(1, 0, 4, 0, 0); + room.SetMaterialOutline(0, 4, 0, 6, 0); + room.AddTextBox("This is a DIRECTONAL sensor. It detects the direction of an object in the same room.", + 5 * 28, 2 * 32, 300); + room.AddTextBox("Pick up the sensor. Move it around the token. Outputs pointing in the DIRECTION of the token turn on. Put the sensor and the token inside Checkers and carry the robot with you.", + 2 * 28, 8 * 32, 500); + room.AddArrow(0, 5 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + items.addElement(new Token(8 * 28, 5 * 32, room)); + items.addElement(new DirectionalSensor(15 * 28, 1 * 32, room, + new Token(0, 0, null))); + } + { // Room 11, Movement + Room room = rooms.elementAt(11); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(19, 4, 19, 6, 0); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.AddTextBox("You can use the DIRECTIONAL sensor to make Checkers \"home in\" on the token. Go inside Checkers and connect a wire from the robot's right thruster (A) to the left pointing output of the sensor.", + 2 * 28, 2 * 32, 450); + room.AddTextBox("Take the token out of Checkers and drop it left of the robot. Checkers moves left until it is even with the token. Take Checkers with you.", + 5 * 28, 8 * 32, 400); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 12, Complete Movement + Room room = rooms.elementAt(12); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.SetMaterialOutline(1, 11, 4, 11, 0); + room.AddTextBox("Complete the wiring as follows: Left thruster to the right pointing sensor output, top thruster to the bottom output, bottom thruster to the top output.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Experiment by dropping the token in various parts of the room. Watch Checkers home in on it. Put the token inside Checkers and take the robot with you.", + 2 * 28, 6 * 32, 500); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 13, Intro to complex behavior + Room room = rooms.elementAt(13); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(1, 0, 4, 0, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("Now you'll see how to use the homing robot circuit to grab an object. First you need to activate the grabber. Use the IN-SAME-ROOM sensor inside Checkers. First disconnect the sensor from the antenna, and then wire the sensor to the grabber control input.", + 5 * 28, 2 * 32, 350); + room.AddTextBox("Take Checkers with you.", + 5 * 28, 10 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 14, Square + Room room = rooms.elementAt(14); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(0, 8, 19, 10, 0); + room.AddTextBox("Because there is a square in this room, The grabber control is on. (Look inside Chekcers to see.)", + 2 * 28, 2 * 32, 300); + room.AddTextBox("Now bring the token outside of Checkers. Checkers will home in on it and grab it. Take Checkers into the next room.", + 2 * 28, 6 * 32, 300); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new Square(17 * 28, 2 * 32, room, new Color(255, 128, 0))); + } + { // Room 15, Questions + Room room = rooms.elementAt(15); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterialOutline(19, 5, 19, 7, 0); + room.AddTextBox("What happened when Checkers came into this room? Since there is no square in this room, the sensor connected to the grabber control turned off, and Checkers dropped the token.", + 2 * 28, 2 * 32, 500); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 16, Carrying + Room room = rooms.elementAt(16); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 5, 0, 7, 0); + room.SetMaterialOutline(15, 11, 18, 11, 0); + room.AddTextBox("This DIRECTIONAL sensor is pointing toward the triangle. Since there is a square in the room, Checker's grabber is on. Let Checkers grab the triangle.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Now the DIRECTIONAL sensor is off. Sensors can't detect an object that a robot is holding. Take the sensor with you.", + 2 * 28, 9 * 32, 500); + room.AddArrow(17 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + items.addElement(new Square(18 * 28, 1 * 32, room, new Color(255, 128, 0))); + items.addElement(new DirectionalSensor(14 * 28, 4 * 32, room, + new Triangle(0, 0, null, Color.white))); + items.addElement(new Triangle(10 * 28, 6 * 32, room, new Color(255, 128, 0))); + } + { // Room 17, Sensor Editor + Room room = rooms.elementAt(17); + room.SetMaterialOutline(0, 0, 19, 11, 4); + room.SetMaterialOutline(15, 0, 18, 0, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.SetMaterial(3, 2, 7); + room.AddTextBox("This is a SHAPE EDITOR. Use it to change the shape of an object.", + 6 * 28, 2 * 32, 300); + room.AddTextBox("Pass the DIRECTIONAL sensor over it to change it from a triangle sensor to a square sensor.", + 2 * 28, 4 * 32, 400); + room.AddTextBox("You can verify that it senses squares by taking it to the previous room. There is a sensor editor in the Town of Robotropolis, and there are several in the Innovation Lab.", + 2 * 28, 7 * 32 + 16, 450); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 18, Sensor summary + Room room = rooms.elementAt(18); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 8, 19, 10, 0); + room.AddTextBox("Sensors are very useful. There are just three things to remember about them.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("1. Sensors can't detect an object that you or the robot are holding.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("2. The object must have the same shape as the sensor to be detected.", + 2 * 28, 6 * 32, 500); + room.AddTextBox("3. The Remote Control must be on.", + 2 * 28, 8 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 19, Last + Room room = rooms.elementAt(19); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 8, 19, 10, 0); + room.AddTextBox("There are a lot of sensors and shape editors in the Innovation Lab. You might want to go there and just experiment with the sensors.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Before you continue in Robotropolis you will find it helpful to learn about the Toolkit and some Robot Circuits. Then you'll be ready for hours of fun in the Subway and Town.", + 2 * 28, 5 * 32, 500); + } + { // Room 20, Exit + Room room = rooms.elementAt(20); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterial(19, 10, 0); + room.SetMaterial(4, 2, 8); + room.SetMaterial(4, 5, 9); + room.SetMaterial(4, 8, 10); + room.AddTextBox("Learn about the ToolKit", + 5 * 28, 3 * 32, 500); + room.AddTextBox("Explore the Innovation Lab", + 5 * 28, 6 * 32, 500); + room.AddTextBox("Return to the Main Menu", + 5 * 28, 9 * 32, 500); + } + { // Room 21, Shortcut to beginning + Room room = rooms.elementAt(21); + room.SetMaterialOutline(0, 0, 19, 9, 1); + room.SetMaterialOutline(0, 11, 19, 11, 1); + room.SetMaterial(0, 10, 0); + room.SetMaterial(19, 10, 0); + room.AddTextBox("{BIG} {000,255,000} SHORTCUT", + 172, 6 * 32, 400); + } + + int[] list1 = {17, 18, 19, 20, 21, 1, 2, 3, 4, 5, 6}; + LinkRoomsHorizontally(list1); + LinkRoomsUpDown(6, 7); + LinkRoomsLeftRight(8, 7); + LinkRoomsLeftRight(9, 8); + LinkRoomsUpDown(9, 10); + LinkRoomsLeftRight(11, 10); + LinkRoomsLeftRight(12, 11); + LinkRoomsUpDown(12, 13); + LinkRoomsLeftRight(13, 14); + LinkRoomsLeftRight(14, 15); + LinkRoomsLeftRight(15, 16); + LinkRoomsUpDown(16, 17); + + gameCursor = new GameCursor(17 * 28 + 14, 6 * 32 + 16, rooms.elementAt(1)); + helpCam = new HelpCam(rooms.elementAt(0)); + solderingPen = new SolderingPen(); + remote = new Remote(); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + player = gameCursor; + currentViewer = player; + + } } diff --git a/src/com/droidquest/levels/ROTutD.java b/src/com/droidquest/levels/ROTutD.java index 12b108c..3f6fd66 100644 --- a/src/com/droidquest/levels/ROTutD.java +++ b/src/com/droidquest/levels/ROTutD.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.Wire; @@ -11,730 +9,701 @@ import com.droidquest.avatars.Remote; import com.droidquest.avatars.SolderingPen; import com.droidquest.chipstuff.Port; import com.droidquest.decorations.Arrow; -import com.droidquest.devices.ANDGate; -import com.droidquest.devices.Antenna; -import com.droidquest.devices.ContactSensor; -import com.droidquest.devices.DirectionalSensor; -import com.droidquest.devices.FlipFlop; -import com.droidquest.devices.NOTGate; -import com.droidquest.devices.Node; -import com.droidquest.devices.ORGate; -import com.droidquest.devices.RoomSensor; -import com.droidquest.devices.Thruster; -import com.droidquest.devices.XORGate; -import com.droidquest.items.BlueRobot; -import com.droidquest.items.Crystal; -import com.droidquest.items.Key; -import com.droidquest.items.OrangeRobot; -import com.droidquest.items.SentryT2; -import com.droidquest.items.ToolBox; +import com.droidquest.devices.*; +import com.droidquest.items.*; import com.droidquest.materials.Material; import com.droidquest.materials.Portal; -class ROTutD extends Level -{ -public ROTutD(RoomDisplay rd) - { - super(rd); - - // Material 0, Blank - materials.addElement(new Material(true, false)); - // Material 1, LightBlue Wall - materials.addElement(new Material(new Color(192,192,255),false, true)); - // Material 2, Green Wall - materials.addElement(new Material(new Color(0,255,0),false, true)); - // Material 3, Orange Wall - materials.addElement(new Material(new Color(255,128,0),false, true)); - // Material 4, LightOrange Wall - materials.addElement(new Material(new Color(255,224,192),false, true)); - // Material 5, Blue Wall - materials.addElement(new Material(new Color(0,0,255),false, true)); - // Material 6, Dark Blue Wall - materials.addElement(new Material(new Color(0,0,128),false, true)); - // Material 7, Portal to next Tutorial - materials.addElement(new Portal("ROTutE.lvl",false, true)); - // Material 8, Portal to Main Menu - materials.addElement(new Portal("MainMenu.lvl",false, true)); - - for (int a=0; a<31; a++) - rooms.addElement(new Room()); - - { // Room 0, Help Screen - Room room = (Room) rooms.elementAt(0); - room.SetMaterialOutline(0,0,19,11,2); - room.AddTextBox("SPECIAL KEYS", - 7*28, 2*32, 500); - room.AddTextBox("H", - 2*28, 4*32, 100); - room.AddTextBox("Make the Cursor \"hot\" with electricity or cold again. use it to test circuits.", - 3*28, 4*32, 450); - room.AddTextBox("T", - 2*28, 7*32, 400); - room.AddTextBox("Summon Toolkit to you room. Open/Close Toolkit in room.", - 3*28, 7*32, 450); - room.AddTextBox("To continue, press RETURN.", - 4*28, 10*32, 500); - } - { // Room 1, Title Screen - Room room = (Room) rooms.elementAt(1); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(19,6,19,8,0); - room.SetMaterial(0,10,0); - room.AddTextBox("{BIG} THE TOOLKIT", 4*28, 2*32, 500); - room.AddTextBox("With what you have learned so far, you can make robots do a lot of simple tasks. But to get through the higher levels of Robotropolis, you will need to make circuits with parts from the Toolkit.", - 2*28, 4*32, 500); - room.AddTextBox("Notice that the cursor has changed. This cursor can be made \"hot\". You'll see how soon.", - 2*28, 9*32, 500); - room.AddArrow(559,7*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 2, Freeze Electricity - Room room = (Room) rooms.elementAt(2); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(0,6,19,8,0); - room.AddTextBox("This circuit was made by connecting wires between the INPUTS and OUTPUTS of two parts from the Toolkit. Use the Remote Control to stop and start the flow of electricity in the circuit.", - 2*28, 2*32, 500); - room.AddTextBox("The Remote Control starts and stops electricity both inside and outside robots.", - 2*28, 9*32, 500); - room.AddArrow(559,7*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - Node node = new Node(10*28,5*32,room, Node.TYPE_STRAIGHT); - NOTGate notgate = new NOTGate(15*28, 6*32, room); - items.addElement(node); - items.addElement(notgate); - Wire wire = new Wire(node.ports[0], notgate.ports[1]); - wire = new Wire(notgate.ports[0], node.ports[2]); - } - { // Room 3, Move parts - Room room = (Room) rooms.elementAt(3); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(0,6,0,8,0); - room.SetMaterialOutline(15,11,18,11,0); - room.AddTextBox("It's hard to see where the wires connect in this circuit, but you can fix that. Pick up one of the parts. When you move, the wires will \"stretch\" to follow the part.", - 2*28, 2*32, 450); - room.AddTextBox("However, the wire will break if you stretch it out of the room.", - 2*28, 9*32, 350); - room.AddArrow(17*28, 559, Arrow.DIR_DOWN, 28, Color.white) ; - Node node = new Node(10*28,7*32,room, Node.TYPE_STRAIGHT); - NOTGate notgate = new NOTGate(15*28, 6*32, room); - items.addElement(node); - items.addElement(notgate); - Wire wire = new Wire(node.ports[0], notgate.ports[1]); - wire = new Wire(notgate.ports[0], node.ports[2]); - } - { // Room 4, Toolkit - Room room = (Room) rooms.elementAt(4); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(15,0,18,0,0); - room.SetMaterialOutline(0,8,0,10,0); - room.AddTextBox("This is the TOOLKIT. Inside are parts you need to wire circuits.", - 2*28, 2*32, 300); - room.AddTextBox("Take the Toolkit into the next room.", - 2*28, 5*32, 300); - room.AddArrow(0,9*32+16, Arrow.DIR_LEFT, 28, Color.white); - toolbox = new ToolBox(16*28, 9*32, room); - items.addElement(toolbox); - } - { // Room 5, Open & close - Room room = (Room) rooms.elementAt(5); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(19,8,19,10,0); - room.SetMaterialOutline(1,11,3,11,0); - room.AddTextBox("You can open and close the Toolkit by pressing T. Try it a few times.", - 2*28, 2*32, 500); - room.AddTextBox("Leave the Toolkit here.", - 2*28, 4*32, 300); - room.AddTextBox("Drop Toolkit here.", - 2*28, 7*32, 200); - room.AddArrow(2*28+14, 383, Arrow.DIR_DOWN, 28, Color.white); - room.AddArrow(7*28,8*32, Arrow.DIR_RIGHT, 56, Color.white); - } - { // Room 6, Toolkit Sentry - Room room = (Room) rooms.elementAt(6); - int[][] table = { - {3,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}, - {3,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3}, - {3,0,0,0,0,0,0,3,3,0,0,3,3,3,3,3,3,0,0,3}, - {3,0,0,3,3,3,3,3,3,0,0,3,3,3,3,3,3,0,0,0}, - {3,0,0,3,3,3,3,3,3,0,0,3,3,0,0,3,3,0,0,0}, - {3,0,0,0,0,0,0,3,3,0,0,3,3,0,0,3,3,0,0,0}, - {3,0,0,0,0,0,0,3,3,0,0,3,3,0,0,3,3,0,0,0}, - {3,0,0,3,3,0,0,3,3,0,0,3,3,0,0,3,3,0,0,3}, - {3,0,0,3,3,0,0,0,0,0,0,3,3,0,0,0,0,0,0,3}, - {3,0,0,3,3,0,0,0,0,0,0,3,3,0,0,0,0,0,0,3}, - {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3} - }; - room.RoomArray = table; - room.AddTextBox("NO TOOLKITS ALLOWED!", - 2*28, 2*32, 150); - room.AddArrow(559, 6*32, Arrow.DIR_RIGHT, 28, Color.white); - items.add(new SentryT2(2*28, 2*32, room)); - } - { // Room 7, Summon - Room room = (Room) rooms.elementAt(7); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,4,0,7,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("If the Toolkit is nowhere in sight, you can summon it to you. (Think of it as sitting in your pocket wherever you go.)", - 2*28, 2*32, 500); - room.AddTextBox("Press T to summon the Toolkit. Drop it and press T to open and close it.", - 2*28, 9*32, 400); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 8, Objects in Toolkit - Room room = (Room) rooms.elementAt(8); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,8,19,10,0); - room.AddTextBox("You can take parts in and out of the Toolkit with the cursor.", - 2*28, 2*32, 500); - room.AddTextBox("To take a part out, move on top of it and press the SPACEBAR. To put it back, drop it anywhere in the Toolkit.", - 2*28, 5*32, 500); - room.AddTextBox("Open Toolkit here.", - 3*28, 9*32, 100); - room.AddArrow(7*28, 10*32+16, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 9, Rotating Objects - Room room = (Room) rooms.elementAt(9); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterialOutline(15,11,18,11,0); - room.AddTextBox("You can rotate parts left and right by holding a part and pressing the [ and ] keys.", - 2*28, 2*32, 450); - room.AddTextBox("There is no limit to the number of parts you can take out of the Toolkit.", - 2*28, 5*32, 450); - room.AddTextBox("Open Toolkit here.", - 3*28, 9*32, 100); - room.AddArrow(7*28, 10*32+16, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(17*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 10, Hot Cursor - Room room = (Room) rooms.elementAt(10); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(15,0,18,0,0); - room.SetMaterialOutline(1,11,4,11,0); - room.AddTextBox("The cursor here is special. It can be made \"HOT\" with electricity to test parts.", - 4*28, 2*32, 300); - room.AddTextBox("Press H to make the cursor hot.", - 4*28, 5*32, 300); - room.AddTextBox("Pass the hot cursor over the antenna INPUT to turn the antenna on.", - 5*28, 7*32, 400); - room.AddTextBox("Press H again to make the cursor cold.", - 5*28, 10*32, 400); - room.AddArrow(3*28, 383, Arrow.DIR_DOWN, 28, Color.white); - items.addElement(new Antenna(2*28, 2*32, room, Color.white)); - } - { // Room 11, Hot Cursor 2 - Room room = (Room) rooms.elementAt(11); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(1,0,4,0,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("You can also use the hot cursor to move a robot. Just sit on the thruster input and the robot will move.", - 5*28, 2*32, 400); - room.AddTextBox("The hot cursor is available for testing circuits in the Innovation Lab. Unfortunately you can't use it in Robotropolis. (It would spoil the game.)", - 2*28, 7*32, 400); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - OrangeRobot robot = new OrangeRobot(13*28, 4*32, room); - robot.thrusterPower = true; - items.addElement(robot); - } - { // Room 12, Crossroads intro - Room room = (Room) rooms.elementAt(12); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,8,19,10,0); - room.AddTextBox("The next room is called the CROSSROADS. From it you can follow various paths to learn about different parts in the Toolkit.", - 2*28, 2*32, 500); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 13, Crossroads - Room room = (Room) rooms.elementAt(13); - int[][] table = { - {6,0,0,0,0,6,6,6,6,6,6,6,6,6,6,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,6,6,6,6,6,6,6,0,0,0,0,6,6,6,6,6,6,6,6} - }; - room.RoomArray = table; - room.AddTextBox("{BIG} CROSSROADS", - 3*28, 4*32, 500); - room.AddTextBox("(Turn the Remote Control on.)", - 4*28, 5*32, 250); - room.AddTextBox("NODES", - 2*28, 32+16, 300); - room.AddTextBox("FLIPFLOPS", - 15*28, 32+16, 300); - room.AddTextBox("LOGIC GATES", - 16*28, 6*32, 100); - room.AddTextBox("When you have learned all about the Toolkit, go this way.", - 4*28, 9*32, 300); - room.AddArrow(3*28, 0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(17*28, 0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(559, 6*32, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(10*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 14, Paths to Nodes & FlipFlops - Room room = (Room) rooms.elementAt(14); - int[][] table = { - {6,0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,0,0,0,6}, - {0,0,0,0,0,6,6,6,6,6,6,6,6,6,6,0,0,0,0,6}, - {0,0,0,0,0,6,6,6,6,6,6,6,6,6,6,0,0,0,0,6}, - {0,0,0,0,0,6,6,6,6,6,6,6,6,6,6,0,0,0,0,6}, - {6,0,0,0,0,6,6,6,6,6,6,6,6,6,6,0,0,0,0,6}, - {6,0,0,0,0,6,6,6,6,6,6,6,6,6,6,0,0,0,0,6}, - {6,0,0,0,0,6,6,6,6,6,6,6,6,6,6,0,0,0,0,6}, - {6,0,0,0,0,6,6,6,6,6,6,6,6,6,6,0,0,0,0,6} - }; - room.RoomArray = table; - room.AddArrow(3*28, 0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(0, 6*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 15, Nodes Intro - Room room = (Room) rooms.elementAt(15); - int[][] table = { - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5} - }; - room.RoomArray = table; - room.AddTextBox("Nodes make electricity branch to two or three places.", - 2*28, 2*32, 350); - room.AddTextBox("Take a node from the Toolkit and carry it to the next room.", - 2*28, 9*32, 500); - room.AddArrow(0, 6*32+16, Arrow.DIR_LEFT, 28, Color.white); - items.addElement(new Node(13*28, 32+16, room, Node.TYPE_STRAIGHT)); - items.addElement(new Node(15*28, 32+16, room, Node.TYPE_RIGHT)); - items.addElement(new Node(17*28, 32+16, room, Node.TYPE_THREE)); - } - { // Room 16, Nodes Workshop - Room room = (Room) rooms.elementAt(16); - int[][] table = { - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5} - }; - room.RoomArray = table; - room.AddTextBox("Wire the INPUT (circle) of the node to the OUTPUT of the CONTACT sensor. Wire the node outputs to the thrusters.", - 2*28, 2*32, 275); - room.AddTextBox("Drop the blue key so that it touches the sensor. Electricity flows to both thrusters.", - 2*28, 9*32, 500); - items.addElement(new Key(11*28, 2*32, room, Color.white)); - items.addElement(new ContactSensor(11*28, 4*32, room, new Key(0,0,null, Color.white))); - items.addElement(new Thruster(15*28, 32+16, room, Port.ROT_UP, Color.white)); - items.addElement(new Thruster(16*28, 3*32, room, Port.ROT_RIGHT, Color.white)); - } - { // Room 17, Flipflop intro - Room room = (Room) rooms.elementAt(17); - int[][] table = { - {5,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5} - }; - room.RoomArray = table; - room.AddTextBox("A flipflop is like a light switch. It 'flips' electricity from one output to the other.", - 5*28, 2*32, 300); - room.AddTextBox("Take a flipflop from the Toolkit. Put the hot cursor on one input at a time to make the electricity 'flip' or 'flop'.", - 5*28, 6*32, 300); - items.addElement(new FlipFlop(17*28+7, 32+16, room)); - room.AddArrow(3*28, 0, Arrow.DIR_UP, 28, Color.white); - } - { // Room 18, Flipflop workshop - Room room = (Room) rooms.elementAt(18); - int[][] table = { - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5} - }; - room.RoomArray = table; - room.AddTextBox("Go inside the robot and wire the orange OUTPUT of the flipflop to the thruster on the right. Sit on the eye to see what you did.", - 5*28, 8*32, 420); - BlueRobot robot = new BlueRobot(9*28,4*32,room); - items.addElement(robot); - FlipFlop ff = new FlipFlop(10*28, 5*32, robot.InternalRoom); - items.addElement(ff); - Wire wire = new Wire(ff.ports[0], robot.devices[7].ports[0]); - wire = new Wire(ff.ports[2], robot.devices[3].ports[0]); - wire = new Wire(robot.devices[5].ports[0], ff.ports[1]); - robot.thrusterPower=true; - } - { // Room 19, Crossroads II - Room room = (Room) rooms.elementAt(19); - int[][] table = { - {6,0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {6,0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6} - }; - room.RoomArray = table; - room.AddTextBox("Crossroads", - 2*28, 6*32+8, 500); - room.AddTextBox("NOT-gate", - 2*28, 32+16, 500); - room.AddTextBox("AND-gate", - 15*28, 2*32+16, 500); - room.AddTextBox("XOR-gate", - 15*28, 10*32, 500); - room.AddTextBox("OR-gate", - 2*28, 10*32+16, 500); - room.AddArrow(3*28, 0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(559, 2*32+16, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(3*28, 383, Arrow.DIR_DOWN, 28, Color.white); - room.AddArrow(0, 6*32, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 20, NOT gate intro - Room room = (Room) rooms.elementAt(20); - int[][] table = { - {5,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5} - }; - room.RoomArray = table; - room.AddTextBox("A NOT-gate inverts electricity flow. It turns on when its INPUT is NOT on.", - 5*28, 2*32, 300); - room.AddTextBox("Take a NOT-gate from the Toolkit and use the hot cursor to see how it works.", - 5*28, 6*32, 400); - items.addElement(new NOTGate(17*28+10, 32+12, room)); - room.AddArrow(3*28, 0, Arrow.DIR_UP, 28, Color.white); - } - { // Room 21, NOT gate workshop - Room room = (Room) rooms.elementAt(21); - int[][] table = { - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5} - }; - room.RoomArray = table; - room.AddTextBox("Wire the NOT-gate output to the Antenna INPUT.", - 5*28, 2*32, 400); - room.AddTextBox("The antenna beeps when the crystal is NOT touching the CONTACT sensor.", - 5*28, 8*32, 400); - items.addElement(new Crystal(3*28, 7*32, room, 100000)); - ContactSensor sensor = new ContactSensor(2*28, 6*32, room, new Crystal(0,0,null,0)); - items.addElement(sensor); - NOTGate ng = new NOTGate(4*28, 4*32, room); - items.addElement(ng); - items.addElement(new Antenna(2*28, 2*32, room, Color.white)); - Wire wire = new Wire(sensor.ports[0], ng.ports[0]); - } - { // Room 22, OR gate intro - Room room = (Room) rooms.elementAt(22); - int[][] table = { - {5,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,5} - }; - room.RoomArray = table; - room.AddTextBox("An OR-gate turns on when one OR the other INPUT is on, or both.", - 5*28, 2*32, 300); - room.AddTextBox("Take an OR-gate from the Toolkit and use the hot cursor to see how it works.", - 2*28, 8*32, 400); - items.addElement(new ORGate(17*28+10, 32+12, room)); - room.AddArrow(17*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 23, OR workshop - Room room = (Room) rooms.elementAt(23); - int[][] table = { - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5} - }; - room.RoomArray = table; - room.AddTextBox("Wire the OR-gate output to the Antenna INPUT.", - 5*28, 2*32, 400); - room.AddTextBox("The antenna beeps when the key is above OR left of the sensor.", - 5*28, 10*32, 400); - items.addElement(new Key(3*28, 7*32, room, Color.blue)); - DirectionalSensor sensor = new DirectionalSensor(8*28, 6*32, room, - new Key(0,0,null,Color.white)); - items.addElement(sensor); - ORGate og = new ORGate(4*28, 4*32, room); - items.addElement(og); - items.addElement(new Antenna(2*28, 2*32, room, Color.white)); - Wire wire = new Wire(sensor.ports[0], og.ports[1]); - wire = new Wire(sensor.ports[3], og.ports[0]); - } - { // Room 24, Paths to AND & XOR - Room room = (Room) rooms.elementAt(24); - int[][] table = { - {6,6,6,6,6,6,6,0,0,0,0,6,6,6,6,6,6,6,6,6}, - {0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,6,6,6,6}, - {0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,6,6,6,6}, - {0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,6,6,6,6}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {0,0,0,0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {0,0,0,0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {0,0,0,0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,6}, - {6,6,6,0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,6} - }; - room.RoomArray = table; - room.AddArrow(9*28, 0, Arrow.DIR_UP, 28, Color.white); - room.AddArrow(5*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 25, AND gate intro - Room room = (Room) rooms.elementAt(25); - int[][] table = { - {5,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,5,5,5,5,5,5,0,0,0,0,5,5,5,5,5,5,5,5,5} - }; - room.RoomArray = table; - room.AddTextBox("An AND-gate turns on when its left AND right INPUTS are on.", - 5*28, 2*32, 300); - room.AddTextBox("Take a AND-gate from the Toolkit and test it with the hot cursor.", - 5*28, 6*32, 400); - items.addElement(new ANDGate(17*28+10, 32+12, room)); - room.AddArrow(3*28, 0, Arrow.DIR_UP, 28, Color.white); - } - { // Room 26, AND gate workshop - Room room = (Room) rooms.elementAt(26); - int[][] table3 = { - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5} - }; - room.RoomArray = table3; - room.AddTextBox("Wire the AND-gate output to the Antenna INPUT.", - 5*28, 2*32, 400); - room.AddTextBox("The antenna beeps when the key is left AND up from this DIRECTIONAL sensor.", - 5*28, 9*32, 400); - items.addElement(new Key(3*28, 7*32, room, Color.blue)); - DirectionalSensor sensor = new DirectionalSensor(5*28, 6*32, room, - new Key(0,0,null,Color.white)); - items.addElement(sensor); - ANDGate ag = new ANDGate(4*28, 4*32, room); - items.addElement(ag); - items.addElement(new Antenna(2*28, 2*32, room, Color.white)); - Wire wire = new Wire(sensor.ports[0], ag.ports[1]); - wire = new Wire(sensor.ports[3], ag.ports[0]); - } - { // Room 27, XOR gate intro - Room room = (Room) rooms.elementAt(27); - int[][] table = { - {5,5,5,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,5} - }; - room.RoomArray = table; - room.AddTextBox("An EXCLUSIVE-OR- gate (XOR-gate) turns on when one OR the other INPUT is on, NOT both.", - 7*28, 2*32, 250); - room.AddTextBox("Take an XOR-gate from the Toolkit and test it with the hot cursor.", - 2*28, 9*32, 400); - items.addElement(new XORGate(17*28+10, 32+12, room)); - room.AddArrow(17*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 28, XOR workshop - Room room = (Room) rooms.elementAt(28); - int[][] table = { - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5}, - {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5} - }; - room.RoomArray = table; - room.AddTextBox("Wire the XOR-gate output to the Antenna INPUT.", - 5*28, 2*32, 400); - room.AddTextBox("The antenna beeps when either the key or the crystal is in the room, but not both.", - 5*28, 9*32, 400); - items.addElement(new Key(2*28, 9*32, room, Color.blue)); - items.addElement(new Crystal(2*28, 7*32, room, 100000)); - RoomSensor sensor1 = new RoomSensor(8*28, 6*32, room, new Key(0,0,null,Color.white)); - RoomSensor sensor2 = new RoomSensor(8*28, 7*32, room, new Crystal(0,0,null,0)); - sensor1.rotate(1); sensor1.rotate(1); - sensor2.rotate(1); sensor2.rotate(1); - items.addElement(sensor1); - items.addElement(sensor2); - XORGate xg = new XORGate(4*28, 4*32, room); - items.addElement(xg); - items.addElement(new Antenna(2*28, 2*32, room, Color.white)); - Wire wire = new Wire(sensor1.ports[0], xg.ports[1]); - wire = new Wire(sensor2.ports[0], xg.ports[0]); - } - { // Room 29, End - Room room = (Room) rooms.elementAt(29); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(8,0,11,0,0); - room.SetMaterial(19,10,0); - room.SetMaterial(4,7,7); - room.SetMaterial(4,9,8); - room.AddTextBox("Now you know what the parts in the Toolkit do. To find out how to make simple circuits inside robots, continue with Robot Circuits.", - 2*28, 4*32, 450); - room.AddTextBox("Learn about Robot Circuits", - 5*28, 8*32, 450); - room.AddTextBox("Return to the Main Menu", - 5*28, 10*32, 450); - } - { // Room 30, Shortcut to beginning - Room room = (Room) rooms.elementAt(30); - room.SetMaterialOutline(0,0,19,9,1); - room.SetMaterialOutline(0,11,19,11,1); - room.SetMaterial(0,10,0); - room.SetMaterial(19,10,0); - room.AddTextBox("{BIG} {000,255,000} SHORTCUT", - 172, 6*32, 400); - } - - int[] list0={29,30,1,2,3}; - LinkRoomsHorizontally(list0); - LinkRoomsUpDown(3,4); - LinkRoomsLeftRight(5,4); - LinkRoomsUpDown(5,6); - LinkRoomsLeftRight(6,7); - LinkRoomsLeftRight(7,8); - LinkRoomsLeftRight(8,9); - LinkRoomsUpDown(9,10); - LinkRoomsUpDown(10,11); - int[] list1={11,12,13,19,24}; - LinkRoomsHorizontally(list1); - int[] list2={18,17,14,13,29}; - LinkRoomsVertically(list2); - int[] list3={21,20,19,22,23}; - LinkRoomsVertically(list3); - int[] list4={26,25,24,27,28}; - LinkRoomsVertically(list4); - LinkRoomsLeftRight(16,15); - LinkRoomsLeftRight(15,14); - - - gameCursor = new LabCursor(17*28+14,7*32+16,(Room) rooms.elementAt(1)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - solderingPen = new SolderingPen(); - remote = new Remote(); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - player = gameCursor; - currentViewer = player; - - } +import java.awt.*; + +class ROTutD extends Level { + public ROTutD(RoomDisplay rd) { + super(rd); + + // Material 0, Blank + materials.addElement(new Material(true, false)); + // Material 1, LightBlue Wall + materials.addElement(new Material(new Color(192, 192, 255), false, true)); + // Material 2, Green Wall + materials.addElement(new Material(new Color(0, 255, 0), false, true)); + // Material 3, Orange Wall + materials.addElement(new Material(new Color(255, 128, 0), false, true)); + // Material 4, LightOrange Wall + materials.addElement(new Material(new Color(255, 224, 192), false, true)); + // Material 5, Blue Wall + materials.addElement(new Material(new Color(0, 0, 255), false, true)); + // Material 6, Dark Blue Wall + materials.addElement(new Material(new Color(0, 0, 128), false, true)); + // Material 7, Portal to next Tutorial + materials.addElement(new Portal("ROTutE.lvl", false, true)); + // Material 8, Portal to Main Menu + materials.addElement(new Portal("MainMenu.lvl", false, true)); + + for (int a = 0; a < 31; a++) { + rooms.addElement(new Room()); + } + + { // Room 0, Help Screen + Room room = rooms.elementAt(0); + room.SetMaterialOutline(0, 0, 19, 11, 2); + room.AddTextBox("SPECIAL KEYS", + 7 * 28, 2 * 32, 500); + room.AddTextBox("H", + 2 * 28, 4 * 32, 100); + room.AddTextBox("Make the Cursor \"hot\" with electricity or cold again. use it to test circuits.", + 3 * 28, 4 * 32, 450); + room.AddTextBox("T", + 2 * 28, 7 * 32, 400); + room.AddTextBox("Summon Toolkit to you room. Open/Close Toolkit in room.", + 3 * 28, 7 * 32, 450); + room.AddTextBox("To continue, press RETURN.", + 4 * 28, 10 * 32, 500); + } + { // Room 1, Title Screen + Room room = rooms.elementAt(1); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(19, 6, 19, 8, 0); + room.SetMaterial(0, 10, 0); + room.AddTextBox("{BIG} THE TOOLKIT", 4 * 28, 2 * 32, 500); + room.AddTextBox("With what you have learned so far, you can make robots do a lot of simple tasks. But to get through the higher levels of Robotropolis, you will need to make circuits with parts from the Toolkit.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("Notice that the cursor has changed. This cursor can be made \"hot\". You'll see how soon.", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 7 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 2, Freeze Electricity + Room room = rooms.elementAt(2); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(0, 6, 19, 8, 0); + room.AddTextBox("This circuit was made by connecting wires between the INPUTS and OUTPUTS of two parts from the Toolkit. Use the Remote Control to stop and start the flow of electricity in the circuit.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("The Remote Control starts and stops electricity both inside and outside robots.", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 7 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + Node node = new Node(10 * 28, 5 * 32, room, Node.TYPE_STRAIGHT); + NOTGate notgate = new NOTGate(15 * 28, 6 * 32, room); + items.addElement(node); + items.addElement(notgate); + Wire wire = new Wire(node.ports[0], notgate.ports[1]); + wire = new Wire(notgate.ports[0], node.ports[2]); + } + { // Room 3, Move parts + Room room = rooms.elementAt(3); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(0, 6, 0, 8, 0); + room.SetMaterialOutline(15, 11, 18, 11, 0); + room.AddTextBox("It's hard to see where the wires connect in this circuit, but you can fix that. Pick up one of the parts. When you move, the wires will \"stretch\" to follow the part.", + 2 * 28, 2 * 32, 450); + room.AddTextBox("However, the wire will break if you stretch it out of the room.", + 2 * 28, 9 * 32, 350); + room.AddArrow(17 * 28, 559, Arrow.DIR_DOWN, 28, Color.white); + Node node = new Node(10 * 28, 7 * 32, room, Node.TYPE_STRAIGHT); + NOTGate notgate = new NOTGate(15 * 28, 6 * 32, room); + items.addElement(node); + items.addElement(notgate); + Wire wire = new Wire(node.ports[0], notgate.ports[1]); + wire = new Wire(notgate.ports[0], node.ports[2]); + } + { // Room 4, Toolkit + Room room = rooms.elementAt(4); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(15, 0, 18, 0, 0); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.AddTextBox("This is the TOOLKIT. Inside are parts you need to wire circuits.", + 2 * 28, 2 * 32, 300); + room.AddTextBox("Take the Toolkit into the next room.", + 2 * 28, 5 * 32, 300); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + toolbox = new ToolBox(16 * 28, 9 * 32, room); + items.addElement(toolbox); + } + { // Room 5, Open & close + Room room = rooms.elementAt(5); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.SetMaterialOutline(1, 11, 3, 11, 0); + room.AddTextBox("You can open and close the Toolkit by pressing T. Try it a few times.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Leave the Toolkit here.", + 2 * 28, 4 * 32, 300); + room.AddTextBox("Drop Toolkit here.", + 2 * 28, 7 * 32, 200); + room.AddArrow(2 * 28 + 14, 383, Arrow.DIR_DOWN, 28, Color.white); + room.AddArrow(7 * 28, 8 * 32, Arrow.DIR_RIGHT, 56, Color.white); + } + { // Room 6, Toolkit Sentry + Room room = rooms.elementAt(6); + room.RoomArray = new int[][]{ + {3, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {3, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 3}, + {3, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 0}, + {3, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 0}, + {3, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 0}, + {3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3}, + {3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 3}, + {3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 3}, + {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} + }; + room.AddTextBox("NO TOOLKITS ALLOWED!", + 2 * 28, 2 * 32, 150); + room.AddArrow(559, 6 * 32, Arrow.DIR_RIGHT, 28, Color.white); + items.add(new SentryT2(2 * 28, 2 * 32, room)); + } + { // Room 7, Summon + Room room = rooms.elementAt(7); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 4, 0, 7, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("If the Toolkit is nowhere in sight, you can summon it to you. (Think of it as sitting in your pocket wherever you go.)", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Press T to summon the Toolkit. Drop it and press T to open and close it.", + 2 * 28, 9 * 32, 400); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 8, Objects in Toolkit + Room room = rooms.elementAt(8); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 8, 19, 10, 0); + room.AddTextBox("You can take parts in and out of the Toolkit with the cursor.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("To take a part out, move on top of it and press the SPACEBAR. To put it back, drop it anywhere in the Toolkit.", + 2 * 28, 5 * 32, 500); + room.AddTextBox("Open Toolkit here.", + 3 * 28, 9 * 32, 100); + room.AddArrow(7 * 28, 10 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 9, Rotating Objects + Room room = rooms.elementAt(9); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterialOutline(15, 11, 18, 11, 0); + room.AddTextBox("You can rotate parts left and right by holding a part and pressing the [ and ] keys.", + 2 * 28, 2 * 32, 450); + room.AddTextBox("There is no limit to the number of parts you can take out of the Toolkit.", + 2 * 28, 5 * 32, 450); + room.AddTextBox("Open Toolkit here.", + 3 * 28, 9 * 32, 100); + room.AddArrow(7 * 28, 10 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(17 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 10, Hot Cursor + Room room = rooms.elementAt(10); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(15, 0, 18, 0, 0); + room.SetMaterialOutline(1, 11, 4, 11, 0); + room.AddTextBox("The cursor here is special. It can be made \"HOT\" with electricity to test parts.", + 4 * 28, 2 * 32, 300); + room.AddTextBox("Press H to make the cursor hot.", + 4 * 28, 5 * 32, 300); + room.AddTextBox("Pass the hot cursor over the antenna INPUT to turn the antenna on.", + 5 * 28, 7 * 32, 400); + room.AddTextBox("Press H again to make the cursor cold.", + 5 * 28, 10 * 32, 400); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + items.addElement(new Antenna(2 * 28, 2 * 32, room, Color.white)); + } + { // Room 11, Hot Cursor 2 + Room room = rooms.elementAt(11); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(1, 0, 4, 0, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("You can also use the hot cursor to move a robot. Just sit on the thruster input and the robot will move.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("The hot cursor is available for testing circuits in the Innovation Lab. Unfortunately you can't use it in Robotropolis. (It would spoil the game.)", + 2 * 28, 7 * 32, 400); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + OrangeRobot robot = new OrangeRobot(13 * 28, 4 * 32, room); + robot.thrusterPower = true; + items.addElement(robot); + } + { // Room 12, Crossroads intro + Room room = rooms.elementAt(12); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 8, 19, 10, 0); + room.AddTextBox("The next room is called the CROSSROADS. From it you can follow various paths to learn about different parts in the Toolkit.", + 2 * 28, 2 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 13, Crossroads + Room room = rooms.elementAt(13); + room.RoomArray = new int[][]{ + {6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6} + }; + room.AddTextBox("{BIG} CROSSROADS", + 3 * 28, 4 * 32, 500); + room.AddTextBox("(Turn the Remote Control on.)", + 4 * 28, 5 * 32, 250); + room.AddTextBox("NODES", + 2 * 28, 32 + 16, 300); + room.AddTextBox("FLIPFLOPS", + 15 * 28, 32 + 16, 300); + room.AddTextBox("LOGIC GATES", + 16 * 28, 6 * 32, 100); + room.AddTextBox("When you have learned all about the Toolkit, go this way.", + 4 * 28, 9 * 32, 300); + room.AddArrow(3 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(17 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(559, 6 * 32, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(10 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 14, Paths to Nodes & FlipFlops + Room room = rooms.elementAt(14); + room.RoomArray = new int[][]{ + {6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6} + }; + room.AddArrow(3 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(0, 6 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 15, Nodes Intro + Room room = rooms.elementAt(15); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5} + }; + room.AddTextBox("Nodes make electricity branch to two or three places.", + 2 * 28, 2 * 32, 350); + room.AddTextBox("Take a node from the Toolkit and carry it to the next room.", + 2 * 28, 9 * 32, 500); + room.AddArrow(0, 6 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + items.addElement(new Node(13 * 28, 32 + 16, room, Node.TYPE_STRAIGHT)); + items.addElement(new Node(15 * 28, 32 + 16, room, Node.TYPE_RIGHT)); + items.addElement(new Node(17 * 28, 32 + 16, room, Node.TYPE_THREE)); + } + { // Room 16, Nodes Workshop + Room room = rooms.elementAt(16); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5} + }; + room.AddTextBox("Wire the INPUT (circle) of the node to the OUTPUT of the CONTACT sensor. Wire the node outputs to the thrusters.", + 2 * 28, 2 * 32, 275); + room.AddTextBox("Drop the blue key so that it touches the sensor. Electricity flows to both thrusters.", + 2 * 28, 9 * 32, 500); + items.addElement(new Key(11 * 28, 2 * 32, room, Color.white)); + items.addElement(new ContactSensor(11 * 28, 4 * 32, room, new Key(0, 0, null, Color.white))); + items.addElement(new Thruster(15 * 28, 32 + 16, room, Port.ROT_UP, Color.white)); + items.addElement(new Thruster(16 * 28, 3 * 32, room, Port.ROT_RIGHT, Color.white)); + } + { // Room 17, Flipflop intro + Room room = rooms.elementAt(17); + room.RoomArray = new int[][]{ + {5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5} + }; + room.AddTextBox("A flipflop is like a light switch. It 'flips' electricity from one output to the other.", + 5 * 28, 2 * 32, 300); + room.AddTextBox("Take a flipflop from the Toolkit. Put the hot cursor on one input at a time to make the electricity 'flip' or 'flop'.", + 5 * 28, 6 * 32, 300); + items.addElement(new FlipFlop(17 * 28 + 7, 32 + 16, room)); + room.AddArrow(3 * 28, 0, Arrow.DIR_UP, 28, Color.white); + } + { // Room 18, Flipflop workshop + Room room = rooms.elementAt(18); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5} + }; + room.AddTextBox("Go inside the robot and wire the orange OUTPUT of the flipflop to the thruster on the right. Sit on the eye to see what you did.", + 5 * 28, 8 * 32, 420); + BlueRobot robot = new BlueRobot(9 * 28, 4 * 32, room); + items.addElement(robot); + FlipFlop ff = new FlipFlop(10 * 28, 5 * 32, robot.InternalRoom); + items.addElement(ff); + Wire wire = new Wire(ff.ports[0], robot.devices[7].ports[0]); + wire = new Wire(ff.ports[2], robot.devices[3].ports[0]); + wire = new Wire(robot.devices[5].ports[0], ff.ports[1]); + robot.thrusterPower = true; + } + { // Room 19, Crossroads II + Room room = rooms.elementAt(19); + room.RoomArray = new int[][]{ + {6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6} + }; + room.AddTextBox("Crossroads", + 2 * 28, 6 * 32 + 8, 500); + room.AddTextBox("NOT-gate", + 2 * 28, 32 + 16, 500); + room.AddTextBox("AND-gate", + 15 * 28, 2 * 32 + 16, 500); + room.AddTextBox("XOR-gate", + 15 * 28, 10 * 32, 500); + room.AddTextBox("OR-gate", + 2 * 28, 10 * 32 + 16, 500); + room.AddArrow(3 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(559, 2 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + room.AddArrow(0, 6 * 32, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 20, NOT gate intro + Room room = rooms.elementAt(20); + room.RoomArray = new int[][]{ + {5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5} + }; + room.AddTextBox("A NOT-gate inverts electricity flow. It turns on when its INPUT is NOT on.", + 5 * 28, 2 * 32, 300); + room.AddTextBox("Take a NOT-gate from the Toolkit and use the hot cursor to see how it works.", + 5 * 28, 6 * 32, 400); + items.addElement(new NOTGate(17 * 28 + 10, 32 + 12, room)); + room.AddArrow(3 * 28, 0, Arrow.DIR_UP, 28, Color.white); + } + { // Room 21, NOT gate workshop + Room room = rooms.elementAt(21); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5} + }; + room.AddTextBox("Wire the NOT-gate output to the Antenna INPUT.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("The antenna beeps when the crystal is NOT touching the CONTACT sensor.", + 5 * 28, 8 * 32, 400); + items.addElement(new Crystal(3 * 28, 7 * 32, room, 100000)); + ContactSensor sensor = new ContactSensor(2 * 28, 6 * 32, room, new Crystal(0, 0, null, 0)); + items.addElement(sensor); + NOTGate ng = new NOTGate(4 * 28, 4 * 32, room); + items.addElement(ng); + items.addElement(new Antenna(2 * 28, 2 * 32, room, Color.white)); + Wire wire = new Wire(sensor.ports[0], ng.ports[0]); + } + { // Room 22, OR gate intro + Room room = rooms.elementAt(22); + room.RoomArray = new int[][]{ + {5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5} + }; + room.AddTextBox("An OR-gate turns on when one OR the other INPUT is on, or both.", + 5 * 28, 2 * 32, 300); + room.AddTextBox("Take an OR-gate from the Toolkit and use the hot cursor to see how it works.", + 2 * 28, 8 * 32, 400); + items.addElement(new ORGate(17 * 28 + 10, 32 + 12, room)); + room.AddArrow(17 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 23, OR workshop + Room room = rooms.elementAt(23); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5} + }; + room.AddTextBox("Wire the OR-gate output to the Antenna INPUT.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("The antenna beeps when the key is above OR left of the sensor.", + 5 * 28, 10 * 32, 400); + items.addElement(new Key(3 * 28, 7 * 32, room, Color.blue)); + DirectionalSensor sensor = new DirectionalSensor(8 * 28, 6 * 32, room, + new Key(0, 0, null, Color.white)); + items.addElement(sensor); + ORGate og = new ORGate(4 * 28, 4 * 32, room); + items.addElement(og); + items.addElement(new Antenna(2 * 28, 2 * 32, room, Color.white)); + Wire wire = new Wire(sensor.ports[0], og.ports[1]); + wire = new Wire(sensor.ports[3], og.ports[0]); + } + { // Room 24, Paths to AND & XOR + Room room = rooms.elementAt(24); + room.RoomArray = new int[][]{ + {6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {6, 6, 6, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6} + }; + room.AddArrow(9 * 28, 0, Arrow.DIR_UP, 28, Color.white); + room.AddArrow(5 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 25, AND gate intro + Room room = rooms.elementAt(25); + room.RoomArray = new int[][]{ + {5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5} + }; + room.AddTextBox("An AND-gate turns on when its left AND right INPUTS are on.", + 5 * 28, 2 * 32, 300); + room.AddTextBox("Take a AND-gate from the Toolkit and test it with the hot cursor.", + 5 * 28, 6 * 32, 400); + items.addElement(new ANDGate(17 * 28 + 10, 32 + 12, room)); + room.AddArrow(3 * 28, 0, Arrow.DIR_UP, 28, Color.white); + } + { // Room 26, AND gate workshop + Room room = rooms.elementAt(26); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5} + }; + room.AddTextBox("Wire the AND-gate output to the Antenna INPUT.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("The antenna beeps when the key is left AND up from this DIRECTIONAL sensor.", + 5 * 28, 9 * 32, 400); + items.addElement(new Key(3 * 28, 7 * 32, room, Color.blue)); + DirectionalSensor sensor = new DirectionalSensor(5 * 28, 6 * 32, room, + new Key(0, 0, null, Color.white)); + items.addElement(sensor); + ANDGate ag = new ANDGate(4 * 28, 4 * 32, room); + items.addElement(ag); + items.addElement(new Antenna(2 * 28, 2 * 32, room, Color.white)); + Wire wire = new Wire(sensor.ports[0], ag.ports[1]); + wire = new Wire(sensor.ports[3], ag.ports[0]); + } + { // Room 27, XOR gate intro + Room room = rooms.elementAt(27); + room.RoomArray = new int[][]{ + {5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5} + }; + room.AddTextBox("An EXCLUSIVE-OR- gate (XOR-gate) turns on when one OR the other INPUT is on, NOT both.", + 7 * 28, 2 * 32, 250); + room.AddTextBox("Take an XOR-gate from the Toolkit and test it with the hot cursor.", + 2 * 28, 9 * 32, 400); + items.addElement(new XORGate(17 * 28 + 10, 32 + 12, room)); + room.AddArrow(17 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 28, XOR workshop + Room room = rooms.elementAt(28); + room.RoomArray = new int[][]{ + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}, + {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5} + }; + room.AddTextBox("Wire the XOR-gate output to the Antenna INPUT.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("The antenna beeps when either the key or the crystal is in the room, but not both.", + 5 * 28, 9 * 32, 400); + items.addElement(new Key(2 * 28, 9 * 32, room, Color.blue)); + items.addElement(new Crystal(2 * 28, 7 * 32, room, 100000)); + RoomSensor sensor1 = new RoomSensor(8 * 28, 6 * 32, room, new Key(0, 0, null, Color.white)); + RoomSensor sensor2 = new RoomSensor(8 * 28, 7 * 32, room, new Crystal(0, 0, null, 0)); + sensor1.rotate(1); + sensor1.rotate(1); + sensor2.rotate(1); + sensor2.rotate(1); + items.addElement(sensor1); + items.addElement(sensor2); + XORGate xg = new XORGate(4 * 28, 4 * 32, room); + items.addElement(xg); + items.addElement(new Antenna(2 * 28, 2 * 32, room, Color.white)); + Wire wire = new Wire(sensor1.ports[0], xg.ports[1]); + wire = new Wire(sensor2.ports[0], xg.ports[0]); + } + { // Room 29, End + Room room = rooms.elementAt(29); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(8, 0, 11, 0, 0); + room.SetMaterial(19, 10, 0); + room.SetMaterial(4, 7, 7); + room.SetMaterial(4, 9, 8); + room.AddTextBox("Now you know what the parts in the Toolkit do. To find out how to make simple circuits inside robots, continue with Robot Circuits.", + 2 * 28, 4 * 32, 450); + room.AddTextBox("Learn about Robot Circuits", + 5 * 28, 8 * 32, 450); + room.AddTextBox("Return to the Main Menu", + 5 * 28, 10 * 32, 450); + } + { // Room 30, Shortcut to beginning + Room room = rooms.elementAt(30); + room.SetMaterialOutline(0, 0, 19, 9, 1); + room.SetMaterialOutline(0, 11, 19, 11, 1); + room.SetMaterial(0, 10, 0); + room.SetMaterial(19, 10, 0); + room.AddTextBox("{BIG} {000,255,000} SHORTCUT", + 172, 6 * 32, 400); + } + + int[] list0 = {29, 30, 1, 2, 3}; + LinkRoomsHorizontally(list0); + LinkRoomsUpDown(3, 4); + LinkRoomsLeftRight(5, 4); + LinkRoomsUpDown(5, 6); + LinkRoomsLeftRight(6, 7); + LinkRoomsLeftRight(7, 8); + LinkRoomsLeftRight(8, 9); + LinkRoomsUpDown(9, 10); + LinkRoomsUpDown(10, 11); + int[] list1 = {11, 12, 13, 19, 24}; + LinkRoomsHorizontally(list1); + int[] list2 = {18, 17, 14, 13, 29}; + LinkRoomsVertically(list2); + int[] list3 = {21, 20, 19, 22, 23}; + LinkRoomsVertically(list3); + int[] list4 = {26, 25, 24, 27, 28}; + LinkRoomsVertically(list4); + LinkRoomsLeftRight(16, 15); + LinkRoomsLeftRight(15, 14); + + + gameCursor = new LabCursor(17 * 28 + 14, 7 * 32 + 16, rooms.elementAt(1)); + helpCam = new HelpCam(rooms.elementAt(0)); + solderingPen = new SolderingPen(); + remote = new Remote(); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + player = gameCursor; + currentViewer = player; + + } } diff --git a/src/com/droidquest/levels/ROTutE.java b/src/com/droidquest/levels/ROTutE.java index 2cfe4a2..5d30286 100644 --- a/src/com/droidquest/levels/ROTutE.java +++ b/src/com/droidquest/levels/ROTutE.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.Wire; @@ -13,343 +11,338 @@ import com.droidquest.decorations.Arrow; import com.droidquest.devices.DirectionalSensor; import com.droidquest.devices.FlipFlop; import com.droidquest.devices.RoomSensor; -import com.droidquest.items.BlueRobot; -import com.droidquest.items.Crystal; -import com.droidquest.items.Key; -import com.droidquest.items.Sentry; -import com.droidquest.items.ToolBox; -import com.droidquest.items.Triangle; -import com.droidquest.items.WhiteRobot; +import com.droidquest.items.*; import com.droidquest.materials.Material; import com.droidquest.materials.PanicButton; import com.droidquest.materials.Portal; -class ROTutE extends Level -{ -public ROTutE(RoomDisplay rd) - { - super(rd); - - // Material 0, Blank - materials.addElement(new Material(true, false)); - // Material 1, LightBlue Wall - materials.addElement(new Material(new Color(192,192,255),false, true)); - // Material 2, Green Wall - materials.addElement(new Material(new Color(0,255,0),false, true)); - // Material 3, Orange Wall - materials.addElement(new Material(new Color(255,128,0),false, true)); - // Material 4, LightOrange Wall - materials.addElement(new Material(new Color(255,224,192),false, true)); - // Material 5, Blue Wall - materials.addElement(new Material(new Color(0,0,255),false, true)); - // Material 6, Dark Blue Wall - materials.addElement(new Material(new Color(0,0,128),false, true)); - // Material 7, Portal to next Tutorial - materials.addElement(new Portal("ROTutF.lvl",false, true)); - // Material 8, Portal to Main Menu - materials.addElement(new Portal("MainMenu.lvl",false, true)); - // Material 9, Panic Button #1 - materials.addElement(new PanicButton(1)); - - for (int a=0; a<23; a++) - rooms.addElement(new Room()); - - { // Room 0, Help Screen - Room room = (Room) rooms.elementAt(0); - room.SetMaterialOutline(0,0,19,11,2); - room.AddTextBox("If your circuit doesn't work, check to see that the Remote Control and robot thruster switch is on, and the battery still has energy", - 2*28, 2*32, 500); - room.AddTextBox("To continue, press RETURN.", - 4*28, 10*32, 500); - } - { // Room 1, Title Screen - Room room = (Room) rooms.elementAt(1); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(19,8,19,10,0); - room.SetMaterial(0,10,0); - room.AddTextBox("{BIG} ROBOT CIRCUITS", 3*28, 2*32, 500); - room.AddTextBox("Here you will see how to make some useful circuits inside robots. The circuits will help you get through Robotropolis, or you can go to the Lab and create your own robot challenges.", - 2*28, 4*32, 500); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 2, Scanner - Room room = (Room) rooms.elementAt(2); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterialOutline(19,7,19,9,0); - room.AddTextBox("This robot bounces from side to side using a \"ping-pong\" circuit. It takes one flipflop to make this circuit.", - 2*28, 4*32, 500); - room.AddTextBox("Go inside and watch electricity flow to see how it works. (Use the eye to see out as you move.)", - 2*28, 6*32, 500); - room.AddTextBox("Take Scanner with you to learn how the ping-pong circuit works.", - 2*28, 10*32, 500); - room.AddArrow(559,8*32+16, Arrow.DIR_RIGHT, 28, Color.white); - BlueRobot robot = new BlueRobot(2*28,32+16,room); - items.addElement(robot); - robot.thrusterPower = true; - FlipFlop ff = new FlipFlop(9*28,5*32,robot.InternalRoom); - items.addElement(ff); - new Wire(ff.ports[0],robot.devices[7].ports[0]); - new Wire(ff.ports[1],robot.devices[5].ports[0]); - new Wire(ff.ports[2],robot.devices[3].ports[0]); - new Wire(ff.ports[3],robot.devices[1].ports[0]); - } - { // Room 3, Ping-Pong explained - Room room = (Room) rooms.elementAt(3); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,7,0,9,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("While the left side of the flipflop is on, electricity flows to the left thruster and Scanner moves right. When Scanner hits the right wall, the right bumper turns on, sending electricity to the right side of the flipflop.", - 2*28, 2*32, 500); - room.AddTextBox("(Put Scanner here.)", - 5*28, 7*32, 500); - room.AddTextBox("Now the right thruster turns on and Scanner ping-pongs to the left.", - 2*28, 10*32, 500); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 4, Disconnect FlipFlop - Room room = (Room) rooms.elementAt(4); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialOutline(0,8,19,10,0); - room.AddTextBox("Can yo make Scanner bounce up and down instead? (yo-yo circuit) First disconnect the flipflop. The fastest way to disconnect it is to pick it up and carry it outside Scanner. All the wires will break. Then bring it back inside the robot.", - 2*28, 2*32, 500); - room.AddTextBox("Take Scanner into the next room to see how to rewire it to bounce up and down.", - 2*28, 7*32, 500); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 5, Wire a Yo-Yo - Room room = (Room) rooms.elementAt(5); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialOutline(0,8,19,10,0); - room.AddTextBox("Connect a wire from the left OUTPUT of the flipflop to top thruster. Connect another wire from the left INPUT of the flipflop to the top bumper. Connect the rest of the flipflop to the bottom thruster and bumper.", - 2*28, 2*32, 450); - room.AddTextBox("You just changed a ping-pong circuit to a yo-yo circuit.", - 2*28, 7*32, 500); - room.AddArrow(559,9*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - } - { // Room 6, ping-pong & yo-yo - Room room = (Room) rooms.elementAt(6); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterialOutline(15,11,18,11,0); - room.AddTextBox("Can you make Scanner ping-pong and yo-yo at the same time? Take another flipflop from the toolkit.", - 2*28, 2*32, 500); - room.AddTextBox("Connect the left side of the flipflop to the left thruster and bumper, and the right side to the right thruster and bumper.", - 2*28, 6*32, 500); - room.AddArrow(17*28,383, Arrow.DIR_DOWN, 28, Color.white); - toolbox = new ToolBox(4*28, 10*32, room); - items.addElement(toolbox); - } - { // Room 7, Intro to Sentry problem - Room room = (Room) rooms.elementAt(7); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(15,0,18,0,0); - room.SetMaterialOutline(0,9,0,10,0); - room.SetMaterialOutline(19,4,19,6,0); - room.SetMaterialOutline(2,11,5,11,0); - room.AddTextBox("How would you make a robot get a crystal from a guarded room like the one next door, bring it back, and drop it? (This is important in Robotropolis.)", - 2*28, 2*32, 350); - room.AddTextBox("One way to do this is with the parts in this next room.", - 2*28, 6*32+16, 350); - room.AddTextBox("Go and get the parts and put them inside the robot, and take them with you.", - 6*28, 9*32, 400); - room.AddTextBox("Look!", - 1*28, 10*32, 500); - room.AddArrow(4*28,383, Arrow.DIR_DOWN, 28, Color.white); - room.AddArrow(0,10*32, Arrow.DIR_LEFT, 28, Color.white); - room.AddArrow(15*28,7*32, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 8, Sample Sentry - Room room = (Room) rooms.elementAt(8); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialOutline(14,0,14,3,3); - room.SetMaterialOutline(14,7,14,11,3); - room.SetMaterialOutline(17,8,19,11,3); - room.SetMaterialOutline(19,9,19,10,0); - room.AddTextBox("Blue Sentries won't let you ride past in- side a robot.", - 4*28, 3*32, 200); - items.addElement(new Crystal(6*28,9*32,room,100000)); - int[] pace = {12*28,3*32,12*28,9*32}; - int[] program = {0,0,0,0,0,0}; - items.addElement(new Sentry(0,0,room,pace,program,true)); - } - { // Room 9, Parts - Room room = (Room) rooms.elementAt(9); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,4,0,6,0); - items.addElement(new WhiteRobot(6*28, 8*32, room)); - items.addElement(new DirectionalSensor(9*28, 2*32, room, - new Crystal(0,0,null,0))); - items.addElement(new Key(15*28, 5*32, room, Color.blue)); - items.addElement(new RoomSensor(14*28, 6*32, room, - new Key(0,0,null,Color.white))); - } - { // Room 10, Break problem to pieces - Room room = (Room) rooms.elementAt(10); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(1,0,5,0,0); - room.SetMaterialOutline(0,8,0,10,0); - room.AddTextBox("The best way to tackle this problem is to break it into parts. Obe part is making Checkers grab and drop objects at your command. The other part is making Checkers go into the room where the crystal is and come back to you. Let's tackle the grabber first. (Be sure the Remote Control is on and carry Checkers and all the parts inside it with you.)", - 6*28, 2*32, 350); - room.AddArrow(0,9*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 11, Grabbing - Room room = (Room) rooms.elementAt(11); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(19,8,19,10,0); - room.SetMaterialOutline(0,4,0,6,0); - room.AddTextBox("First, get a NOT-gate from the toolkit. Connect the OUTPUT of the NOT-gate to the INPUT of the grabber. Now Checkers will grab any object it touches.", - 2*28, 2*32, 500); - room.AddTextBox("Try it, by putting Checkers on top of the triangle. Now, how do you make Checkers let go? One way is to disconnect the NOT-gate. There is a better way, though.", - 2*28, 8*32, 450); - room.AddArrow(0,5*32+16, Arrow.DIR_LEFT, 28, Color.white); - items.addElement(new Triangle(12*28, 5*32, room, new Color(255,128,0))); - } - { // Room 12, Releasing - Room room = (Room) rooms.elementAt(12); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(19,4,19,6,0); - room.SetMaterialOutline(1,11,4,11,0); - room.AddTextBox("Use the key IN-SAME-ROOM sensor. Connect it to the NOT-gate. Take the key from inside Checkers and drop it in the room. Checkers will drop the triangle.", - 2*28, 2*32, 500); - room.AddTextBox("(Pick up the triangle to be sure.) Look inside Checkers. If the key is in the room, the sensor is ON, and the grabber is OFF. Put everything back in Checkers and bring Checkers with you.", - 5*28, 7*32, 400); - room.AddArrow(3*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 13, Moving - Room room = (Room) rooms.elementAt(13); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(1,0,4,11,0); - room.AddTextBox("Now you need to make Checkers go into the room and find the crystal. The robot must go up to the doorway, and then left and down to find the crystal. You have seen circuits that move both ways. Do you know what they are?", - 5*28, 2*32, 400); - room.AddTextBox("Go into the next room to find out.", - 5*28, 8*32, 400); - room.AddArrow(3*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 14, Yo-Yo - Room room = (Room) rooms.elementAt(14); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(1,0,4,0,0); - room.SetMaterialOutline(0,8,0,10,0); - room.AddTextBox("The yo-yo circuit (flipflop to top and bottom thrusters and bumpers) will make Checkers move up. A wire from the left output of the directional sensor to the thruster on the right will make Checkers go left until it is directly above or below the crystal.", - 5*28, 2*32, 350); - room.AddTextBox("Make the circuit now.", - 5*28, 10*32, 350); - room.AddArrow(0, 9*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 15, Get the Crystal - Room room = (Room) rooms.elementAt(15); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(0,8,19,10,0); - room.SetMaterialOutline(14,11,17,11,0); - room.AddTextBox("Send Checkers in to get the crystal.", - 5*28, 2*32, 350); - room.AddTextBox("Did it work? There is a problem. After Checkers grabs the crystal, the directional sensor turns off. Checkers stops moving left and continues to bounce up and down.", - 5*28, 4*32, 350); - room.AddTextBox("How can you make Checkers return?", - 5*28, 10*32, 350); - room.AddArrow(16*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 16, Crystal room - Room room = (Room) rooms.elementAt(16); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialOutline(14,0,14,3,3); - room.SetMaterialOutline(14,7,14,11,3); - room.SetMaterialOutline(19,8,19,10,0); - items.addElement(new Crystal(6*28,9*32,room,100000)); - } - { // Room 17, How to return - Room room = (Room) rooms.elementAt(17); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(14,0,17,0,0); - room.SetMaterialOutline(1,11,4,11,0); - room.AddTextBox("Look inside Checkers. The grabber OUTPUT is now on. To make Checkers come back after it has grabbed the crystal, you need to conenct a wire from the grabber OUTPUT to the thruster on the left. Now Checkers will move right and up and down when it grabs the crystal. Try it!", - 2*28, 2*32, 400); - room.AddArrow(3*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 18, Now the test - Room room = (Room) rooms.elementAt(18); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(1,0,4,0,0); - room.SetMaterialOutline(0,8,19,10,0); - room.AddTextBox("Now for the real thing! Try the robot circuit out in the room next door. (If Checkers gets stuck in there, press the PANIC BUTTON. The sentry will go off duty until you press the button again.", - 5*28, 2*32, 400); - room.AddTextBox("PUZZLE", - 2*28, 10*32, 350); - room.AddArrow(0, 10*32+16, Arrow.DIR_LEFT, 28, Color.white); - room.AddArrow(599, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 19, Sentry puzzle - Room room = (Room) rooms.elementAt(19); - room.SetMaterialOutline(0,0,19,11,3); - room.SetMaterialOutline(14,0,14,3,3); - room.SetMaterialOutline(14,7,14,11,3); - room.SetMaterialOutline(19,8,19,10,0); - room.SetMaterial(18,1,9); - room.AddTextBox("PANIC BUTTON", 100, 15*28, 2*32); - items.addElement(new Crystal(6*28,9*32,room,100000)); - int[] pace = {12*28,3*32,12*28,9*32}; - int[] program = {0,0,15*28-1,11*32,19*28,8*32}; - items.addElement(new Sentry(0,0,room,pace,program,true)); - } - { // Room 20, Congratulations - Room room = (Room) rooms.elementAt(20); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(0,8,19,10,0); - room.AddTextBox("Congratulations! You solved a complex problem by breaking it down into small parts and trying each part. This is a good strategy to use in the game. You can use the Innovation Lab to test your solutions before risking robots in Robotropolis.", - 2*28, 2*32, 500); - room.AddTextBox("With what you know now you can master the Subway of Robotropolis. Then learn about Robot Teamwork.", - 2*28, 7*32, 500); - room.AddArrow(0, 9*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 21, Portals - Room room = (Room) rooms.elementAt(21); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterial(19,10,0); - room.SetMaterial(4,2,7); - room.SetMaterial(4,5,8); - room.AddTextBox("Learn about Robot Teamwork", - 5*28, 3*32, 500); - room.AddTextBox("Return to the Main Menu", - 5*28, 6*32, 500); - } - { // Room 22, Shortcut to beginning - Room room = (Room) rooms.elementAt(22); - room.SetMaterialOutline(0,0,19,9,5); - room.SetMaterialOutline(0,11,19,11,5); - room.SetMaterial(0,10,0); - room.SetMaterial(19,10,0); - room.AddTextBox("{BIG} {000,255,000} SHORTCUT", - 172, 6*32, 400); - } +import java.awt.*; - - int[] list1 = {19,18,20,21,22,1,2,3,4,5,6}; - LinkRoomsHorizontally(list1); - LinkRoomsLeftRight(8,7); - LinkRoomsLeftRight(7,9); - LinkRoomsUpDown(6,7); - LinkRoomsUpDown(7,10); - LinkRoomsLeftRight(11,10); - LinkRoomsLeftRight(12,11); - LinkRoomsUpDown(12,13); - LinkRoomsUpDown(13,14); - LinkRoomsLeftRight(15,14); - LinkRoomsLeftRight(16,15); - LinkRoomsUpDown(15,17); - LinkRoomsUpDown(17,18); - - gameCursor = new LabCursor(16*28+14,9*32+16,(Room) rooms.elementAt(1)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - solderingPen = new SolderingPen(); - remote = new Remote(); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - player = gameCursor; - currentViewer = player; - } +class ROTutE extends Level { + public ROTutE(RoomDisplay rd) { + super(rd); + + // Material 0, Blank + materials.addElement(new Material(true, false)); + // Material 1, LightBlue Wall + materials.addElement(new Material(new Color(192, 192, 255), false, true)); + // Material 2, Green Wall + materials.addElement(new Material(new Color(0, 255, 0), false, true)); + // Material 3, Orange Wall + materials.addElement(new Material(new Color(255, 128, 0), false, true)); + // Material 4, LightOrange Wall + materials.addElement(new Material(new Color(255, 224, 192), false, true)); + // Material 5, Blue Wall + materials.addElement(new Material(new Color(0, 0, 255), false, true)); + // Material 6, Dark Blue Wall + materials.addElement(new Material(new Color(0, 0, 128), false, true)); + // Material 7, Portal to next Tutorial + materials.addElement(new Portal("ROTutF.lvl", false, true)); + // Material 8, Portal to Main Menu + materials.addElement(new Portal("MainMenu.lvl", false, true)); + // Material 9, Panic Button #1 + materials.addElement(new PanicButton(1)); + + for (int a = 0; a < 23; a++) { + rooms.addElement(new Room()); + } + + { // Room 0, Help Screen + Room room = rooms.elementAt(0); + room.SetMaterialOutline(0, 0, 19, 11, 2); + room.AddTextBox("If your circuit doesn't work, check to see that the Remote Control and robot thruster switch is on, and the battery still has energy", + 2 * 28, 2 * 32, 500); + room.AddTextBox("To continue, press RETURN.", + 4 * 28, 10 * 32, 500); + } + { // Room 1, Title Screen + Room room = rooms.elementAt(1); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.SetMaterial(0, 10, 0); + room.AddTextBox("{BIG} ROBOT CIRCUITS", 3 * 28, 2 * 32, 500); + room.AddTextBox("Here you will see how to make some useful circuits inside robots. The circuits will help you get through Robotropolis, or you can go to the Lab and create your own robot challenges.", + 2 * 28, 4 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 2, Scanner + Room room = rooms.elementAt(2); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterialOutline(19, 7, 19, 9, 0); + room.AddTextBox("This robot bounces from side to side using a \"ping-pong\" circuit. It takes one flipflop to make this circuit.", + 2 * 28, 4 * 32, 500); + room.AddTextBox("Go inside and watch electricity flow to see how it works. (Use the eye to see out as you move.)", + 2 * 28, 6 * 32, 500); + room.AddTextBox("Take Scanner with you to learn how the ping-pong circuit works.", + 2 * 28, 10 * 32, 500); + room.AddArrow(559, 8 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + BlueRobot robot = new BlueRobot(2 * 28, 32 + 16, room); + items.addElement(robot); + robot.thrusterPower = true; + FlipFlop ff = new FlipFlop(9 * 28, 5 * 32, robot.InternalRoom); + items.addElement(ff); + new Wire(ff.ports[0], robot.devices[7].ports[0]); + new Wire(ff.ports[1], robot.devices[5].ports[0]); + new Wire(ff.ports[2], robot.devices[3].ports[0]); + new Wire(ff.ports[3], robot.devices[1].ports[0]); + } + { // Room 3, Ping-Pong explained + Room room = rooms.elementAt(3); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 7, 0, 9, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("While the left side of the flipflop is on, electricity flows to the left thruster and Scanner moves right. When Scanner hits the right wall, the right bumper turns on, sending electricity to the right side of the flipflop.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("(Put Scanner here.)", + 5 * 28, 7 * 32, 500); + room.AddTextBox("Now the right thruster turns on and Scanner ping-pongs to the left.", + 2 * 28, 10 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 4, Disconnect FlipFlop + Room room = rooms.elementAt(4); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialOutline(0, 8, 19, 10, 0); + room.AddTextBox("Can yo make Scanner bounce up and down instead? (yo-yo circuit) First disconnect the flipflop. The fastest way to disconnect it is to pick it up and carry it outside Scanner. All the wires will break. Then bring it back inside the robot.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Take Scanner into the next room to see how to rewire it to bounce up and down.", + 2 * 28, 7 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 5, Wire a Yo-Yo + Room room = rooms.elementAt(5); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialOutline(0, 8, 19, 10, 0); + room.AddTextBox("Connect a wire from the left OUTPUT of the flipflop to top thruster. Connect another wire from the left INPUT of the flipflop to the top bumper. Connect the rest of the flipflop to the bottom thruster and bumper.", + 2 * 28, 2 * 32, 450); + room.AddTextBox("You just changed a ping-pong circuit to a yo-yo circuit.", + 2 * 28, 7 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 6, ping-pong & yo-yo + Room room = rooms.elementAt(6); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterialOutline(15, 11, 18, 11, 0); + room.AddTextBox("Can you make Scanner ping-pong and yo-yo at the same time? Take another flipflop from the toolkit.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Connect the left side of the flipflop to the left thruster and bumper, and the right side to the right thruster and bumper.", + 2 * 28, 6 * 32, 500); + room.AddArrow(17 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + toolbox = new ToolBox(4 * 28, 10 * 32, room); + items.addElement(toolbox); + } + { // Room 7, Intro to Sentry problem + Room room = rooms.elementAt(7); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(15, 0, 18, 0, 0); + room.SetMaterialOutline(0, 9, 0, 10, 0); + room.SetMaterialOutline(19, 4, 19, 6, 0); + room.SetMaterialOutline(2, 11, 5, 11, 0); + room.AddTextBox("How would you make a robot get a crystal from a guarded room like the one next door, bring it back, and drop it? (This is important in Robotropolis.)", + 2 * 28, 2 * 32, 350); + room.AddTextBox("One way to do this is with the parts in this next room.", + 2 * 28, 6 * 32 + 16, 350); + room.AddTextBox("Go and get the parts and put them inside the robot, and take them with you.", + 6 * 28, 9 * 32, 400); + room.AddTextBox("Look!", + 1 * 28, 10 * 32, 500); + room.AddArrow(4 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + room.AddArrow(0, 10 * 32, Arrow.DIR_LEFT, 28, Color.white); + room.AddArrow(15 * 28, 7 * 32, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 8, Sample Sentry + Room room = rooms.elementAt(8); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialOutline(14, 0, 14, 3, 3); + room.SetMaterialOutline(14, 7, 14, 11, 3); + room.SetMaterialOutline(17, 8, 19, 11, 3); + room.SetMaterialOutline(19, 9, 19, 10, 0); + room.AddTextBox("Blue Sentries won't let you ride past in- side a robot.", + 4 * 28, 3 * 32, 200); + items.addElement(new Crystal(6 * 28, 9 * 32, room, 100000)); + int[] pace = {12 * 28, 3 * 32, 12 * 28, 9 * 32}; + int[] program = {0, 0, 0, 0, 0, 0}; + items.addElement(new Sentry(0, 0, room, pace, program, true)); + } + { // Room 9, Parts + Room room = rooms.elementAt(9); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 4, 0, 6, 0); + items.addElement(new WhiteRobot(6 * 28, 8 * 32, room)); + items.addElement(new DirectionalSensor(9 * 28, 2 * 32, room, + new Crystal(0, 0, null, 0))); + items.addElement(new Key(15 * 28, 5 * 32, room, Color.blue)); + items.addElement(new RoomSensor(14 * 28, 6 * 32, room, + new Key(0, 0, null, Color.white))); + } + { // Room 10, Break problem to pieces + Room room = rooms.elementAt(10); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(1, 0, 5, 0, 0); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.AddTextBox("The best way to tackle this problem is to break it into parts. Obe part is making Checkers grab and drop objects at your command. The other part is making Checkers go into the room where the crystal is and come back to you. Let's tackle the grabber first. (Be sure the Remote Control is on and carry Checkers and all the parts inside it with you.)", + 6 * 28, 2 * 32, 350); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 11, Grabbing + Room room = rooms.elementAt(11); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.SetMaterialOutline(0, 4, 0, 6, 0); + room.AddTextBox("First, get a NOT-gate from the toolkit. Connect the OUTPUT of the NOT-gate to the INPUT of the grabber. Now Checkers will grab any object it touches.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Try it, by putting Checkers on top of the triangle. Now, how do you make Checkers let go? One way is to disconnect the NOT-gate. There is a better way, though.", + 2 * 28, 8 * 32, 450); + room.AddArrow(0, 5 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + items.addElement(new Triangle(12 * 28, 5 * 32, room, new Color(255, 128, 0))); + } + { // Room 12, Releasing + Room room = rooms.elementAt(12); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(19, 4, 19, 6, 0); + room.SetMaterialOutline(1, 11, 4, 11, 0); + room.AddTextBox("Use the key IN-SAME-ROOM sensor. Connect it to the NOT-gate. Take the key from inside Checkers and drop it in the room. Checkers will drop the triangle.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("(Pick up the triangle to be sure.) Look inside Checkers. If the key is in the room, the sensor is ON, and the grabber is OFF. Put everything back in Checkers and bring Checkers with you.", + 5 * 28, 7 * 32, 400); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 13, Moving + Room room = rooms.elementAt(13); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(1, 0, 4, 11, 0); + room.AddTextBox("Now you need to make Checkers go into the room and find the crystal. The robot must go up to the doorway, and then left and down to find the crystal. You have seen circuits that move both ways. Do you know what they are?", + 5 * 28, 2 * 32, 400); + room.AddTextBox("Go into the next room to find out.", + 5 * 28, 8 * 32, 400); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 14, Yo-Yo + Room room = rooms.elementAt(14); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(1, 0, 4, 0, 0); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.AddTextBox("The yo-yo circuit (flipflop to top and bottom thrusters and bumpers) will make Checkers move up. A wire from the left output of the directional sensor to the thruster on the right will make Checkers go left until it is directly above or below the crystal.", + 5 * 28, 2 * 32, 350); + room.AddTextBox("Make the circuit now.", + 5 * 28, 10 * 32, 350); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 15, Get the Crystal + Room room = rooms.elementAt(15); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(0, 8, 19, 10, 0); + room.SetMaterialOutline(14, 11, 17, 11, 0); + room.AddTextBox("Send Checkers in to get the crystal.", + 5 * 28, 2 * 32, 350); + room.AddTextBox("Did it work? There is a problem. After Checkers grabs the crystal, the directional sensor turns off. Checkers stops moving left and continues to bounce up and down.", + 5 * 28, 4 * 32, 350); + room.AddTextBox("How can you make Checkers return?", + 5 * 28, 10 * 32, 350); + room.AddArrow(16 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 16, Crystal room + Room room = rooms.elementAt(16); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialOutline(14, 0, 14, 3, 3); + room.SetMaterialOutline(14, 7, 14, 11, 3); + room.SetMaterialOutline(19, 8, 19, 10, 0); + items.addElement(new Crystal(6 * 28, 9 * 32, room, 100000)); + } + { // Room 17, How to return + Room room = rooms.elementAt(17); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(14, 0, 17, 0, 0); + room.SetMaterialOutline(1, 11, 4, 11, 0); + room.AddTextBox("Look inside Checkers. The grabber OUTPUT is now on. To make Checkers come back after it has grabbed the crystal, you need to conenct a wire from the grabber OUTPUT to the thruster on the left. Now Checkers will move right and up and down when it grabs the crystal. Try it!", + 2 * 28, 2 * 32, 400); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 18, Now the test + Room room = rooms.elementAt(18); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(1, 0, 4, 0, 0); + room.SetMaterialOutline(0, 8, 19, 10, 0); + room.AddTextBox("Now for the real thing! Try the robot circuit out in the room next door. (If Checkers gets stuck in there, press the PANIC BUTTON. The sentry will go off duty until you press the button again.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("PUZZLE", + 2 * 28, 10 * 32, 350); + room.AddArrow(0, 10 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + room.AddArrow(599, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 19, Sentry puzzle + Room room = rooms.elementAt(19); + room.SetMaterialOutline(0, 0, 19, 11, 3); + room.SetMaterialOutline(14, 0, 14, 3, 3); + room.SetMaterialOutline(14, 7, 14, 11, 3); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.SetMaterial(18, 1, 9); + room.AddTextBox("PANIC BUTTON", 100, 15 * 28, 2 * 32); + items.addElement(new Crystal(6 * 28, 9 * 32, room, 100000)); + int[] pace = {12 * 28, 3 * 32, 12 * 28, 9 * 32}; + int[] program = {0, 0, 15 * 28 - 1, 11 * 32, 19 * 28, 8 * 32}; + items.addElement(new Sentry(0, 0, room, pace, program, true)); + } + { // Room 20, Congratulations + Room room = rooms.elementAt(20); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(0, 8, 19, 10, 0); + room.AddTextBox("Congratulations! You solved a complex problem by breaking it down into small parts and trying each part. This is a good strategy to use in the game. You can use the Innovation Lab to test your solutions before risking robots in Robotropolis.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("With what you know now you can master the Subway of Robotropolis. Then learn about Robot Teamwork.", + 2 * 28, 7 * 32, 500); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 21, Portals + Room room = rooms.elementAt(21); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterial(19, 10, 0); + room.SetMaterial(4, 2, 7); + room.SetMaterial(4, 5, 8); + room.AddTextBox("Learn about Robot Teamwork", + 5 * 28, 3 * 32, 500); + room.AddTextBox("Return to the Main Menu", + 5 * 28, 6 * 32, 500); + } + { // Room 22, Shortcut to beginning + Room room = rooms.elementAt(22); + room.SetMaterialOutline(0, 0, 19, 9, 5); + room.SetMaterialOutline(0, 11, 19, 11, 5); + room.SetMaterial(0, 10, 0); + room.SetMaterial(19, 10, 0); + room.AddTextBox("{BIG} {000,255,000} SHORTCUT", + 172, 6 * 32, 400); + } + + + int[] list1 = {19, 18, 20, 21, 22, 1, 2, 3, 4, 5, 6}; + LinkRoomsHorizontally(list1); + LinkRoomsLeftRight(8, 7); + LinkRoomsLeftRight(7, 9); + LinkRoomsUpDown(6, 7); + LinkRoomsUpDown(7, 10); + LinkRoomsLeftRight(11, 10); + LinkRoomsLeftRight(12, 11); + LinkRoomsUpDown(12, 13); + LinkRoomsUpDown(13, 14); + LinkRoomsLeftRight(15, 14); + LinkRoomsLeftRight(16, 15); + LinkRoomsUpDown(15, 17); + LinkRoomsUpDown(17, 18); + + gameCursor = new LabCursor(16 * 28 + 14, 9 * 32 + 16, rooms.elementAt(1)); + helpCam = new HelpCam(rooms.elementAt(0)); + solderingPen = new SolderingPen(); + remote = new Remote(); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + player = gameCursor; + currentViewer = player; + } } \ No newline at end of file diff --git a/src/com/droidquest/levels/ROTutF.java b/src/com/droidquest/levels/ROTutF.java index 57e16f6..bc3812b 100644 --- a/src/com/droidquest/levels/ROTutF.java +++ b/src/com/droidquest/levels/ROTutF.java @@ -1,7 +1,5 @@ package com.droidquest.levels; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.RoomDisplay; import com.droidquest.avatars.HelpCam; @@ -9,371 +7,368 @@ import com.droidquest.avatars.LabCursor; import com.droidquest.avatars.Remote; import com.droidquest.avatars.SolderingPen; import com.droidquest.decorations.Arrow; -import com.droidquest.items.Crystal; -import com.droidquest.items.OrangeRobot; -import com.droidquest.items.Sentry; -import com.droidquest.items.ToolBox; -import com.droidquest.items.WhiteRobot; +import com.droidquest.items.*; import com.droidquest.materials.Material; import com.droidquest.materials.PanicButton; import com.droidquest.materials.Portal; import com.droidquest.materials.Switch; -class ROTutF extends Level -{ -public ROTutF(RoomDisplay rd) - { - super(rd); - - // Material 0, Blank - materials.addElement(new Material(true, false)); - // Material 1, LightBlue Wall - materials.addElement(new Material(new Color(192,192,255),false, true)); - // Material 2, Green Wall - materials.addElement(new Material(new Color(0,255,0),false, true)); - // Material 3, Orange Wall - materials.addElement(new Material(new Color(255,128,0),false, true)); - // Material 4, LightOrange Wall - materials.addElement(new Material(new Color(255,224,192),false, true)); - // Material 5, Blue Wall - materials.addElement(new Material(new Color(0,0,255),false, true)); - // Material 6, Dark Blue Wall - materials.addElement(new Material(new Color(0,0,128),false, true)); - // Material 7, Switch - int[][] matprogram = { - {Switch.WAIT4CONTACT}, - {Switch.SETVALUEHIGH}, - {Switch.REPLACE, 11,1,0, 11,7,5}, - {Switch.REPLACE, 11,2,0, 11,8,5}, - {Switch.REPLACE, 11,3,0, 11,9,5}, - {Switch.WAIT4REMOVAL}, - {Switch.REPLACE, 11,3,5, 11,9,0}, - {Switch.REPLACE, 11,2,5, 11,8,0}, - {Switch.REPLACE, 11,1,5, 11,7,0}, - {Switch.SETVALUELOW} - }; - materials.addElement(new Switch(Switch.ROT_UP, matprogram)); - // Material 8, Switch, another - materials.addElement(new Switch(Switch.ROT_UP, matprogram)); - // Material 9, Portal to next Tutorial - materials.addElement(new Portal("ROTut3.lvl",false, true)); - // Material 10, Portal to Main Menu - materials.addElement(new Portal("MainMenu.lvl",false, true)); - // Material 11, Panic Button #1 - materials.addElement(new PanicButton(1)); - // Material 12, Panic Button #2 - materials.addElement(new PanicButton(2)); - - for (int a=0; a<22; a++) - rooms.addElement(new Room()); - - { // Room 0, Help Screen - Room room = (Room) rooms.elementAt(0); - room.SetMaterialOutline(0,0,19,11,2); - room.AddTextBox("If your circuit doesn't work, check the state of the flipflops. If the robot doesn't go at all, check the Remote Control, thruster switch, and battery.", - 2*28, 2*32, 450); - room.AddTextBox("To continue, press RETURN.", - 4*28, 10*32, 500); - } - { // Room 1, Title Screen - Room room = (Room) rooms.elementAt(1); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(19,7,19,9,0); - room.SetMaterial(0,10,0); - room.AddTextBox("{BIG} ROBOT TEAMWORK", 3*28, 2*32, 500); - room.AddTextBox("Some of the challenges you'll encounter in Robotropolis need robot teamwork. Here you'll see how to use two robots to solve puzzles.", - 2*28, 4*32, 500); - room.AddArrow(559,8*32+16, Arrow.DIR_RIGHT, 28, Color.white) ; - toolbox = new ToolBox(3*28, 7*32, room); - items.addElement(toolbox); - } - { // Room 2, Sparky & Checkers - Room room = (Room) rooms.elementAt(2); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(0,7,0,9,0); - room.SetMaterialOutline(19,8,19,10,0); - room.SetMaterialOutline(13,11,16,11,0); - room.AddTextBox("To solve the puzzle next door, you need two robots. One robot must push the button that opens the door to the crystal. The other must get the crystal.", - 2*28, 2*32, 500); - room.AddTextBox("This sentry won't let you ride past inside a robot.", - 2*28, 5*32, 500); - room.AddTextBox("(Use the PANIC BUTTON if your robot gets stuck.)", - 2*28, 7*32, 500); - room.AddTextBox("If you want help, try the following solution.", - 2*28, 10*32, 300); - room.AddTextBox("PUZZLE", - 17*28, 10*32, 500); - room.AddArrow(559,10*32+16, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(15*28, 383, Arrow.DIR_DOWN, 28, Color.white); - items.addElement(new OrangeRobot(11*28, 8*32, room)); - items.addElement(new WhiteRobot(14*28, 8*32, room)); - } - { // Room 3, Puzzle - Room room = (Room) rooms.elementAt(3); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(11,0,19,4,5); - room.SetMaterialOutline(11,0,11,6,5); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterial(18,5,7); - room.SetMaterial(1,1,11); - room.AddTextBox("PANIC BUTTON", - 2*28, 2*32, 150); - room.AddTextBox("DOOR", - 9*28, 3*32, 200); - int[] pace = {3*28,2*32, 3*28,9*32}; - int[] program = {4*28,0,20*28,12*32, 0,9*32}; - items.addElement(new Sentry(0,0,room,pace,program,true)); - items.addElement(new Crystal(17*28, 2*32, room, 100000)); - } - { // Room 4, Divide the tasks - Room room = (Room) rooms.elementAt(4); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(13,0,17,0,0); - room.SetMaterialOutline(15,11,18,11,0); - room.AddTextBox("The problem has two parts:", - 2*28, 2*32, 300); - room.AddTextBox("1. Push door button", - 2*28, 4*32, 300); - room.AddTextBox("2. Retrieve crystal", - 2*28, 5*32, 300); - room.AddTextBox("Use one robot for each task.", - 2*28, 7*32, 300); - room.AddTextBox("Put Checkers inside Sparky and take both robots with you.", - 2*28, 9*32, 300); - room.AddTextBox("SOLUTION", - 15*28+14, 11*32, 300); - room.AddArrow(17*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 5, Assigning tasks - Room room = (Room) rooms.elementAt(5); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(15,0,18,0,0); - room.SetMaterialOutline(19,4,19,6,0); - room.AddTextBox("Use Sparky to push the door button. You want Sparky to move right until it hits the right wall, and then up until it hits the top wall.", - 2*28, 2*32, 400); - room.AddTextBox("Sparky should stop there and stay on the button until Checkers has safely retrieved the crystal.", - 2*28, 6*32, 400); - room.AddArrow(559, 5*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 6, Sparky goes right - Room room = (Room) rooms.elementAt(6); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(0,4,0,6,0); - room.SetMaterialOutline(15,11,18,11,0); - room.AddTextBox("Use a flipflop and a node. Turn the Remote Control off before you start wiring.", - 2*28, 2*32, 500); - room.AddTextBox("To make Sparky go right until it hits a wall, connect the left thruster to the \"hot\" (on) side of the flipflop. Try it to see how it works!", - 2*28, 8*32, 400); - room.AddArrow(17*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 7, Sparky cont. - Room room = (Room) rooms.elementAt(7); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(15,0,18,11,0); - room.AddTextBox("Next you want Sparky to do two things when it hits the right wall. It should stop going right, and it should go up. Use a node.", - 2*28, 2*32, 400); - room.AddTextBox("Connect the node to the right bumper. The node will turn on when Sparky touches the wall on the right.", - 2*28, 6*32, 400); - room.AddTextBox("Where should you wire the node so Sparky will stop going right and move up?", - 2*28, 9*32, 400); - room.AddArrow(17*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 8, Try Sparky right & up - Room room = (Room) rooms.elementAt(8); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(16,6,19,6,6); - room.SetMaterialOutline(15,0,18,0,0); - room.SetMaterialOutline(0,8,0,10,0); - room.AddTextBox("Connect one OUTPUT of the node to the flipflop INPUT that is now off. That will stop Sparky from moving right. Connect the other OUTPUT of the node to the bottom thruster. Sparky will move up while touching the right wall.", - 2*28, 2*32, 400); - room.AddTextBox("Try it now.", - 2*28, 9*32, 500); - room.AddArrow(0, 9*32+16, Arrow.DIR_LEFT, 28, Color.white); - } - { // Room 9, Sparky comes back - Room room = (Room) rooms.elementAt(9); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(19,8,19,10,0); - room.SetMaterialOutline(1,11,4,11,0); - room.AddTextBox("The next step is to make Sparky come back after Checkers gets the crystal. Let Checkers signal Sparky with the antenna when it's okay to return.", - 2*28, 2*32, 500); - room.AddTextBox("Use another flipflop. Connect Sparky's antenna OUTPUT to the \"cold\" (off) INPUT of the flipflop.", - 2*28, 5*32, 470); - room.AddArrow(3*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 10, Sparky goes left & down - Room room = (Room) rooms.elementAt(10); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(1,0,4,0,0); - room.SetMaterialOutline(19,3,19,5,0); - room.AddTextBox("For Sparky to return, it should move left and down. Use a node.", - 5*28, 2*32, 400); - room.AddTextBox("Connect the node INPUT to the cold OUTPUT of the flipflop that you just wired to the antenna. Connect the node OUTPUTS to the top and right thrusters.", - 2*28, 8*32, 500); - room.AddArrow(559, 4*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 11, Test antenna - Room room = (Room) rooms.elementAt(11); - room.SetMaterialOutline(0,0,19,11,1); - room.SetMaterialOutline(0,3,19,5,0); - room.AddTextBox("To test the new circuit, touch Sparky's antenna INPUT with the hot cursor. (Remote Control must be on.)", - 2*28, 2*32, 500); - room.AddTextBox("The antenna OUTPUT will turn on; the flipflop will flip, and both thrusters will turn on.", - 2*28, 5*32, 500); - room.AddTextBox("Use the hot cursor again to reset both flipflops (left sides off).", - 2*28, 8*32, 500); - room.AddTextBox("Turn Sparky's thruster switch off and put Spark inside of Checkers.", - 2*28, 10*32, 500); - room.AddArrow(559, 4*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 12, Checkers task - Room room = (Room) rooms.elementAt(12); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(0,3,0,5,0); - room.SetMaterialOutline(19,5,19,7,0); - room.AddTextBox("The second task is to use Checkers to get the crystal.", - 2*28, 2*32, 500); - room.AddTextBox("Grabbing the crystal is easy. Connect a NOT-gate to Checkers' grabber INPUT.", - 2*28, 10*32, 500); - room.AddArrow(559, 6*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 13, How to go right & left? - Room room = (Room) rooms.elementAt(13); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,5,19,7,0); - room.AddTextBox("Here is one way to move Checkers to the crystal. Connect a wire from the left thruster to the hot side of a flipflop. Checkers will move right.", - 2*28, 2*32, 500); - room.AddTextBox("Should you use the right bumper to flip the flipflop and make Checkers return? Or is there a better way?", - 2*28, 9*32, 500); - room.AddArrow(559, 6*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 14, Use the grabber output - Room room = (Room) rooms.elementAt(14); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,5,0,7,0); - room.SetMaterialOutline(19,6,19,8,0); - room.AddTextBox("You don't want to use the right bumper to stop Checkers, since the door may not be open when Checkers reaches it. You want Checkers to keep moving right until it grabs the crystal.", - 2*28, 2*32, 500); - room.AddTextBox("When Checkers gabs the crystal, the grabber OUTPUT will come on. Use that to flip the flipflop and make Checkers return.", - 2*28, 9*32, 500); - room.AddArrow(559, 7*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 15, Test grabber - Room room = (Room) rooms.elementAt(15); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,6,19,8,0); - room.AddTextBox("Connect a wire from the grabber OUTPUT to the cold flipflop input. Connect another wire from the cold flipflop OUTPUT to the right thruster. When Checkers grabs the crystal, the flipflop will flip and and Checkers will move left.", - 2*28, 2*32, 500); - room.AddTextBox("Test your circuit by letting Checkers grab this crystal. Then restore the original circuit.", - 2*28, 9*32, 500); - room.AddArrow(559, 7*32+16, Arrow.DIR_RIGHT, 28, Color.white); - items.addElement(new Crystal(9*28, 6*32, room, 100000)); - } - { // Room 16, Checkers signals Sparky - Room room = (Room) rooms.elementAt(16); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(0,6,0,9,0); - room.SetMaterialOutline(1,11,4,11,0); - room.AddTextBox("The last step is for Checkers to let Sparky know it's time to come back. Connect a wire from Checkers' left bumper to it's antenna. When Checkers comes back after grabbing the crystal it will hit the wall and beep.", - 2*28, 2*32, 500); - room.AddTextBox("You can test that if you want. Be sure to reset all the flipflops with the hot cursor before you continue (left sides off).", - 5*28, 8*32, 400); - room.AddArrow(3*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 17, Big test - Room room = (Room) rooms.elementAt(17); - room.SetMaterialOutline(0,0,19,11,6); - room.SetMaterialOutline(1,0,4,11,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("Now it's time for the real thing! Turn the Remote Control off and the thruster switches on. Put Sparky on the S and Checkers on the C next door. Turn the Remote Control on.", - 5*28, 2*32, 400); - room.AddTextBox("(Use the PANIC BUTTON to stop the sentry if you get stuck. Press it again to restart it.)", - 5*28, 7*32, 400); - room.AddTextBox("GOOD LUCK!", - 5*28, 10*32, 500); - room.AddTextBox("PUZZLE", - 17*28, 10*32, 500); - room.AddArrow(559,10*32+16, Arrow.DIR_RIGHT, 28, Color.white); - room.AddArrow(3*28, 383, Arrow.DIR_DOWN, 28, Color.white); - } - { // Room 18, Puzzle again - Room room = (Room) rooms.elementAt(18); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(11,0,19,4,5); - room.SetMaterialOutline(11,0,11,6,5); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterial(18,5,8); - room.SetMaterial(1,1,12); - room.AddTextBox("{BIG} C", - 3*28, 3*32, 500); - room.AddTextBox("{BIG} S", - 3*28, 10*32, 500); - room.AddTextBox("PANIC BUTTON", - 4*28, 2*32, 200); - int[] pace = {3*28,2*32, 3*28,9*32}; - int[] program = {4*28,0,20*28,12*32, 0,9*32}; - items.addElement(new Sentry(0,0,room,pace,program,true)); - items.addElement(new Crystal(17*28, 2*32, room, 100000)); - } - { // Room 19, End - Room room = (Room) rooms.elementAt(19); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(1,0,4,0,0); - room.SetMaterialOutline(19,8,19,10,0); - room.AddTextBox("You have learned some handy robot circuits. Now you are ready to move through the Town of Robotropolis. As you journey there, remember to solve the puzzles one step at a time, and use the Lab to test your ideas.", - 5*28, 2*32, 400); - room.AddTextBox("The levels above the Town are most easily solved with chips. Explore Chip design after you leave Town.", - 2*28, 9*32, 500); - room.AddArrow(559, 9*32+16, Arrow.DIR_RIGHT, 28, Color.white); - } - { // Room 20, Portals - Room room = (Room) rooms.elementAt(20); - room.SetMaterialOutline(0,0,19,11,5); - room.SetMaterialOutline(0,8,0,10,0); - room.SetMaterial(19,10,0); - room.SetMaterial(4,2,9); - room.SetMaterial(4,5,10); - room.AddTextBox("Learn about Chip Design.", - 5*28, 3*32, 500); - room.AddTextBox("Return to the Main Menu.", - 5*28, 6*32, 500); - } - { // Room 21, Shortcut - Room room = (Room) rooms.elementAt(21); - room.SetMaterialOutline(0,0,19,9,5); - room.SetMaterialOutline(0,11,19,11,5); - room.SetMaterial(0,10,0); - room.SetMaterial(19,10,0); - room.AddTextBox("{BIG} {000,255,000} SHORTCUT", - 172, 6*32, 400); - } +import java.awt.*; - int[] list1 = {19,20,21,1,2,3}; - LinkRoomsHorizontally(list1); - LinkRoomsUpDown(2,4); - LinkRoomsUpDown(4,5); - LinkRoomsLeftRight(5,6); - LinkRoomsUpDown(6,7); - LinkRoomsUpDown(7,8); - LinkRoomsLeftRight(9,8); - LinkRoomsUpDown(9,10); - int[] list2 = {10,11,12,13,14,15,16}; - LinkRoomsHorizontally(list2); - LinkRoomsUpDown(16,17); - LinkRoomsLeftRight(17,18); - LinkRoomsUpDown(17,19); - - gameCursor = new LabCursor(16*28+14,9*32+16,(Room) rooms.elementAt(1)); - helpCam = new HelpCam( (Room) rooms.elementAt(0)); - solderingPen = new SolderingPen(); - remote = new Remote(); - items.addElement(gameCursor); - items.addElement(helpCam); - items.addElement(solderingPen); - items.addElement(remote); - player = gameCursor; - currentViewer = player; - - } +class ROTutF extends Level { + public ROTutF(RoomDisplay rd) { + super(rd); + + // Material 0, Blank + materials.addElement(new Material(true, false)); + // Material 1, LightBlue Wall + materials.addElement(new Material(new Color(192, 192, 255), false, true)); + // Material 2, Green Wall + materials.addElement(new Material(new Color(0, 255, 0), false, true)); + // Material 3, Orange Wall + materials.addElement(new Material(new Color(255, 128, 0), false, true)); + // Material 4, LightOrange Wall + materials.addElement(new Material(new Color(255, 224, 192), false, true)); + // Material 5, Blue Wall + materials.addElement(new Material(new Color(0, 0, 255), false, true)); + // Material 6, Dark Blue Wall + materials.addElement(new Material(new Color(0, 0, 128), false, true)); + // Material 7, Switch + int[][] matprogram = { + {Switch.WAIT4CONTACT}, + {Switch.SETVALUEHIGH}, + {Switch.REPLACE, 11, 1, 0, 11, 7, 5}, + {Switch.REPLACE, 11, 2, 0, 11, 8, 5}, + {Switch.REPLACE, 11, 3, 0, 11, 9, 5}, + {Switch.WAIT4REMOVAL}, + {Switch.REPLACE, 11, 3, 5, 11, 9, 0}, + {Switch.REPLACE, 11, 2, 5, 11, 8, 0}, + {Switch.REPLACE, 11, 1, 5, 11, 7, 0}, + {Switch.SETVALUELOW} + }; + materials.addElement(new Switch(Switch.ROT_UP, matprogram)); + // Material 8, Switch, another + materials.addElement(new Switch(Switch.ROT_UP, matprogram)); + // Material 9, Portal to next Tutorial + materials.addElement(new Portal("ROTut3.lvl", false, true)); + // Material 10, Portal to Main Menu + materials.addElement(new Portal("MainMenu.lvl", false, true)); + // Material 11, Panic Button #1 + materials.addElement(new PanicButton(1)); + // Material 12, Panic Button #2 + materials.addElement(new PanicButton(2)); + + for (int a = 0; a < 22; a++) { + rooms.addElement(new Room()); + } + + { // Room 0, Help Screen + Room room = rooms.elementAt(0); + room.SetMaterialOutline(0, 0, 19, 11, 2); + room.AddTextBox("If your circuit doesn't work, check the state of the flipflops. If the robot doesn't go at all, check the Remote Control, thruster switch, and battery.", + 2 * 28, 2 * 32, 450); + room.AddTextBox("To continue, press RETURN.", + 4 * 28, 10 * 32, 500); + } + { // Room 1, Title Screen + Room room = rooms.elementAt(1); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(19, 7, 19, 9, 0); + room.SetMaterial(0, 10, 0); + room.AddTextBox("{BIG} ROBOT TEAMWORK", 3 * 28, 2 * 32, 500); + room.AddTextBox("Some of the challenges you'll encounter in Robotropolis need robot teamwork. Here you'll see how to use two robots to solve puzzles.", + 2 * 28, 4 * 32, 500); + room.AddArrow(559, 8 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + toolbox = new ToolBox(3 * 28, 7 * 32, room); + items.addElement(toolbox); + } + { // Room 2, Sparky & Checkers + Room room = rooms.elementAt(2); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(0, 7, 0, 9, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.SetMaterialOutline(13, 11, 16, 11, 0); + room.AddTextBox("To solve the puzzle next door, you need two robots. One robot must push the button that opens the door to the crystal. The other must get the crystal.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("This sentry won't let you ride past inside a robot.", + 2 * 28, 5 * 32, 500); + room.AddTextBox("(Use the PANIC BUTTON if your robot gets stuck.)", + 2 * 28, 7 * 32, 500); + room.AddTextBox("If you want help, try the following solution.", + 2 * 28, 10 * 32, 300); + room.AddTextBox("PUZZLE", + 17 * 28, 10 * 32, 500); + room.AddArrow(559, 10 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(15 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + items.addElement(new OrangeRobot(11 * 28, 8 * 32, room)); + items.addElement(new WhiteRobot(14 * 28, 8 * 32, room)); + } + { // Room 3, Puzzle + Room room = rooms.elementAt(3); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(11, 0, 19, 4, 5); + room.SetMaterialOutline(11, 0, 11, 6, 5); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterial(18, 5, 7); + room.SetMaterial(1, 1, 11); + room.AddTextBox("PANIC BUTTON", + 2 * 28, 2 * 32, 150); + room.AddTextBox("DOOR", + 9 * 28, 3 * 32, 200); + int[] pace = {3 * 28, 2 * 32, 3 * 28, 9 * 32}; + int[] program = {4 * 28, 0, 20 * 28, 12 * 32, 0, 9 * 32}; + items.addElement(new Sentry(0, 0, room, pace, program, true)); + items.addElement(new Crystal(17 * 28, 2 * 32, room, 100000)); + } + { // Room 4, Divide the tasks + Room room = rooms.elementAt(4); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(13, 0, 17, 0, 0); + room.SetMaterialOutline(15, 11, 18, 11, 0); + room.AddTextBox("The problem has two parts:", + 2 * 28, 2 * 32, 300); + room.AddTextBox("1. Push door button", + 2 * 28, 4 * 32, 300); + room.AddTextBox("2. Retrieve crystal", + 2 * 28, 5 * 32, 300); + room.AddTextBox("Use one robot for each task.", + 2 * 28, 7 * 32, 300); + room.AddTextBox("Put Checkers inside Sparky and take both robots with you.", + 2 * 28, 9 * 32, 300); + room.AddTextBox("SOLUTION", + 15 * 28 + 14, 11 * 32, 300); + room.AddArrow(17 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 5, Assigning tasks + Room room = rooms.elementAt(5); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(15, 0, 18, 0, 0); + room.SetMaterialOutline(19, 4, 19, 6, 0); + room.AddTextBox("Use Sparky to push the door button. You want Sparky to move right until it hits the right wall, and then up until it hits the top wall.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Sparky should stop there and stay on the button until Checkers has safely retrieved the crystal.", + 2 * 28, 6 * 32, 400); + room.AddArrow(559, 5 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 6, Sparky goes right + Room room = rooms.elementAt(6); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(0, 4, 0, 6, 0); + room.SetMaterialOutline(15, 11, 18, 11, 0); + room.AddTextBox("Use a flipflop and a node. Turn the Remote Control off before you start wiring.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("To make Sparky go right until it hits a wall, connect the left thruster to the \"hot\" (on) side of the flipflop. Try it to see how it works!", + 2 * 28, 8 * 32, 400); + room.AddArrow(17 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 7, Sparky cont. + Room room = rooms.elementAt(7); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(15, 0, 18, 11, 0); + room.AddTextBox("Next you want Sparky to do two things when it hits the right wall. It should stop going right, and it should go up. Use a node.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Connect the node to the right bumper. The node will turn on when Sparky touches the wall on the right.", + 2 * 28, 6 * 32, 400); + room.AddTextBox("Where should you wire the node so Sparky will stop going right and move up?", + 2 * 28, 9 * 32, 400); + room.AddArrow(17 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 8, Try Sparky right & up + Room room = rooms.elementAt(8); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(16, 6, 19, 6, 6); + room.SetMaterialOutline(15, 0, 18, 0, 0); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.AddTextBox("Connect one OUTPUT of the node to the flipflop INPUT that is now off. That will stop Sparky from moving right. Connect the other OUTPUT of the node to the bottom thruster. Sparky will move up while touching the right wall.", + 2 * 28, 2 * 32, 400); + room.AddTextBox("Try it now.", + 2 * 28, 9 * 32, 500); + room.AddArrow(0, 9 * 32 + 16, Arrow.DIR_LEFT, 28, Color.white); + } + { // Room 9, Sparky comes back + Room room = rooms.elementAt(9); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.SetMaterialOutline(1, 11, 4, 11, 0); + room.AddTextBox("The next step is to make Sparky come back after Checkers gets the crystal. Let Checkers signal Sparky with the antenna when it's okay to return.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Use another flipflop. Connect Sparky's antenna OUTPUT to the \"cold\" (off) INPUT of the flipflop.", + 2 * 28, 5 * 32, 470); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 10, Sparky goes left & down + Room room = rooms.elementAt(10); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(1, 0, 4, 0, 0); + room.SetMaterialOutline(19, 3, 19, 5, 0); + room.AddTextBox("For Sparky to return, it should move left and down. Use a node.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("Connect the node INPUT to the cold OUTPUT of the flipflop that you just wired to the antenna. Connect the node OUTPUTS to the top and right thrusters.", + 2 * 28, 8 * 32, 500); + room.AddArrow(559, 4 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 11, Test antenna + Room room = rooms.elementAt(11); + room.SetMaterialOutline(0, 0, 19, 11, 1); + room.SetMaterialOutline(0, 3, 19, 5, 0); + room.AddTextBox("To test the new circuit, touch Sparky's antenna INPUT with the hot cursor. (Remote Control must be on.)", + 2 * 28, 2 * 32, 500); + room.AddTextBox("The antenna OUTPUT will turn on; the flipflop will flip, and both thrusters will turn on.", + 2 * 28, 5 * 32, 500); + room.AddTextBox("Use the hot cursor again to reset both flipflops (left sides off).", + 2 * 28, 8 * 32, 500); + room.AddTextBox("Turn Sparky's thruster switch off and put Spark inside of Checkers.", + 2 * 28, 10 * 32, 500); + room.AddArrow(559, 4 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 12, Checkers task + Room room = rooms.elementAt(12); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(0, 3, 0, 5, 0); + room.SetMaterialOutline(19, 5, 19, 7, 0); + room.AddTextBox("The second task is to use Checkers to get the crystal.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Grabbing the crystal is easy. Connect a NOT-gate to Checkers' grabber INPUT.", + 2 * 28, 10 * 32, 500); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 13, How to go right & left? + Room room = rooms.elementAt(13); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 5, 19, 7, 0); + room.AddTextBox("Here is one way to move Checkers to the crystal. Connect a wire from the left thruster to the hot side of a flipflop. Checkers will move right.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Should you use the right bumper to flip the flipflop and make Checkers return? Or is there a better way?", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 6 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 14, Use the grabber output + Room room = rooms.elementAt(14); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 5, 0, 7, 0); + room.SetMaterialOutline(19, 6, 19, 8, 0); + room.AddTextBox("You don't want to use the right bumper to stop Checkers, since the door may not be open when Checkers reaches it. You want Checkers to keep moving right until it grabs the crystal.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("When Checkers gabs the crystal, the grabber OUTPUT will come on. Use that to flip the flipflop and make Checkers return.", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 7 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 15, Test grabber + Room room = rooms.elementAt(15); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 6, 19, 8, 0); + room.AddTextBox("Connect a wire from the grabber OUTPUT to the cold flipflop input. Connect another wire from the cold flipflop OUTPUT to the right thruster. When Checkers grabs the crystal, the flipflop will flip and and Checkers will move left.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("Test your circuit by letting Checkers grab this crystal. Then restore the original circuit.", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 7 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + items.addElement(new Crystal(9 * 28, 6 * 32, room, 100000)); + } + { // Room 16, Checkers signals Sparky + Room room = rooms.elementAt(16); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(0, 6, 0, 9, 0); + room.SetMaterialOutline(1, 11, 4, 11, 0); + room.AddTextBox("The last step is for Checkers to let Sparky know it's time to come back. Connect a wire from Checkers' left bumper to it's antenna. When Checkers comes back after grabbing the crystal it will hit the wall and beep.", + 2 * 28, 2 * 32, 500); + room.AddTextBox("You can test that if you want. Be sure to reset all the flipflops with the hot cursor before you continue (left sides off).", + 5 * 28, 8 * 32, 400); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 17, Big test + Room room = rooms.elementAt(17); + room.SetMaterialOutline(0, 0, 19, 11, 6); + room.SetMaterialOutline(1, 0, 4, 11, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("Now it's time for the real thing! Turn the Remote Control off and the thruster switches on. Put Sparky on the S and Checkers on the C next door. Turn the Remote Control on.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("(Use the PANIC BUTTON to stop the sentry if you get stuck. Press it again to restart it.)", + 5 * 28, 7 * 32, 400); + room.AddTextBox("GOOD LUCK!", + 5 * 28, 10 * 32, 500); + room.AddTextBox("PUZZLE", + 17 * 28, 10 * 32, 500); + room.AddArrow(559, 10 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + room.AddArrow(3 * 28, 383, Arrow.DIR_DOWN, 28, Color.white); + } + { // Room 18, Puzzle again + Room room = rooms.elementAt(18); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(11, 0, 19, 4, 5); + room.SetMaterialOutline(11, 0, 11, 6, 5); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterial(18, 5, 8); + room.SetMaterial(1, 1, 12); + room.AddTextBox("{BIG} C", + 3 * 28, 3 * 32, 500); + room.AddTextBox("{BIG} S", + 3 * 28, 10 * 32, 500); + room.AddTextBox("PANIC BUTTON", + 4 * 28, 2 * 32, 200); + int[] pace = {3 * 28, 2 * 32, 3 * 28, 9 * 32}; + int[] program = {4 * 28, 0, 20 * 28, 12 * 32, 0, 9 * 32}; + items.addElement(new Sentry(0, 0, room, pace, program, true)); + items.addElement(new Crystal(17 * 28, 2 * 32, room, 100000)); + } + { // Room 19, End + Room room = rooms.elementAt(19); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(1, 0, 4, 0, 0); + room.SetMaterialOutline(19, 8, 19, 10, 0); + room.AddTextBox("You have learned some handy robot circuits. Now you are ready to move through the Town of Robotropolis. As you journey there, remember to solve the puzzles one step at a time, and use the Lab to test your ideas.", + 5 * 28, 2 * 32, 400); + room.AddTextBox("The levels above the Town are most easily solved with chips. Explore Chip design after you leave Town.", + 2 * 28, 9 * 32, 500); + room.AddArrow(559, 9 * 32 + 16, Arrow.DIR_RIGHT, 28, Color.white); + } + { // Room 20, Portals + Room room = rooms.elementAt(20); + room.SetMaterialOutline(0, 0, 19, 11, 5); + room.SetMaterialOutline(0, 8, 0, 10, 0); + room.SetMaterial(19, 10, 0); + room.SetMaterial(4, 2, 9); + room.SetMaterial(4, 5, 10); + room.AddTextBox("Learn about Chip Design.", + 5 * 28, 3 * 32, 500); + room.AddTextBox("Return to the Main Menu.", + 5 * 28, 6 * 32, 500); + } + { // Room 21, Shortcut + Room room = rooms.elementAt(21); + room.SetMaterialOutline(0, 0, 19, 9, 5); + room.SetMaterialOutline(0, 11, 19, 11, 5); + room.SetMaterial(0, 10, 0); + room.SetMaterial(19, 10, 0); + room.AddTextBox("{BIG} {000,255,000} SHORTCUT", + 172, 6 * 32, 400); + } + + int[] list1 = {19, 20, 21, 1, 2, 3}; + LinkRoomsHorizontally(list1); + LinkRoomsUpDown(2, 4); + LinkRoomsUpDown(4, 5); + LinkRoomsLeftRight(5, 6); + LinkRoomsUpDown(6, 7); + LinkRoomsUpDown(7, 8); + LinkRoomsLeftRight(9, 8); + LinkRoomsUpDown(9, 10); + int[] list2 = {10, 11, 12, 13, 14, 15, 16}; + LinkRoomsHorizontally(list2); + LinkRoomsUpDown(16, 17); + LinkRoomsLeftRight(17, 18); + LinkRoomsUpDown(17, 19); + + gameCursor = new LabCursor(16 * 28 + 14, 9 * 32 + 16, rooms.elementAt(1)); + helpCam = new HelpCam(rooms.elementAt(0)); + solderingPen = new SolderingPen(); + remote = new Remote(); + items.addElement(gameCursor); + items.addElement(helpCam); + items.addElement(solderingPen); + items.addElement(remote); + player = gameCursor; + currentViewer = player; + + } } \ No newline at end of file diff --git a/src/com/droidquest/materials/AntiPlayer.java b/src/com/droidquest/materials/AntiPlayer.java index aec839b..0660556 100644 --- a/src/com/droidquest/materials/AntiPlayer.java +++ b/src/com/droidquest/materials/AntiPlayer.java @@ -1,40 +1,37 @@ package com.droidquest.materials; -import java.awt.Color; - import com.droidquest.Room; import com.droidquest.avatars.GameCursor; import com.droidquest.items.GenericRobot; import com.droidquest.items.Item; -public class AntiPlayer extends Material -{ - // Sends the Player (in or out of a robot) to the Main Office +import java.awt.*; - public AntiPlayer() - { - super(Color.black,true,false); - } +public class AntiPlayer extends Material { + // Sends the Player (in or out of a robot) to the Main Office - public void TouchedByItem(Item item) - { - boolean trigger = false; - if (item == level.player) - trigger = true; - else if (item instanceof GenericRobot) - { - GameCursor gc = (GameCursor) level.gameCursor; - if (gc.PlayerInRobot(null) == item) - trigger=true;; - } - - if (trigger) - { - level.player.room = (Room) level.rooms.elementAt(40); - level.player.x = 10*28; - level.player.y = 5*32; - level.currentViewer = level.player; - } - } + public AntiPlayer() { + super(Color.black, true, false); + } - } + public void TouchedByItem(Item item) { + boolean trigger = false; + if (item == level.player) { + trigger = true; + } + else if (item instanceof GenericRobot) { + GameCursor gc = (GameCursor) level.gameCursor; + if (gc.PlayerInRobot(null) == item) { + trigger = true; + } + } + + if (trigger) { + level.player.room = level.rooms.elementAt(40); + level.player.x = 10 * 28; + level.player.y = 5 * 32; + level.currentViewer = level.player; + } + } + +} diff --git a/src/com/droidquest/materials/AutoRunner.java b/src/com/droidquest/materials/AutoRunner.java index 33c5c33..501617b 100644 --- a/src/com/droidquest/materials/AutoRunner.java +++ b/src/com/droidquest/materials/AutoRunner.java @@ -4,74 +4,71 @@ import java.awt.Color; import com.droidquest.items.Item; -public class AutoRunner extends Material -{ -int direction; -public static final int UP =0; -public static final int RIGHTUP =1; -public static final int RIGHT =2; -public static final int RIGHTDOWN=3; -public static final int DOWN =4; -public static final int LEFTDOWN =5; -public static final int LEFT =6; -public static final int LEFTUP =7; -public static final int STOP =8; +public class AutoRunner extends Material { + private int direction; + public static final int UP = 0; + public static final int RIGHTUP = 1; + public static final int RIGHT = 2; + public static final int RIGHTDOWN = 3; + public static final int DOWN = 4; + public static final int LEFTDOWN = 5; + public static final int LEFT = 6; + public static final int LEFTUP = 7; + public static final int STOP = 8; -public AutoRunner(int d) - { - super(Color.black, true, false); - direction = d; - } + public AutoRunner(int d) { + super(Color.black, true, false); + direction = d; + } -public void TouchedByItem(Item item) - { - if (item == level.player) - switch (direction) - { - case UP: - level.player.autoX= level.player.x; - level.player.autoY= level.player.y-32; - level.player.automove=1; - break; - case RIGHTUP: - level.player.autoX= level.player.x+28; - level.player.autoY= level.player.y-32; - level.player.automove=1; - break; - case RIGHT: - level.player.autoX= level.player.x+28; - level.player.autoY= level.player.y; - level.player.automove=1; - break; - case RIGHTDOWN: - level.player.autoX= level.player.x+28; - level.player.autoY= level.player.y+32; - level.player.automove=1; - break; - case DOWN: - level.player.autoX= level.player.x; - level.player.autoY= level.player.y+32; - level.player.automove=1; - break; - case LEFTDOWN: - level.player.autoX= level.player.x-28; - level.player.autoY= level.player.y+32; - level.player.automove=1; - break; - case LEFT: - level.player.autoX= level.player.x-28; - level.player.autoY= level.player.y; - level.player.automove=1; - break; - case LEFTUP: - level.player.autoX= level.player.x-28; - level.player.autoY= level.player.y-32; - level.player.automove=1; - break; - case STOP: - level.player.automove=0; - break; - } - } + public void TouchedByItem(Item item) { + if (item == level.player) { + switch (direction) { + case UP: + level.player.autoX = level.player.x; + level.player.autoY = level.player.y - 32; + level.player.automove = 1; + break; + case RIGHTUP: + level.player.autoX = level.player.x + 28; + level.player.autoY = level.player.y - 32; + level.player.automove = 1; + break; + case RIGHT: + level.player.autoX = level.player.x + 28; + level.player.autoY = level.player.y; + level.player.automove = 1; + break; + case RIGHTDOWN: + level.player.autoX = level.player.x + 28; + level.player.autoY = level.player.y + 32; + level.player.automove = 1; + break; + case DOWN: + level.player.autoX = level.player.x; + level.player.autoY = level.player.y + 32; + level.player.automove = 1; + break; + case LEFTDOWN: + level.player.autoX = level.player.x - 28; + level.player.autoY = level.player.y + 32; + level.player.automove = 1; + break; + case LEFT: + level.player.autoX = level.player.x - 28; + level.player.autoY = level.player.y; + level.player.automove = 1; + break; + case LEFTUP: + level.player.autoX = level.player.x - 28; + level.player.autoY = level.player.y - 32; + level.player.automove = 1; + break; + case STOP: + level.player.automove = 0; + break; + } + } + } } diff --git a/src/com/droidquest/materials/BatteryIn.java b/src/com/droidquest/materials/BatteryIn.java index 18386e7..d7fb360 100644 --- a/src/com/droidquest/materials/BatteryIn.java +++ b/src/com/droidquest/materials/BatteryIn.java @@ -10,77 +10,69 @@ import com.droidquest.items.Crystal; import com.droidquest.items.Item; import com.droidquest.levels.Level; -public class BatteryIn extends Material -{ - // Charges the Battery when an Energy Crystal is passed over it. +public class BatteryIn extends Material { + // Charges the Battery when an Energy Crystal is passed over it. - public void BatteryIn() - { - passable = true; - GenerateIcons(); - } + public void BatteryIn() { + passable = true; + GenerateIcons(); + } - public transient Item robot; + public transient Item robot; - public void GenerateIcons() - { - BufferedImage bi = new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR); - icon = new ImageIcon(bi); - Graphics g; - try - { - g = bi.getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - - g.setColor(Color.white); - g.fillRect(0,0,28,32); - g.setColor(Color.black); - g.fillRect(12,4,4,24); - g.fillRect(8,8,12,16); - g.fillRect(4,10,20,12); - g.fillRect(0,14,28,4); - g.fillRect(0,8,4,2); - g.fillRect(0,22,4,2); - g.fillRect(24,8,4,2); - g.fillRect(24,22,4,2); - passable = true; - } + public void GenerateIcons() { + BufferedImage bi = new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR); + icon = new ImageIcon(bi); + Graphics g; + try { + g = bi.getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } - public void TouchedByItem(Item item) - { - if (item.charge > 0) - { - // Check to see if it's a pure Crystal, not a Black Crystal - if (item instanceof Crystal) - { - int empty = 100000 - robot.charge; - if (empty >= item.charge) - { - robot.charge += item.charge; - item.charge=0; - } - else - { - item.charge-=empty; - robot.charge=100000; - } - level.PlaySound(robot.InternalRoom, Level.DISCHARGESOUND); - } - } - } + g.setColor(Color.white); + g.fillRect(0, 0, 28, 32); + g.setColor(Color.black); + g.fillRect(12, 4, 4, 24); + g.fillRect(8, 8, 12, 16); + g.fillRect(4, 10, 20, 12); + g.fillRect(0, 14, 28, 4); + g.fillRect(0, 8, 4, 2); + g.fillRect(0, 22, 4, 2); + g.fillRect(24, 8, 4, 2); + g.fillRect(24, 22, 4, 2); + passable = true; + } - public boolean equals(Material mat) - { - if (super.equals(mat)) - if (robot != null) - if (robot == ((BatteryIn)mat).robot) - return true; - return false; - } + public void TouchedByItem(Item item) { + if (item.charge > 0) { + // Check to see if it's a pure Crystal, not a Black Crystal + if (item instanceof Crystal) { + int empty = 100000 - robot.charge; + if (empty >= item.charge) { + robot.charge += item.charge; + item.charge = 0; + } + else { + item.charge -= empty; + robot.charge = 100000; + } + level.PlaySound(robot.InternalRoom, Level.DISCHARGESOUND); + } + } + } - } \ No newline at end of file + public boolean equals(Material mat) { + if (super.equals(mat)) { + if (robot != null) { + if (robot == ((BatteryIn) mat).robot) { + return true; + } + } + } + return false; + } + +} \ No newline at end of file diff --git a/src/com/droidquest/materials/BatteryOut.java b/src/com/droidquest/materials/BatteryOut.java index fa28a05..bc37648 100644 --- a/src/com/droidquest/materials/BatteryOut.java +++ b/src/com/droidquest/materials/BatteryOut.java @@ -8,71 +8,64 @@ import javax.swing.ImageIcon; import com.droidquest.items.Item; -public class BatteryOut extends Material -{ - // Graph that shows the battery charge in a Generic Robot +public class BatteryOut extends Material { + // Graph that shows the battery charge in a Generic Robot - public BatteryOut() - { - passable = true; - GenerateIcons(); - } + public BatteryOut() { + passable = true; + GenerateIcons(); + } - public transient Item robot; + public transient Item robot; - public void GenerateIcons() - { - BufferedImage bi = new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR); - icon = new ImageIcon(bi); - Graphics g; - try - { - g = bi.getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - - g.setColor(Color.black); - g.fillRect(0,0,28,32); - g.setColor(Color.white); - g.fillRect(4,0,8,32); - g.fillRect(18,0,10,32); - g.fillRect(0,8,4,4); - g.fillRect(0,20,4,4); - } + public void GenerateIcons() { + BufferedImage bi = new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR); + icon = new ImageIcon(bi); + Graphics g; + try { + g = bi.getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } - public void Animate() - { - Graphics g; - try - { - g = icon.getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - g.setColor(Color.black); - g.fillRect(12,0,6,32); - g.setColor(new Color(255,128,0)); - if (robot!=null) - { - int fuel = (robot.charge+1564) / 3125; // 3125 = 100,000/32 - g.fillRect(12,32-fuel,6,fuel); - } - } + g.setColor(Color.black); + g.fillRect(0, 0, 28, 32); + g.setColor(Color.white); + g.fillRect(4, 0, 8, 32); + g.fillRect(18, 0, 10, 32); + g.fillRect(0, 8, 4, 4); + g.fillRect(0, 20, 4, 4); + } - public boolean equals(Material mat) - { - if (super.equals(mat)) - if (robot != null) - if (robot == ((BatteryOut)mat).robot) - return true; - return false; - } + public void Animate() { + Graphics g; + try { + g = icon.getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + g.setColor(Color.black); + g.fillRect(12, 0, 6, 32); + g.setColor(new Color(255, 128, 0)); + if (robot != null) { + int fuel = (robot.charge + 1564) / 3125; // 3125 = 100,000/32 + g.fillRect(12, 32 - fuel, 6, fuel); + } + } - } + public boolean equals(Material mat) { + if (super.equals(mat)) { + if (robot != null) { + if (robot == ((BatteryOut) mat).robot) { + return true; + } + } + } + return false; + } + +} diff --git a/src/com/droidquest/materials/BinaryLock.java b/src/com/droidquest/materials/BinaryLock.java index a06761f..d7bfdc4 100644 --- a/src/com/droidquest/materials/BinaryLock.java +++ b/src/com/droidquest/materials/BinaryLock.java @@ -11,213 +11,220 @@ import com.droidquest.Room; import com.droidquest.items.BinaryKey; import com.droidquest.items.Item; -public class BinaryLock extends Material -{ - // Binary shaped Generic Lock; Used to redefine materials in the local room. +public class BinaryLock extends Material { + // Binary shaped Generic Lock; Used to redefine materials in the local room. - int doorState=0; - transient BinaryKey latchKey = null; - transient Room room; - transient Room currentRoom; - static public int NARROW = -1; - static public int WIDE = -2; - static public int REMOVE = -3; - static public int RESET = -4; - static public int LEFT = -5; - static public int RIGHT = -6; - static public int UP = -7; - static public int DOWN = -8; - int[][] program; + private int doorState = 0; + private transient BinaryKey latchKey = null; + private transient Room room; + private transient Room currentRoom; + static public int NARROW = -1; + private static int WIDE = -2; + private static int REMOVE = -3; + private static int RESET = -4; + private static int LEFT = -5; + private static int RIGHT = -6; + private static int UP = -7; + private static int DOWN = -8; + int[][] program; - // program[][] is an array of arrays. Each array holds the behavior of a - // single value of doorState. - // - // A single array can hold one of the following: + // program[][] is an array of arrays. Each array holds the behavior of a + // single value of doorState. + // + // A single array can hold one of the following: // A single value of Lock.NARROW, Lock.WIDE, or Lock.REMOVE to define a pause // A single value of RESET, LEFT, RIGHT, UP, or DOWN to change rooms // A series of triplets (X,Y,M) with the XY position and the Materials // Index. - // - // Pause value can be one of the following: - // Lock.NARROW = Pause until the key is placed once more precisely into the lock. - // Lock.WIDE = Pause until the key is placed ANYWHERE into the lock - // Lock.REMOVE = Pause until the key is removed. - // - // Pause values automatically reset the current Room to the original value. - // - // Lock.RESET = Set current room to the original room value - // Lock.LEFT = Change the current room to the room's left room - // Lock.RIGHT = Same, but right - // Lock.UP = Same, but up - // Lock.DOWN = Same, but down - // - // The room is normally the key's rom when the key touches the lock, and - // the triplets change the materials within the current room. With these - // commands the current room can be changed so other rooms can be - // manipulated. - // - // Here's a sample program[][] - // - // int[][] = { + // + // Pause value can be one of the following: + // Lock.NARROW = Pause until the key is placed once more precisely into the lock. + // Lock.WIDE = Pause until the key is placed ANYWHERE into the lock + // Lock.REMOVE = Pause until the key is removed. + // + // Pause values automatically reset the current Room to the original value. + // + // Lock.RESET = Set current room to the original room value + // Lock.LEFT = Change the current room to the room's left room + // Lock.RIGHT = Same, but right + // Lock.UP = Same, but up + // Lock.DOWN = Same, but down + // + // The room is normally the key's rom when the key touches the lock, and + // the triplets change the materials within the current room. With these + // commands the current room can be changed so other rooms can be + // manipulated. + // + // Here's a sample program[][] + // + // int[][] = { // {Lock.NARROW}, // Wait for precise placement // {10,5,0, 11,5,0}, // Converts two spots to holes // {10,6,0, 11,6,0}, // Same, but lower // {Lock.NARROW}, // Wait again // {10,6,1, 11,6,1}, // Converts two spots to wall // {10,5,1, 11,5,1} // same, in reverse, go to pause. - // }; - // + // }; + // - public BinaryLock(Color lc, int[][] prg) - { - super(true, false); - color = lc; - program = prg; - GenerateIcons(); - } + public BinaryLock(Color lc, int[][] prg) { + super(true, false); + color = lc; + program = prg; + GenerateIcons(); + } - public void GenerateIcons() - { - BufferedImage bi = new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR); - Graphics g; - try - { - g = bi.getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); - return; - } - - g.setColor(color); - g.fillRect(0,0,28,32); - g.setColor(Color.black); - g.fillRect(16,2,4,8); - g.fillRect(16,12,4,2); - g.fillRect(12,14,4,4); - g.fillRect(20,14,4,4); - g.fillRect(16,18,4,2); - g.fillRect(16,22,4,8); - g.fillRect(24,4,4,4); - g.fillRect(24,24,4,4); - icon = new ImageIcon(bi); - } + public void GenerateIcons() { + BufferedImage bi = new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR); + Graphics g; + try { + g = bi.getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); + return; + } - public boolean equals(Material mat) - { - if (super.equals(mat)) - if (program == ((BinaryLock)mat).program) - return true; - return false; - } + g.setColor(color); + g.fillRect(0, 0, 28, 32); + g.setColor(Color.black); + g.fillRect(16, 2, 4, 8); + g.fillRect(16, 12, 4, 2); + g.fillRect(12, 14, 4, 4); + g.fillRect(20, 14, 4, 4); + g.fillRect(16, 18, 4, 2); + g.fillRect(16, 22, 4, 8); + g.fillRect(24, 4, 4, 4); + g.fillRect(24, 24, 4, 4); + icon = new ImageIcon(bi); + } - public void Animate() - { - if (doorState == program.length) - doorState = 0; - - if (latchKey==null) - return; - - - if (program[doorState].length > 1) - { - for (int a=0; a=10 && X <=14 - && Y<=4) - doorState++; - } - else if (program[doorState][0]==WIDE) - { - currentRoom = room; - doorState++; - } - } - - if (doorState == program.length) - doorState = 0; - - } + public void Animate() { + if (doorState == program.length) { + doorState = 0; + } - } + if (latchKey == null) { + return; + } + + + if (program[doorState].length > 1) { + for (int a = 0; a < program[doorState].length / 3; a++) { + currentRoom.SetMaterial(program[doorState][a * 3], + program[doorState][a * 3 + 1], + program[doorState][a * 3 + 2]); + } + doorState++; + } + else { + if (program[doorState][0] == REMOVE) { + currentRoom = room; + Dimension d = latchKey.GetXY(); + int bigXL = d.width / 28; + int bigXR = (d.width + latchKey.getWidth()) / 28; + int bigYT = d.height / 32; + int bigYB = (d.height + latchKey.getHeight()) / 32; + boolean flag = false; + if (room.MaterialArray[bigYT][bigXL] == this) { + flag = true; + } + if (room.MaterialArray[bigYT][bigXR] == this) { + flag = true; + } + if (room.MaterialArray[bigYB][bigXL] == this) { + flag = true; + } + if (room.MaterialArray[bigYB][bigXR] == this) { + flag = true; + } + if (!flag) { + doorState++; + } + } + else if (program[doorState][0] == RESET) { + currentRoom = room; + doorState++; + } + else if (program[doorState][0] == LEFT) { + currentRoom = currentRoom.leftRoom; + if (currentRoom == null) { + currentRoom = room; + } + doorState++; + } + else if (program[doorState][0] == RIGHT) { + currentRoom = currentRoom.rightRoom; + if (currentRoom == null) { + currentRoom = room; + } + doorState++; + } + else if (program[doorState][0] == UP) { + currentRoom = currentRoom.upRoom; + if (currentRoom == null) { + currentRoom = room; + } + doorState++; + } + else if (program[doorState][0] == DOWN) { + currentRoom = currentRoom.downRoom; + if (currentRoom == null) { + currentRoom = room; + } + doorState++; + } + } + + if (doorState == program.length) { + doorState = 0; + } + } + + public void TouchedByItem(Item item) { + if (item instanceof BinaryKey) { + latchKey = (BinaryKey) item; + room = latchKey.room; + } + + if (latchKey == null) { + return; + } + + if (latchKey != item) { + return; + } + + if (program[doorState].length == 1) { + if (program[doorState][0] == NARROW) { + currentRoom = room; + Dimension d = latchKey.GetXY(); + int X = d.width % 28; + int Y = d.height % 32; + if (X >= 10 && X <= 14 + && Y <= 4) { + doorState++; + } + } + else if (program[doorState][0] == WIDE) { + currentRoom = room; + doorState++; + } + } + + if (doorState == program.length) { + doorState = 0; + } + + } + +} diff --git a/src/com/droidquest/materials/BlueGridSwitch.java b/src/com/droidquest/materials/BlueGridSwitch.java index 1bf9e70..a12a80a 100644 --- a/src/com/droidquest/materials/BlueGridSwitch.java +++ b/src/com/droidquest/materials/BlueGridSwitch.java @@ -13,190 +13,173 @@ import com.droidquest.decorations.Graphix; import com.droidquest.decorations.TextBox; import com.droidquest.items.Item; -public class BlueGridSwitch extends Material -{ - // This object turns off the Blue grid (and HotWires), and opens the - // doorway to the room above. +public class BlueGridSwitch extends Material { + // This object turns off the Blue grid (and HotWires), and opens the + // doorway to the room above. - public ImageIcon[] images; - boolean value=false; - int animationState=0; - transient Room room=null; - Date timeout; - transient TextBox textbox = null; + private ImageIcon[] images; + private boolean value = false; + private int animationState = 0; + private transient Room room = null; + private Date timeout; + private transient TextBox textbox = null; - public BlueGridSwitch() - { - super(true, false); - } + public BlueGridSwitch() { + super(true, false); + } - public void GenerateIcons() - { - images = new ImageIcon[2]; - for (int a=0; a<2; a++) - { - images[a] = new ImageIcon(new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = images[a].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color c; - if (a==0) - c = Color.white; - else - c = new Color(255,128,0); - - g2.setColor(c); - g.fillRect(0,0,28,32); - g2.setColor(Color.black); - g.fillRect(4,14,20,4); - g.fillRect(8,12,12,8); - g.fillRect(12,8,4,16); - g2.setColor(c); - g.fillRect(12,14,4,4); - } - - icon = images[0]; - if (value) - icon = images[1]; - } + public void GenerateIcons() { + images = new ImageIcon[2]; + for (int a = 0; a < 2; a++) { + images[a] = new ImageIcon(new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = images[a].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + Color c; + if (a == 0) { + c = Color.white; + } + else { + c = new Color(255, 128, 0); + } - public void TouchedByItem(Item item) - { - if (animationState==0) - { - animationState = 1; - room = item.room; - timeout = new Date(new Date().getTime() + 20000); - textbox = (TextBox) item.room.textBoxes.elementAt(0); - } - } + g2.setColor(c); + g.fillRect(0, 0, 28, 32); + g2.setColor(Color.black); + g.fillRect(4, 14, 20, 4); + g.fillRect(8, 12, 12, 8); + g.fillRect(12, 8, 4, 16); + g2.setColor(c); + g.fillRect(12, 14, 4, 4); + } - public void Animate() - { - icon = images[0]; - if (value) - { - icon = images[1]; - Date now = new Date(); - long timer = timeout.getTime() - now.getTime(); - if (timer > 0) - { - long seconds = Math.abs(timer/1000) + 1; - if (seconds<10) - textbox.textString = "0" + seconds; - else - textbox.textString = "" + seconds; - } - else - { - textbox.textString = "00"; - animationState++; - } - - } - - switch (animationState) - { - case 1:value=true; - room.SetMaterial(2,0,0); - room.upRoom.SetMaterial(2,11,0); - for (int a=0; a 0) { + long seconds = Math.abs(timer / 1000) + 1; + if (seconds < 10) { + textbox.textString = "0" + seconds; + } + else { + textbox.textString = "" + seconds; + } + } + else { + textbox.textString = "00"; + animationState++; + } + + } + + switch (animationState) { + case 1: + value = true; + room.SetMaterial(2, 0, 0); + room.upRoom.SetMaterial(2, 11, 0); + for (int a = 0; a < level.materials.size(); a++) { + Material mat = level.materials.elementAt(a); + if (mat instanceof HotWires) { + HotWires hw = (HotWires) mat; + if (hw.wall == 0) { + hw.value = false; + } + } + } + for (int a = 0; a < 5; a++) { + Graphix gr = room.graphix.elementAt(a); + gr.filenames = new String[]{"whiteHorizontal.gif"}; + gr.GenerateIcons(); + } + for (int a = 0; a < 5; a++) { + Graphix gr = room.graphix.elementAt(a + 5); + gr.filenames = new String[]{"whiteVertical.gif"}; + gr.GenerateIcons(); + } + animationState++; + break; + case 2: + room.SetMaterial(3, 0, 0); + room.upRoom.SetMaterial(3, 11, 0); + animationState++; + break; + case 3: + room.SetMaterial(4, 0, 0); + room.upRoom.SetMaterial(4, 11, 0); + animationState++; + break; + case 4: + room.SetMaterial(5, 0, 0); + room.upRoom.SetMaterial(5, 11, 0); + animationState++; + break; + case 5: + break; + case 6: + room.SetMaterial(5, 0, 9); + room.upRoom.SetMaterial(5, 11, 9); + value = false; + for (int a = 0; a < level.materials.size(); a++) { + Material mat = level.materials.elementAt(a); + if (mat instanceof HotWires) { + HotWires hw = (HotWires) mat; + if (hw.wall == 0) { + hw.value = true; + } + } + } + for (int a = 0; a < 5; a++) { + Graphix gr = room.graphix.elementAt(a); + gr.filenames = new String[]{"blueHorizontal.gif"}; + gr.GenerateIcons(); + } + for (int a = 0; a < 5; a++) { + Graphix gr = room.graphix.elementAt(a + 5); + gr.filenames = new String[]{"blueVertical.gif"}; + gr.GenerateIcons(); + } + animationState++; + break; + case 7: + room.SetMaterial(4, 0, 9); + room.upRoom.SetMaterial(4, 11, 9); + animationState++; + break; + case 8: + room.SetMaterial(3, 0, 9); + room.upRoom.SetMaterial(3, 11, 9); + animationState++; + break; + case 9: + room.SetMaterial(2, 0, 9); + room.upRoom.SetMaterial(2, 11, 9); + animationState = 0; + break; + } + } + +} diff --git a/src/com/droidquest/materials/BlueWall.java b/src/com/droidquest/materials/BlueWall.java index 7e4d8d5..66fd6c6 100644 --- a/src/com/droidquest/materials/BlueWall.java +++ b/src/com/droidquest/materials/BlueWall.java @@ -4,18 +4,12 @@ import java.awt.Color; import com.droidquest.items.Item; -public class BlueWall extends Material -{ -public BlueWall() - { - super(new Color(0,0,255), false, true); - } +public class BlueWall extends Material { + public BlueWall() { + super(new Color(0, 0, 255), false, true); + } -public boolean Passable(Item item) - { - if (item.getClass().toString().endsWith("Sentry3")) - return true; - else - return passable; - } + public boolean Passable(Item item) { + return item.getClass().toString().endsWith("Sentry3") || passable; + } } diff --git a/src/com/droidquest/materials/CameraDisable.java b/src/com/droidquest/materials/CameraDisable.java index e3eb7f5..36a4574 100644 --- a/src/com/droidquest/materials/CameraDisable.java +++ b/src/com/droidquest/materials/CameraDisable.java @@ -8,33 +8,30 @@ import javax.swing.ImageIcon; import com.droidquest.items.Item; -public class CameraDisable extends Material -{ -public CameraDisable() - { - super(true, false); - BufferedImage bi = new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR); - Graphics g; - try - { - g = bi.getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); - return; - } - - g.setColor(Color.black); - g.fillRect(0,0,28,32); - icon = new ImageIcon(bi); - } +public class CameraDisable extends Material { + public CameraDisable() { + super(true, false); + BufferedImage bi = new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR); + Graphics g; + try { + g = bi.getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); + return; + } + + g.setColor(Color.black); + g.fillRect(0, 0, 28, 32); + icon = new ImageIcon(bi); + } -public void TouchedByItem(Item item) - { - if (item == level.player) - if (level.currentViewer != level.player) - level.currentViewer = level.player; - } + public void TouchedByItem(Item item) { + if (item == level.player) { + if (level.currentViewer != level.player) { + level.currentViewer = level.player; + } + } + } } diff --git a/src/com/droidquest/materials/CameraEnable.java b/src/com/droidquest/materials/CameraEnable.java index ae8e558..4c31f35 100644 --- a/src/com/droidquest/materials/CameraEnable.java +++ b/src/com/droidquest/materials/CameraEnable.java @@ -8,56 +8,52 @@ import javax.swing.ImageIcon; import com.droidquest.items.Item; -public class CameraEnable extends Material -{ -transient Item hiddenCamera=null; +public class CameraEnable extends Material { + private transient Item hiddenCamera = null; -public CameraEnable() - { - super(true, false); - GenerateIcons(); - } + public CameraEnable() { + super(true, false); + GenerateIcons(); + } -public void GenerateIcons() - { - BufferedImage bi = new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR); - Graphics g; - try - { - g = bi.getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - - g.setColor(Color.black); - g.fillRect(0,0,28,32); - g.setColor(Color.white); - g.fillRect(8,9,12,2); - g.fillRect(8,21,12,2); - g.fillRect(4,11,4,2); - g.fillRect(4,19,4,2); - g.fillRect(20,11,4,2); - g.fillRect(20,19,4,2); - g.fillRect(0,13,4,6); - g.fillRect(24,13,4,6); - g.fillRect(8,13,12,6); - icon = new ImageIcon(bi); - } + public void GenerateIcons() { + BufferedImage bi = new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR); + Graphics g; + try { + g = bi.getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } -public void TouchedByItem(Item item) - { - if (hiddenCamera==null) - for (int a=0; a 0) - { - long seconds = Math.abs(timer/1000) + 1; - if (seconds<10) - textbox.textString = "0" + seconds; - else - textbox.textString = "" + seconds; - } - else - { - for (int a=0; a 0) { + long seconds = Math.abs(timer / 1000) + 1; + if (seconds < 10) { + textbox.textString = "0" + seconds; + } + else { + textbox.textString = "" + seconds; + } + } + else { + for (int a = 0; a < level.materials.size(); a++) { + Material mat = level.materials.elementAt(a); + if (mat instanceof HotWires) { + ((HotWires) mat).value = true; + } + } + ((Sentry) sentry).protect[3] = 11 * 32; + value = false; + textbox.textString = "00"; + } + } + } + +} \ No newline at end of file diff --git a/src/com/droidquest/materials/ElevatorDoor.java b/src/com/droidquest/materials/ElevatorDoor.java index aadb0a8..5fbd6e4 100644 --- a/src/com/droidquest/materials/ElevatorDoor.java +++ b/src/com/droidquest/materials/ElevatorDoor.java @@ -1,7 +1,5 @@ package com.droidquest.materials; -import java.awt.Color; - import com.droidquest.avatars.GameCursor; import com.droidquest.decorations.Graphix; import com.droidquest.decorations.TextBox; @@ -9,137 +7,134 @@ import com.droidquest.items.GenericRobot; import com.droidquest.items.Item; import com.droidquest.items.Magnet; -public class ElevatorDoor extends Material -{ - // This material will open or close the elevator doors based on where - // the player is. It is sensitive to the player being inside a robot. - transient boolean checkedForMagnet = false; - transient Item magnet = null; +import java.awt.*; - public ElevatorDoor() - { - super(Color.black, true, false); - } +public class ElevatorDoor extends Material { + // This material will open or close the elevator doors based on where + // the player is. It is sensitive to the player being inside a robot. + private transient boolean checkedForMagnet = false; + private transient Item magnet = null; - public void TouchedByItem(Item item) - { - if (item.carriedBy!=null) return; - - if (!checkedForMagnet) - { - for (int a=0; a0) - { - item.charge=0; - level.PlaySound(item.room, Level.DISCHARGESOUND); - } - } + icon = images[0]; + if (value) { + icon = images[1]; + } + } - public void Animate() - { - icon = images[0]; - if (value) - icon = images[1]; - } + public void TouchedByItem(Item item) { + if (value) { + if (item.charge > 0) { + item.charge = 0; + level.PlaySound(item.room, Level.DISCHARGESOUND); + } + } + } - public boolean equals(Material mat) - { - if (super.equals(mat)) - if (value == ((HotWires)mat).value - && wall == ((HotWires)mat).wall) - return true; - return false; - } + public void Animate() { + icon = images[0]; + if (value) { + icon = images[1]; + } + } - } + public boolean equals(Material mat) { + if (super.equals(mat)) { + if (value == ((HotWires) mat).value + && wall == ((HotWires) mat).wall) { + return true; + } + } + return false; + } + +} diff --git a/src/com/droidquest/materials/Lock.java b/src/com/droidquest/materials/Lock.java index 3db6c9c..146aefe 100644 --- a/src/com/droidquest/materials/Lock.java +++ b/src/com/droidquest/materials/Lock.java @@ -11,235 +11,236 @@ import com.droidquest.Room; import com.droidquest.items.Item; import com.droidquest.items.Key; -public class Lock extends Material -{ - // Generic Lock; Used to redefine materials in the local room. +public class Lock extends Material { + // Generic Lock; Used to redefine materials in the local room. - int doorState=0; - Color keyColor; - transient Key latchKey = null; - transient Room room; - transient Room currentRoom; - static public int NARROW = -1; - static public int WIDE = -2; - static public int REMOVE = -3; - static public int RESET = -4; - static public int LEFT = -5; - static public int RIGHT = -6; - static public int UP = -7; - static public int DOWN = -8; - int[][] program; + private int doorState = 0; + private Color keyColor; + private transient Key latchKey = null; + private transient Room room; + private transient Room currentRoom; + static public int NARROW = -1; + static public int WIDE = -2; + static public int REMOVE = -3; + private static int RESET = -4; + static public int LEFT = -5; + static public int RIGHT = -6; + static public int UP = -7; + static public int DOWN = -8; + private int[][] program; - // program[][] is an array of arrays. Each array holds the behavior of a - // single value of doorState. - // - // A single array can hold one of the following: + // program[][] is an array of arrays. Each array holds the behavior of a + // single value of doorState. + // + // A single array can hold one of the following: // A single value of Lock.NARROW, Lock.WIDE, or Lock.REMOVE to define a pause // A single value of RESET, LEFT, RIGHT, UP, or DOWN to change rooms // A series of triplets (X,Y,M) with the XY position and the Materials // Index. - // - // Pause value can be one of the following: - // Lock.NARROW = Pause until the key is placed once more precisely into the lock. - // Lock.WIDE = Pause until the key is placed ANYWHERE into the lock - // Lock.REMOVE = Pause until the key is removed. - // - // Pause values automatically reset the current Room to the original value. - // - // Lock.RESET = Set current room to the original room value - // Lock.LEFT = Change the current room to the room's left room - // Lock.RIGHT = Same, but right - // Lock.UP = Same, but up - // Lock.DOWN = Same, but down - // - // The room is normally the key's rom when the key touches the lock, and - // the triplets change the materials within the current room. With these - // commands the current room can be changed so other rooms can be - // manipulated. - // - // Here's a sample program[][] - // - // int[][] = { + // + // Pause value can be one of the following: + // Lock.NARROW = Pause until the key is placed once more precisely into the lock. + // Lock.WIDE = Pause until the key is placed ANYWHERE into the lock + // Lock.REMOVE = Pause until the key is removed. + // + // Pause values automatically reset the current Room to the original value. + // + // Lock.RESET = Set current room to the original room value + // Lock.LEFT = Change the current room to the room's left room + // Lock.RIGHT = Same, but right + // Lock.UP = Same, but up + // Lock.DOWN = Same, but down + // + // The room is normally the key's rom when the key touches the lock, and + // the triplets change the materials within the current room. With these + // commands the current room can be changed so other rooms can be + // manipulated. + // + // Here's a sample program[][] + // + // int[][] = { // {Lock.NARROW}, // Wait for precise placement // {10,5,0, 11,5,0}, // Converts two spots to holes // {10,6,0, 11,6,0}, // Same, but lower // {Lock.NARROW}, // Wait again // {10,6,1, 11,6,1}, // Converts two spots to wall // {10,5,1, 11,5,1} // same, in reverse, go to pause. - // }; - // + // }; + // - public Lock(Color lc, Color kc, int[][] prg) - { - super(true, false); - color = lc; - keyColor = kc; - program = prg; - GenerateIcons(); - } + public Lock(Color lc, Color kc, int[][] prg) { + super(true, false); + color = lc; + keyColor = kc; + program = prg; + GenerateIcons(); + } - public void GenerateIcons() - { - BufferedImage bi = new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR); - Graphics g; - try - { - g = bi.getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); - return; - } - - g.setColor(color); - g.fillRect(0,0,28,32); - g.setColor(Color.black); - g.fillRect(0,14,16,2); - g.fillRect(0,16,12,2); - g.fillRect(2,18,6,2); - icon = new ImageIcon(bi); - } + public void GenerateIcons() { + BufferedImage bi = new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR); + Graphics g; + try { + g = bi.getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + "Image"); + return; + } - public boolean equals(Material mat) - { - if (super.equals(mat)) - if (keyColor == ((Lock)mat).keyColor - && program == ((Lock)mat).program) - return true; - return false; - } + g.setColor(color); + g.fillRect(0, 0, 28, 32); + g.setColor(Color.black); + g.fillRect(0, 14, 16, 2); + g.fillRect(0, 16, 12, 2); + g.fillRect(2, 18, 6, 2); + icon = new ImageIcon(bi); + } - public void Animate() - { - if (doorState == program.length) - doorState = 0; - - if (latchKey==null) - { - if (program[doorState][0]==Lock.REMOVE) - { - for (int a=0; a 1) - { - for (int a=0; a=16 && X <=20 - && Y>=10 && Y<=14) - doorState++; - } - else if (program[doorState][0]==WIDE) - { - currentRoom = room; - doorState++; - } - } - - if (doorState == program.length) - doorState = 0; - - } + public void Animate() { + if (doorState == program.length) { + doorState = 0; + } - } \ No newline at end of file + if (latchKey == null) { + if (program[doorState][0] == Lock.REMOVE) { + for (int a = 0; a < level.items.size(); a++) { + Item item = level.items.elementAt(a); + if (item instanceof Key) { + Key testKey = (Key) item; + if (testKey.color.equals(keyColor)) { + latchKey = testKey; + room = latchKey.room; + currentRoom = room; + } + } + } + } + } + + if (latchKey == null) { + return; + } + + + if (program[doorState].length > 1) { + for (int a = 0; a < program[doorState].length / 3; a++) { + currentRoom.SetMaterial(program[doorState][a * 3], + program[doorState][a * 3 + 1], + program[doorState][a * 3 + 2]); + } + doorState++; + } + else { + if (program[doorState][0] == REMOVE) { + currentRoom = room; + Dimension d = latchKey.GetXY(); + int bigXL = d.width / 28; + int bigXR = (d.width + latchKey.getWidth()) / 28; + int bigYT = d.height / 32; + int bigYB = (d.height + latchKey.getHeight()) / 32; + boolean flag = false; + if (room.MaterialArray[bigYT][bigXL] == this) { + flag = true; + } + if (room.MaterialArray[bigYT][bigXR] == this) { + flag = true; + } + if (room.MaterialArray[bigYB][bigXL] == this) { + flag = true; + } + if (room.MaterialArray[bigYB][bigXR] == this) { + flag = true; + } + if (!flag) { + doorState++; + } + } + else if (program[doorState][0] == RESET) { + currentRoom = room; + doorState++; + } + else if (program[doorState][0] == LEFT) { + currentRoom = currentRoom.leftRoom; + if (currentRoom == null) { + currentRoom = room; + } + doorState++; + } + else if (program[doorState][0] == RIGHT) { + currentRoom = currentRoom.rightRoom; + if (currentRoom == null) { + currentRoom = room; + } + doorState++; + } + else if (program[doorState][0] == UP) { + currentRoom = currentRoom.upRoom; + if (currentRoom == null) { + currentRoom = room; + } + doorState++; + } + else if (program[doorState][0] == DOWN) { + currentRoom = currentRoom.downRoom; + if (currentRoom == null) { + currentRoom = room; + } + doorState++; + } + } + + if (doorState == program.length) { + doorState = 0; + } + } + + public void TouchedByItem(Item item) { + if (item instanceof Key) { + if (((Key) item).color.equals(keyColor)) { + latchKey = (Key) item; + room = latchKey.room; + } + } + + if (latchKey == null) { + return; + } + + if (latchKey != item) { + return; + } + + if (program[doorState].length == 1) { + if (program[doorState][0] == NARROW) { + currentRoom = room; + Dimension d = latchKey.GetXY(); + int X = d.width % 28; + int Y = d.height % 32; + if (X >= 16 && X <= 20 + && Y >= 10 && Y <= 14) { + doorState++; + } + } + else if (program[doorState][0] == WIDE) { + currentRoom = room; + doorState++; + } + } + + if (doorState == program.length) { + doorState = 0; + } + + } + +} \ No newline at end of file diff --git a/src/com/droidquest/materials/LockS1.java b/src/com/droidquest/materials/LockS1.java index 20c46b1..1819fbb 100644 --- a/src/com/droidquest/materials/LockS1.java +++ b/src/com/droidquest/materials/LockS1.java @@ -1,49 +1,41 @@ package com.droidquest.materials; -import java.awt.Color; -import java.util.Date; - import com.droidquest.Room; import com.droidquest.items.Item; import com.droidquest.items.Magnet; -public class LockS1 extends Material -{ -Date timeout; -transient Item magnet=null; -transient Room room = null; +import java.awt.*; +import java.util.Date; -public LockS1() - { - super(new Color(0,0,128),false,true); - } +public class LockS1 extends Material { + private Date timeout; + private transient Item magnet = null; + private transient Room room = null; -public void TouchedByItem(Item item) - { - if (item instanceof Magnet) - { - magnet = item; - room = item.room; - timeout = new Date(new Date().getTime() + 10000); - } - } + public LockS1() { + super(new Color(0, 0, 128), false, true); + } -public void Animate() - { - if (magnet != null) - { - Date now = new Date(); - if (now.getTime() > timeout.getTime()) - { - if (magnet.room == room) - { - level.LinkRoomsLeftRight(11,30); - level.LinkRoomsLeftRight(30,11); - room.SetMaterial(10,3,0); - room.SetMaterial(11,3,0); - } - } - } - } + public void TouchedByItem(Item item) { + if (item instanceof Magnet) { + magnet = item; + room = item.room; + timeout = new Date(new Date().getTime() + 10000); + } + } + + public void Animate() { + if (magnet != null) { + Date now = new Date(); + if (now.getTime() > timeout.getTime()) { + if (magnet.room == room) { + level.LinkRoomsLeftRight(11, 30); + level.LinkRoomsLeftRight(30, 11); + room.SetMaterial(10, 3, 0); + room.SetMaterial(11, 3, 0); + } + } + } + } } diff --git a/src/com/droidquest/materials/Material.java b/src/com/droidquest/materials/Material.java index 255ad57..00266ef 100644 --- a/src/com/droidquest/materials/Material.java +++ b/src/com/droidquest/materials/Material.java @@ -1,130 +1,101 @@ package com.droidquest.materials; -import java.awt.Color; -import java.awt.Graphics; -import java.io.Serializable; - -import javax.swing.ImageIcon; - import com.droidquest.RoomDisplay; import com.droidquest.items.Item; import com.droidquest.levels.Level; -public class Material implements Serializable, Cloneable -{ - public transient static Level level; - public transient ImageIcon icon; - public String file; - public boolean passable; - public boolean detectable; - public Color color; +import javax.swing.*; +import java.awt.*; +import java.io.Serializable; - public Material(){} +public class Material implements Serializable, Cloneable { + public transient static Level level; + public transient ImageIcon icon; + private String file; + public boolean passable; + boolean detectable; + Color color; - public Material(String filename, boolean p, boolean d) - { - // icon=Toolkit.getDefaultToolkit().getImage(filename); - icon = new ImageIcon(filename); - passable = p; - detectable = d; - } + Material() { + } - public Material(boolean p, boolean d) - { - passable = p; - detectable = d; - color = Color.black; - } + Material(String filename, boolean p, boolean d) { + icon = new ImageIcon(filename); + passable = p; + detectable = d; + } - public Material (Color c, boolean p, boolean d) - { - passable=p; - detectable = d; - color=c; - } + public Material(boolean p, boolean d) { + passable = p; + detectable = d; + color = Color.black; + } - public void GenerateIcons() - { - if (file != null) - icon = new ImageIcon(file); - } + public Material(Color c, boolean p, boolean d) { + passable = p; + detectable = d; + color = c; + } - public void Draw(Graphics g, RoomDisplay rd, int x, int y) - { - if (icon==null) - { - // Blank Background - g.setColor(color); - g.fillRect(x*28,y*32,28,32); -// if (color!=Color.BLACK){ -// g.setColor(color.brighter()); -// g.drawLine(x*28, y*32, x*28+27, y*32); -// g.drawLine(x*28, y*32, x*28, y*32+31); -// g.setColor(color.darker()); -// g.drawLine(x*28+27, y*32, x*28+27, y*32+31); -// g.drawLine(x*28, y*32+31, x*28+27, y*32+31); -// } - return; - } - else - { - // Material Background - g.drawImage(icon.getImage(), x*28, y*32, rd); - return; - } - } + public void GenerateIcons() { + if (file != null) { + icon = new ImageIcon(file); + } + } - public void TouchedByItem(Item item) - { - } + public void Draw(Graphics g, RoomDisplay rd, int x, int y) { + if (icon == null) { + // Blank Background + g.setColor(color); + g.fillRect(x * 28, y * 32, 28, 32); + } + else { + // Material Background + g.drawImage(icon.getImage(), x * 28, y * 32, rd); + } + } - public void Animate() - { - } + public void TouchedByItem(Item item) { + } - public boolean Passable(Item item) - { - return passable; - } + public void Animate() { + } - public boolean Detectable(Item item) - { - return detectable; - } + public boolean Passable(Item item) { + return passable; + } - public boolean equals(Material mat) - { - if (getClass() == mat.getClass() - && color == mat.color - && passable == mat.passable - && detectable == mat.detectable - && file == mat.file) - return true; - else - return false; - } + public boolean Detectable(Item item) { + return detectable; + } - public static Material FindSimiliar(Material mat1) - { - for (int a=0; a0) - hit--; - if (hit>=2) - { - target.room = (Room) level.rooms.elementAt(58); - target.charge=0; - if (target.InternalRoom != null) - { - Room room = target.InternalRoom; - if (room.wires.size()>0) - for(int a=0; a 0) { + hit--; + } + if (hit >= 2) { + target.room = level.rooms.elementAt(58); + target.charge = 0; + if (target.InternalRoom != null) { + Room room = target.InternalRoom; + if (room.wires.size() > 0) { + for (int a = 0; a < room.wires.size(); a++) { + room.wires.elementAt(0).Remove(); + } + } + } + } + } } diff --git a/src/com/droidquest/materials/Monitor.java b/src/com/droidquest/materials/Monitor.java index 2d420d9..db92490 100644 --- a/src/com/droidquest/materials/Monitor.java +++ b/src/com/droidquest/materials/Monitor.java @@ -2,11 +2,9 @@ package com.droidquest.materials; import java.awt.Color; -public class Monitor extends Material -{ -public Monitor() - { - super(Color.red,true,false); - } +public class Monitor extends Material { + public Monitor() { + super(Color.red, true, false); + } } diff --git a/src/com/droidquest/materials/MultiButton.java b/src/com/droidquest/materials/MultiButton.java index 360a19c..99fc946 100644 --- a/src/com/droidquest/materials/MultiButton.java +++ b/src/com/droidquest/materials/MultiButton.java @@ -1,139 +1,135 @@ package com.droidquest.materials; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.util.Date; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.items.Item; -public class MultiButton extends Material -{ -public int number; //0=starter, 1,2,3,4,5,6,7,8,9 = buttons -transient ImageIcon images[]; -static int[] states = new int[10]; //0=Blue, 1=White, 2=Orange -public Date timeout; -transient Room room=null; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.util.Date; -public MultiButton(int n, int s) - { - super(true, false); - number = n; - states[number] = s; - } +public class MultiButton extends Material { + private int number; //0=starter, 1,2,3,4,5,6,7,8,9 = buttons + private transient ImageIcon[] images; + private static int[] states = new int[10]; //0=Blue, 1=White, 2=Orange + private Date timeout; + private transient Room room = null; -public void GenerateIcons() - { - images = new ImageIcon[3]; - for (int a=0; a<3; a++) - { - images[a] = new ImageIcon(new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = images[a].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - Color c = Color.blue; - if (a==1) - c = Color.white; - else if (a==2) - c = new Color(255,128,0); - g2.setColor(c); - g.fillRect(0,0,28,32); - g2.setColor(Color.black); - g.fillRect(4,14,20,4); - g.fillRect(8,12,12,8); - g.fillRect(12,8,4,16); - g2.setColor(c); - g.fillRect(12,14,4,4); - } - - icon = images[0]; - } + public MultiButton(int n, int s) { + super(true, false); + number = n; + states[number] = s; + } -public void TouchedByItem(Item item) - { - if (room==null) - room = item.room; - - if (number==0) - { - if (states[0]==1) - { - states[0]=2; - for (int a=1; a<10; a++) - states[a]=1; - timeout = new Date(new Date().getTime() + 30000); - } - } - else - { - boolean okay = true; - if (states[0]<2) okay=false; - for (int a=1; a timeout.getTime()) - { - states[0]=1; - for (int a=1; a<10; a++) - states[a]=0; - } - } - - } + icon = images[0]; + } -public boolean equals(Material mat) - { - if (super.equals(mat)) - if (number == ((MultiButton)mat).number) - return true; - return false; - } + public void TouchedByItem(Item item) { + if (room == null) { + room = item.room; + } + + if (number == 0) { + if (states[0] == 1) { + states[0] = 2; + for (int a = 1; a < 10; a++) { + states[a] = 1; + } + timeout = new Date(new Date().getTime() + 30000); + } + } + else { + boolean okay = true; + if (states[0] < 2) { + okay = false; + } + for (int a = 1; a < number; a++) { + if (states[a] != 2) { + okay = false; + } + } + if (okay) { + states[number] = 2; + timeout = new Date(new Date().getTime() + 5000); + } + } + } + + public void Animate() { + icon = images[states[number]]; + + if (number != 0) { + return; + } + + if (states[0] == 0) { + states[0] = 1; + for (int a = 1; a < 10; a++) { + states[a] = 0; + } + } + + boolean flag = true; + for (int a = 0; a < 10; a++) { + if (states[a] != 2) { + flag = false; + } + } + + if (flag) { + Portal ptl = new Portal("ROEndGame.lvl", true, true); + level.materials.addElement(ptl); + room.SetMaterial(10, 9, ptl); + } + + if (states[0] == 2) { + Date now = new Date(); + if (now.getTime() > timeout.getTime()) { + states[0] = 1; + for (int a = 1; a < 10; a++) { + states[a] = 0; + } + } + } + + } + + public boolean equals(Material mat) { + if (super.equals(mat)) { + if (number == ((MultiButton) mat).number) { + return true; + } + } + return false; + } } diff --git a/src/com/droidquest/materials/MultiSwitch.java b/src/com/droidquest/materials/MultiSwitch.java index 7e906bf..91d2758 100644 --- a/src/com/droidquest/materials/MultiSwitch.java +++ b/src/com/droidquest/materials/MultiSwitch.java @@ -1,157 +1,149 @@ package com.droidquest.materials; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.util.Date; - -import javax.swing.ImageIcon; - import com.droidquest.Room; import com.droidquest.items.Item; -public class MultiSwitch extends Material -{ -public int number; //0=starter, 1,2,3,4=pistons -transient ImageIcon images[]; -static int[] states = {0,0,0,0,0}; //0=Blue, 1=White, 2=Orange -public Date timeout; -transient Room room=null; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.util.Date; -public MultiSwitch(int n, int s) - { - super(true, false); - number = n; - states[number] = s; - } +public class MultiSwitch extends Material { + private int number; //0=starter, 1,2,3,4=pistons + private transient ImageIcon[] images; + private static int[] states = {0, 0, 0, 0, 0}; //0=Blue, 1=White, 2=Orange + private Date timeout; + private transient Room room = null; -public void GenerateIcons() - { - images = new ImageIcon[3]; - for (int a=0; a<3; a++) - { - images[a] = new ImageIcon(new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = images[a].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - g2.setBackground(Color.black); - g2.clearRect(0,0,28,32); - if (a==0) - g2.setColor(Color.blue); - else if (a==1) - g2.setColor(Color.white); - else if (a==2) - g2.setColor(new Color(255,128,0)); - - g2.fillRect(12,4,6,24); - g2.fillRect(18,12,10,8); - } - - icon = images[0]; - } + public MultiSwitch(int n, int s) { + super(true, false); + number = n; + states[number] = s; + } -public void TouchedByItem(Item item) - { - if (room==null) - room = item.room; - - if (number==0) - { - if (states[0]!=2) - { - states[0]=2; - states[1]=1; - states[2]=1; - states[3]=1; - states[4]=1; - timeout = new Date(new Date().getTime() + 5000); - } - } - else - { - boolean okay = true; - if (states[0]<2) okay=false; - for (int a=1; a timeout.getTime()) - { - states[0]=0; - states[1]=0; - states[2]=0; - states[3]=0; - states[4]=0; - } - } - - } + g2.fillRect(12, 4, 6, 24); + g2.fillRect(18, 12, 10, 8); + } -public boolean equals(Material mat) - { - if (super.equals(mat)) - if (number == ((MultiSwitch)mat).number) - return true; - return false; - } + icon = images[0]; + } + + public void TouchedByItem(Item item) { + if (room == null) { + room = item.room; + } + + if (number == 0) { + if (states[0] != 2) { + states[0] = 2; + states[1] = 1; + states[2] = 1; + states[3] = 1; + states[4] = 1; + timeout = new Date(new Date().getTime() + 5000); + } + } + else { + boolean okay = true; + if (states[0] < 2) { + okay = false; + } + for (int a = 1; a < number; a++) { + if (states[a] != 2) { + okay = false; + } + } + if (okay) { + states[number] = 2; + } + else { + states[0] = 0; + states[1] = 0; + states[2] = 0; + states[3] = 0; + states[4] = 0; + } + } + } + + public void Animate() { + icon = images[states[number]]; + + if (number != 0) { + return; + } + + boolean flag = true; + for (int a = 0; a < 5; a++) { + if (states[a] != 2) { + flag = false; + } + } + + if (flag) { + for (int a = 0; a < level.materials.size(); a++) { + Material mat = level.materials.elementAt(a); + if (mat instanceof BinaryLock) { + BinaryLock bl = (BinaryLock) mat; + if (bl.program.length == 1) { + bl.program = new int[][]{ + {BinaryLock.NARROW}, + {2, 10, 0, 3, 10, 0, 4, 10, 0, 5, 10, 0, 2, 9, 4, 3, 8, 4, 4, 8, 4, 5, 9, 4}, + {2, 9, 0, 3, 8, 0, 4, 8, 0, 5, 9, 0, 1, 9, 4, 1, 8, 4, 6, 9, 4, 6, 8, 4}, + {BinaryLock.NARROW}, + {2, 9, 4, 3, 8, 4, 4, 8, 4, 5, 9, 4, 1, 9, 0, 1, 8, 0, 6, 9, 0, 6, 8, 0}, + {2, 10, 4, 3, 10, 4, 4, 10, 4, 5, 10, 4, 2, 9, 0, 3, 8, 0, 4, 8, 0, 5, 9, 0} + }; + } + } + } + } + + if (states[0] == 2) { + Date now = new Date(); + if (now.getTime() > timeout.getTime()) { + states[0] = 0; + states[1] = 0; + states[2] = 0; + states[3] = 0; + states[4] = 0; + } + } + + } + + public boolean equals(Material mat) { + if (super.equals(mat)) { + if (number == ((MultiSwitch) mat).number) { + return true; + } + } + return false; + } } diff --git a/src/com/droidquest/materials/PanicButton.java b/src/com/droidquest/materials/PanicButton.java index ba5e533..56d3914 100644 --- a/src/com/droidquest/materials/PanicButton.java +++ b/src/com/droidquest/materials/PanicButton.java @@ -10,101 +10,92 @@ import javax.swing.ImageIcon; import com.droidquest.items.Item; import com.droidquest.items.Sentry; -public class PanicButton extends Material -{ -boolean state = true; -transient ImageIcon images[]; -transient Sentry sentry; -int number; +public class PanicButton extends Material { + private boolean state = true; + private transient ImageIcon[] images; + private transient Sentry sentry; + private int number; // image[0] = blue, off, Sentry alive // image[1] = orange, on, Sentry dead -public PanicButton(int n) - { - super(true, false); - number = n; - GenerateIcons(); - } + public PanicButton(int n) { + super(true, false); + number = n; + GenerateIcons(); + } -public void GenerateIcons() - { - images = new ImageIcon[2]; - for (int a=0; a<2; a++) - { - images[a] = new ImageIcon(new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR)); - Graphics g; - try - { - g = images[a].getImage().getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - Graphics2D g2 = (Graphics2D) g; - g2.setBackground(Color.black); - g2.clearRect(0,0,28,32); - Color color; - if (a==0) - color = Color.blue; - else - color = new Color(255,128,0); - - g.setColor(color); - g.fillRect(8,0,12,26); - g.fillRect(4,2,20,22); - g.fillRect(0,4,28,18); - g.setColor(Color.black); - g.fillRect(8,6,12,14); - g.fillRect(4,8,20,10); - g.setColor(color); - g.fillRect(12,8,4,10); - g.fillRect(8,10,12,6); - } - icon = images[0]; - } + public void GenerateIcons() { + images = new ImageIcon[2]; + for (int a = 0; a < 2; a++) { + images[a] = new ImageIcon(new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR)); + Graphics g; + try { + g = images[a].getImage().getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } + Graphics2D g2 = (Graphics2D) g; + g2.setBackground(Color.black); + g2.clearRect(0, 0, 28, 32); + Color color; + if (a == 0) { + color = Color.blue; + } + else { + color = new Color(255, 128, 0); + } -public void TouchedByItem(Item item) - { - if (item == level.player && level.player.carriedBy == null) - { - if (sentry==null) - { - for (int a=0; a 80) - { - GenericRobot gr = (GenericRobot) level.player.room.portalItem; - level.currentViewer = level.player; - gr.periscope = false; - } - } + public void TouchedByItem(Item item) { + + if (item == level.player) { + if (item.x < 462 || item.y > 80) { + GenericRobot gr = (GenericRobot) level.player.room.portalItem; + level.currentViewer = level.player; + gr.periscope = false; + } + } + } } diff --git a/src/com/droidquest/materials/PeriscopeUp.java b/src/com/droidquest/materials/PeriscopeUp.java index 8378e74..ff2d85a 100644 --- a/src/com/droidquest/materials/PeriscopeUp.java +++ b/src/com/droidquest/materials/PeriscopeUp.java @@ -9,53 +9,47 @@ import javax.swing.ImageIcon; import com.droidquest.items.GenericRobot; import com.droidquest.items.Item; -public class PeriscopeUp extends Material -{ -public PeriscopeUp() - { - super(true, false); - GenerateIcons(); - } +public class PeriscopeUp extends Material { + public PeriscopeUp() { + super(true, false); + GenerateIcons(); + } -public void GenerateIcons() - { - BufferedImage bi = new BufferedImage(28,32,BufferedImage.TYPE_4BYTE_ABGR); - Graphics g; - try - { - g = bi.getGraphics(); - } - catch (NullPointerException e) - { - System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); - return; - } - - g.setColor(Color.black); - g.fillRect(0,0,28,32); - g.setColor(Color.white); - g.fillRect(8,9,12,2); - g.fillRect(8,21,12,2); - g.fillRect(4,11,4,2); - g.fillRect(4,19,4,2); - g.fillRect(20,11,4,2); - g.fillRect(20,19,4,2); - g.fillRect(0,13,4,6); - g.fillRect(24,13,4,6); - g.fillRect(8,13,12,6); - icon = new ImageIcon(bi); - } + public void GenerateIcons() { + BufferedImage bi = new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR); + Graphics g; + try { + g = bi.getGraphics(); + } + catch (NullPointerException e) { + System.out.println("Could not get Graphics pointer to " + getClass() + " Image"); + return; + } -public void TouchedByItem(Item item) - { - if (item == level.player) - if (item.x > 462 && item.y < 80) - { - GenericRobot gr = (GenericRobot) level.player.room.portalItem; - level.currentViewer = gr; - gr.periscope = true; - } - } + g.setColor(Color.black); + g.fillRect(0, 0, 28, 32); + g.setColor(Color.white); + g.fillRect(8, 9, 12, 2); + g.fillRect(8, 21, 12, 2); + g.fillRect(4, 11, 4, 2); + g.fillRect(4, 19, 4, 2); + g.fillRect(20, 11, 4, 2); + g.fillRect(20, 19, 4, 2); + g.fillRect(0, 13, 4, 6); + g.fillRect(24, 13, 4, 6); + g.fillRect(8, 13, 12, 6); + icon = new ImageIcon(bi); + } + + public void TouchedByItem(Item item) { + if (item == level.player) { + if (item.x > 462 && item.y < 80) { + GenericRobot gr = (GenericRobot) level.player.room.portalItem; + level.currentViewer = gr; + gr.periscope = true; + } + } + } } diff --git a/src/com/droidquest/materials/PlayerBlocker.java b/src/com/droidquest/materials/PlayerBlocker.java index e8c6060..748fc21 100644 --- a/src/com/droidquest/materials/PlayerBlocker.java +++ b/src/com/droidquest/materials/PlayerBlocker.java @@ -1,68 +1,59 @@ package com.droidquest.materials; -import java.awt.Color; - -import javax.swing.ImageIcon; - import com.droidquest.avatars.GameCursor; import com.droidquest.items.Item; -public class PlayerBlocker extends Material -{ -transient ImageIcon images[]; -String[] filenames; -int animationState=0; +import javax.swing.*; +import java.awt.*; -public PlayerBlocker(Color col) - { - color = col; - detectable = false; - } +public class PlayerBlocker extends Material { + private transient ImageIcon[] images; + private String[] filenames; + private int animationState = 0; -public PlayerBlocker(String[] files) - { - detectable = false; - filenames = files; - GenerateIcons(); - } + public PlayerBlocker(Color col) { + color = col; + detectable = false; + } -public void GenerateIcons() - { - if (filenames != null) - { - int numfiles = filenames.length; - images = new ImageIcon[numfiles]; - for (int a=0; a= timeout.getTime()) - { - switchState++; - timing = false; - currentRoom = room; - } - } - else - { - timeout = new Date(new Date().getTime() + 1000*program[switchState][1]); - timing = true; - } - break; - case SETVALUEHIGH: - value=true; - switchState++; - break; - case SETVALUELOW: - value=false; - switchState++; - break; - case REPLACE: - if (currentRoom == null) - currentRoom = trigger.room; - for (int a=0; a<(program[switchState].length-1)/3; a++) - currentRoom.SetMaterial(program[switchState][a*3+1], - program[switchState][a*3+2], - program[switchState][a*3+3]); - switchState++; - break; - case LEFTROOM: - currentRoom = currentRoom.leftRoom; - switchState++; - break; - case RIGHTROOM: - currentRoom = currentRoom.rightRoom; - switchState++; - break; - case UPROOM: - currentRoom = currentRoom.upRoom; - switchState++; - break; - case DOWNROOM: - currentRoom = currentRoom.downRoom; - switchState++; - break; - case RESETROOM: - currentRoom = room; - switchState++; - break; - } - - } + } - } + public boolean equals(Material mat) { + if (super.equals(mat)) { + if (rotation == ((Switch) mat).rotation + && value == ((Switch) mat).value + && program == ((Switch) mat).program) { + return true; + } + } + return false; + } + + public void TouchedByItem(Item item) { + if (switchState == program.length) { + switchState = 0; + } + + if (program[switchState][0] == WAIT4CONTACT) { + trigger = item; + room = item.room; + currentRoom = room; + switchState++; + } + + if (program[switchState][0] == -12) // == WAIT4PLAYERCONTACT + { + if (item == level.player) { + trigger = item; + room = item.room; + currentRoom = room; + switchState++; + } + } + } + + public void Animate() { + if (switchState == program.length) { + switchState = 0; + } + + if (value) { + icon = images[1]; + } + else { + icon = images[0]; + } + + switch (program[switchState][0]) { + case WAIT4REMOVAL: { + Dimension d = trigger.GetXY(); + int bigXL = d.width / 28; + int bigXR = (d.width + trigger.getWidth()) / 28; + int bigYT = d.height / 32; + int bigYB = (d.height + trigger.getHeight()) / 32; + boolean removed = true; + for (int Y = bigYT; Y < bigYB; Y++) { + for (int X = bigXL; X < bigXR; X++) { + if (trigger.room.MaterialArray[Y][X] == this) { + removed = false; + } + } + } + if (removed) { + switchState++; + } + currentRoom = room; + } + break; + case WAIT4TIME: + if (timing) { + Date now = new Date(); + if (now.getTime() >= timeout.getTime()) { + switchState++; + timing = false; + currentRoom = room; + } + } + else { + timeout = new Date(new Date().getTime() + 1000 * program[switchState][1]); + timing = true; + } + break; + case SETVALUEHIGH: + value = true; + switchState++; + break; + case SETVALUELOW: + value = false; + switchState++; + break; + case REPLACE: + if (currentRoom == null) { + currentRoom = trigger.room; + } + for (int a = 0; a < (program[switchState].length - 1) / 3; a++) { + currentRoom.SetMaterial(program[switchState][a * 3 + 1], + program[switchState][a * 3 + 2], + program[switchState][a * 3 + 3]); + } + switchState++; + break; + case LEFTROOM: + currentRoom = currentRoom.leftRoom; + switchState++; + break; + case RIGHTROOM: + currentRoom = currentRoom.rightRoom; + switchState++; + break; + case UPROOM: + currentRoom = currentRoom.upRoom; + switchState++; + break; + case DOWNROOM: + currentRoom = currentRoom.downRoom; + switchState++; + break; + case RESETROOM: + currentRoom = room; + switchState++; + break; + } + + } + +} diff --git a/src/com/droidquest/materials/Switch1.java b/src/com/droidquest/materials/Switch1.java index 884a138..abb1e0b 100644 --- a/src/com/droidquest/materials/Switch1.java +++ b/src/com/droidquest/materials/Switch1.java @@ -3,32 +3,30 @@ package com.droidquest.materials; import com.droidquest.items.Item; import com.droidquest.items.Train; -public class Switch1 extends Switch -{ -transient Train train; +public class Switch1 extends Switch { + private transient Train train; -public Switch1() - { - super(Switch.ROT_UP); - } + public Switch1() { + super(Switch.ROT_UP); + } -public void TouchedByItem(Item item) - { - if (train==null) - for (int a=0; a Date: Sun, 13 Apr 2014 00:53:02 -0500 Subject: [PATCH 2/2] Implemented additional menu items for avatars and available controls, refactored player avatars to accommodate as well as reduce redundant code. --- src/com/droidquest/DQ.java | 294 ++++++++- src/com/droidquest/RoomDisplay.java | 48 +- src/com/droidquest/avatars/Avatar.java | 83 +++ src/com/droidquest/avatars/GameCursor.java | 401 ++----------- src/com/droidquest/avatars/HelpCam.java | 61 +- src/com/droidquest/avatars/LabCursor.java | 412 +++---------- src/com/droidquest/avatars/PaintBrush.java | 208 +++---- src/com/droidquest/avatars/Player.java | 562 ++++++++++++++++++ src/com/droidquest/avatars/Remote.java | 93 ++- src/com/droidquest/avatars/SolderingPen.java | 316 +++++++--- src/com/droidquest/devices/Device.java | 3 + src/com/droidquest/items/AmpireBot.java | 38 +- src/com/droidquest/items/ChipDecompiler.java | 4 +- src/com/droidquest/items/GateKeeper.java | 4 +- src/com/droidquest/items/GenericRobot.java | 18 +- src/com/droidquest/items/Ghost.java | 8 +- src/com/droidquest/items/Handle.java | 4 +- src/com/droidquest/items/Item.java | 48 +- src/com/droidquest/items/Sentry.java | 20 +- src/com/droidquest/items/Sentry3.java | 28 +- src/com/droidquest/items/SentryT1.java | 4 +- src/com/droidquest/items/SentryT2.java | 26 +- src/com/droidquest/items/SkyGuard.java | 4 +- src/com/droidquest/items/SkywayFlyer.java | 8 +- src/com/droidquest/items/SpyCam.java | 72 ++- src/com/droidquest/items/StormCloud.java | 16 +- src/com/droidquest/items/Sweeper.java | 4 +- src/com/droidquest/items/Train.java | 64 +- src/com/droidquest/items/TrashCollector.java | 60 +- src/com/droidquest/items/Turbine.java | 2 +- src/com/droidquest/items/VendingHandle.java | 6 +- src/com/droidquest/items/WallHandle.java | 6 +- src/com/droidquest/materials/AntiPlayer.java | 1 - .../droidquest/materials/ElevatorDoor.java | 1 - 34 files changed, 1821 insertions(+), 1106 deletions(-) create mode 100644 src/com/droidquest/avatars/Avatar.java create mode 100644 src/com/droidquest/avatars/Player.java diff --git a/src/com/droidquest/DQ.java b/src/com/droidquest/DQ.java index 4fe2b22..97b9019 100644 --- a/src/com/droidquest/DQ.java +++ b/src/com/droidquest/DQ.java @@ -2,6 +2,8 @@ package com.droidquest; //This is the source code for DroidQuest 2.7. Copyright 2003 by Thomas Foote. +import com.droidquest.avatars.Avatar; +import com.droidquest.avatars.LabCursor; import com.droidquest.levels.MainMenu; import javax.swing.*; @@ -12,6 +14,19 @@ import java.util.Set; public class DQ extends JFrame implements ActionListener { private RoomDisplay myRoom; + private JCheckBoxMenuItem menuToggleHot = null; + private JMenuItem menuItemCursor = null; + private JMenuItem menuItemSolderpen = null; + private JMenuItem menuItemPaintbrush = null; + private JCheckBoxMenuItem menuItemRadio = null; + private JMenuItem menuItemToolbox = null; + + private JMenuItem menuRotateRight = null; + private JMenuItem menuRotateLeft = null; + private JMenuItem menuLoadChip = null; + + private JMenuItem menuFlipDevice = null; + private DQ() { // Constructor super("DroidQuest"); @@ -27,8 +42,7 @@ public class DQ extends JFrame implements ActionListener { setIconImage(new ImageIcon("images/helper0.gif").getImage()); Container contentPane = getContentPane(); - myRoom = new RoomDisplay(); - myRoom.dq = this; + myRoom = new RoomDisplay(this); addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { @@ -41,6 +55,9 @@ public class DQ extends JFrame implements ActionListener { JMenuBar menuBar; JMenu fileMenu; + JMenu avatarMenu; + JMenu controlMenu; + JMenu helpMenu; JMenuItem menuItemSave; JMenuItem menuItemMain; JCheckBoxMenuItem menuItemSound; @@ -66,6 +83,91 @@ public class DQ extends JFrame implements ActionListener { menuItemSound.addActionListener(this); menuItemExit.addActionListener(this); + avatarMenu = new JMenu("Avatar"); + avatarMenu.setMnemonic(KeyEvent.VK_A); + menuBar.add(avatarMenu); + + + menuItemCursor = new JRadioButtonMenuItem("Cursor"); + avatarMenu.add(menuItemCursor); + menuItemCursor.addActionListener(this); + + menuItemSolderpen = new JRadioButtonMenuItem("Solderpen"); + avatarMenu.add(menuItemSolderpen); + menuItemSolderpen.setEnabled(false); + menuItemSolderpen.addActionListener(this); + + menuItemPaintbrush = new JRadioButtonMenuItem("Paintbrush"); + avatarMenu.add(menuItemPaintbrush); + menuItemPaintbrush.setEnabled(false); + menuItemPaintbrush.addActionListener(this); + + ButtonGroup menuItemAvatarButtonGroup = new ButtonGroup(); + menuItemAvatarButtonGroup.add(menuItemCursor); + menuItemAvatarButtonGroup.add(menuItemSolderpen); + menuItemAvatarButtonGroup.add(menuItemPaintbrush); + menuItemCursor.setSelected(true); + + controlMenu = new JMenu("Controls"); + controlMenu.setMnemonic(KeyEvent.VK_C); + menuBar.add(controlMenu); + + + menuItemToolbox = new JMenuItem("Toolbox"); + controlMenu.add(menuItemToolbox); + menuItemToolbox.addActionListener(this); + + menuItemRadio = new JCheckBoxMenuItem("Radio"); + controlMenu.add(menuItemRadio); + menuItemRadio.setSelected(false); + menuItemRadio.setEnabled(false); + menuItemRadio.addActionListener(this); + + menuRotateRight = new JMenuItem("Rotate Part Clockwise"); + controlMenu.add(menuRotateRight); + menuRotateRight.setEnabled(false); + menuRotateRight.addActionListener(this); + + menuRotateLeft = new JMenuItem("Rotate Part Counter-clockwise"); + controlMenu.add(menuRotateLeft); + menuRotateLeft.setEnabled(false); + menuRotateLeft.addActionListener(this); + + menuToggleHot = new JCheckBoxMenuItem("Hot Cursor", false); + menuToggleHot.setEnabled(false); + controlMenu.add(menuToggleHot); + menuToggleHot.addActionListener(this); + + + menuLoadChip = new JMenuItem("Load Chip"); + controlMenu.add(menuLoadChip); + menuLoadChip.setEnabled(false); + menuLoadChip.addActionListener(this); + + + JMenuItem menuEnterRobot = new JMenuItem("Enter Robot"); + controlMenu.add(menuEnterRobot); + menuEnterRobot.addActionListener(this); + + JMenuItem menuExitRobot = new JMenuItem("Exit Robot"); + controlMenu.add(menuExitRobot); + menuExitRobot.addActionListener(this); + + menuFlipDevice = new JMenuItem("Flip Device/Wire"); + controlMenu.add(menuFlipDevice); + menuFlipDevice.setEnabled(false); + menuFlipDevice.addActionListener(this); + + menuBar.add(Box.createHorizontalGlue()); + + helpMenu = new JMenu("Help"); + helpMenu.setMnemonic(KeyEvent.VK_H); + menuBar.add(helpMenu); + + JMenuItem helpInfo = new JMenuItem("Help"); + helpMenu.add(helpInfo); + helpInfo.addActionListener(this); + try { System.setErr(System.out); } @@ -83,6 +185,98 @@ public class DQ extends JFrame implements ActionListener { } + public void setHotCursorSelected(boolean selected) { + if (null != this.menuToggleHot) { + this.menuToggleHot.setSelected(selected); + } + } + + public void setHotCursorEnabled(boolean enabled) { + if (null != this.menuToggleHot) { + this.menuToggleHot.setEnabled(enabled); + } + } + + public void setRotateEnabled(boolean enabled) { + if (null != this.menuRotateRight && null != this.menuRotateLeft) { + this.menuRotateRight.setEnabled(enabled); + this.menuRotateLeft.setEnabled(enabled); + } + } + + public void setLoadChipEnabled(boolean enabled) { + if (null != this.menuLoadChip) { + this.menuLoadChip.setEnabled(enabled); + } + } + + public void setFlipDeviceEnabled(boolean enabled) { + if(null != this.menuFlipDevice) { + this.menuFlipDevice.setEnabled(enabled); + } + } + + public void setToolboxEnabled(boolean enabled) { + if (null != this.menuItemToolbox) { + this.menuItemToolbox.setEnabled(enabled); + } + } + + + public void selectCursor() { + if (null != this.menuItemCursor) { + this.menuItemCursor.setSelected(true); + if (null != myRoom && null != myRoom.level && myRoom.level.gameCursor instanceof LabCursor) { + setHotCursorEnabled(true); + } + setToolboxEnabled(true); + } + } + + public void setSolderPenEnabled(boolean enabled) { + if (null != this.menuItemSolderpen) { + this.menuItemSolderpen.setEnabled(enabled); + } + } + + public void selectSolderpen() { + if (null != this.menuItemSolderpen) { + this.menuItemSolderpen.setSelected(true); + this.setHotCursorEnabled(false); + setToolboxEnabled(false); + setFlipDeviceEnabled(true); + } + } + + public void setPaintbrushEnabled(boolean enabled) { + if (null != this.menuItemPaintbrush) { + this.menuItemPaintbrush.setEnabled(enabled); + setFlipDeviceEnabled(false); + } + } + + public void selectPaintBrush() { + if (null != this.menuItemPaintbrush) { + this.menuItemPaintbrush.setSelected(true); + this.setHotCursorEnabled(false); + this.setToolboxEnabled(false); + } + } + + + public void setRadioEnabled(boolean enabled) { + if (null != this.menuItemRadio) { + this.menuItemRadio.setEnabled(enabled); + } + } + + public void setRadioSelected(boolean selected) { + if (null != this.menuItemRadio) { + this.menuItemRadio.setSelected(selected); + } + } + + public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Save Level")) { FileDialog fd = new FileDialog(this, "Save Level", FileDialog.SAVE); @@ -95,14 +289,106 @@ public class DQ extends JFrame implements ActionListener { myRoom.SaveLevel(fd.getDirectory() + fd.getFile()); } } - - if (e.getActionCommand().equals("Main Menu")) { + else if (e.getActionCommand().equals("Cursor")) { + if (null != myRoom.level && null != myRoom.level.player && myRoom.level.player instanceof Avatar) { + Avatar playerAvatar = (Avatar) myRoom.level.player; + playerAvatar.handleGameCursor(); + } + } + else if (e.getActionCommand().equals("Solderpen")) { + // Handle Solderpen + if (null != myRoom.level && null != myRoom.level.player && myRoom.level.player instanceof Avatar) { + Avatar playerAvatar = (Avatar) myRoom.level.player; + playerAvatar.handleSolderPen(); + } + } + else if (e.getActionCommand().equals("Paintbrush")) { + // Handle Paintbrush + if (null != myRoom.level && null != myRoom.level.player && myRoom.level.player instanceof Avatar) { + Avatar playerAvatar = (Avatar) myRoom.level.player; + playerAvatar.handlePaintbrush(); + } + } + else if (e.getActionCommand().equals("Toolbox")) { + if (null != myRoom.level && null != myRoom.level.player && myRoom.level.player instanceof Avatar) { + Avatar playerAvatar = (Avatar) myRoom.level.player; + playerAvatar.handleToolbox(); + } + } + else if (e.getActionCommand().equals("Radio")) { + if (null != myRoom.level && null != myRoom.level.player && myRoom.level.player instanceof Avatar) { + Avatar playerAvatar = (Avatar) myRoom.level.player; + playerAvatar.handleRadio(); + } + } + else if (e.getActionCommand().equals("Rotate Part Clockwise")) { + // Rotate a part clockwise + if (null != myRoom.level && null != myRoom.level.player && myRoom.level.player instanceof Avatar) { + Avatar playerAvatar = (Avatar) myRoom.level.player; + playerAvatar.handleRotateDevice(1); + } + } + else if (e.getActionCommand().equals("Rotate Part Counter-clockwise")) { + // Rotate counter clockwise + if (null != myRoom.level && null != myRoom.level.player && myRoom.level.player instanceof Avatar) { + Avatar playerAvatar = (Avatar) myRoom.level.player; + playerAvatar.handleRotateDevice(-1); + } + } + else if (e.getActionCommand().equals("Hot Cursor")) { + if (null != myRoom.level && null != myRoom.level.player && myRoom.level.player instanceof Avatar) { + Avatar playerAvatar = (Avatar) myRoom.level.player; + playerAvatar.handleHotCursor(); + } + } + else if (e.getActionCommand().equals("Load Chip")) { + if (null != myRoom.level && null != myRoom.level.player && myRoom.level.player instanceof Avatar) { + Avatar playerAvatar = (Avatar) myRoom.level.player; + playerAvatar.handleLoadSmallChip(); + } + } + else if (e.getActionCommand().equals("Help")) { + if (null != myRoom.level && null != myRoom.level.player && myRoom.level.player instanceof Avatar) { + Avatar playerAvatar = (Avatar) myRoom.level.player; + playerAvatar.handleHelp(); + } + } + else if (e.getActionCommand().equals("Enter Robot")) { + if (null != myRoom.level && null != myRoom.level.player && myRoom.level.player instanceof Avatar) { + Avatar playerAvatar = (Avatar) myRoom.level.player; + playerAvatar.handleEnterRoom(); + } + } + else if (e.getActionCommand().equals("Exit Robot")) { + if (null != myRoom.level && null != myRoom.level.player && myRoom.level.player instanceof Avatar) { + Avatar playerAvatar = (Avatar) myRoom.level.player; + playerAvatar.handleExitRoom(); + } + } + else if (e.getActionCommand().equals("Flip Device/Wire")) { + if (null != myRoom.level && null != myRoom.level.player && myRoom.level.player instanceof Avatar) { + Avatar playerAvatar = (Avatar) myRoom.level.player; + playerAvatar.handleFlipDevice(); + } + } + else if (e.getActionCommand().equals("Main Menu")) { int n = JOptionPane.showConfirmDialog(this, "Do you want to quit this level?", "return to Main Menu", JOptionPane.YES_NO_OPTION); if (n == 0) { myRoom.level.Empty(); myRoom.level = new MainMenu(myRoom); myRoom.level.Init(); + setHotCursorEnabled(false); + setHotCursorSelected(false); + setRotateEnabled(false); + setLoadChipEnabled(false); + setPaintbrushEnabled(false); + setFlipDeviceEnabled(false); + setToolboxEnabled(false); + setSolderPenEnabled(false); + setRadioSelected(false); + setRadioEnabled(false); + selectCursor(); } } diff --git a/src/com/droidquest/RoomDisplay.java b/src/com/droidquest/RoomDisplay.java index c3766fc..4e933c9 100644 --- a/src/com/droidquest/RoomDisplay.java +++ b/src/com/droidquest/RoomDisplay.java @@ -20,7 +20,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; public class RoomDisplay extends JPanel { - public DQ dq; + public final DQ dq; Level level; public Timer timer; private int timerspeed = 128; @@ -36,7 +36,8 @@ public class RoomDisplay extends JPanel { return (true); } - public RoomDisplay() { + public RoomDisplay(final DQ dq) { + this.dq = dq; setSize(new Dimension(560, 384)); level = new MainMenu(this); level.Init(); @@ -188,6 +189,45 @@ public class RoomDisplay extends JPanel { level.roomdisplay.useSounds = tempsound; level.PlaySound(level.currentViewer.room, Level.TRANSPORTSOUND); + + + // Handle menu item initialization + if (level.gameCursor instanceof LabCursor) { + dq.setHotCursorSelected(false); + dq.setHotCursorEnabled(true); + } + else { + dq.setHotCursorSelected(false); + dq.setHotCursorEnabled(false); + } + + if(null == level.solderingPen) { + dq.setSolderPenEnabled(false); + } + else { + dq.setSolderPenEnabled(true); + } + + if(null == level.paintbrush) { + dq.setPaintbrushEnabled(false); + } + else { + dq.setPaintbrushEnabled(true); + } + + if(null == level.remote) { + dq.setRadioEnabled(false); + dq.setRadioSelected(false); + } + else { + dq.setRadioEnabled(true); + dq.setRadioSelected(true); + } + + // Always start with cursor + dq.selectCursor(); + + } Electricity(); for (int a = 0; a < level.items.size(); a++) { @@ -210,7 +250,7 @@ public class RoomDisplay extends JPanel { repaint(); for (int a = 0; a < level.sparks.size(); a++) { - Spark spark = (Spark) level.sparks.elementAt(a); + Spark spark = level.sparks.elementAt(a); spark.Age(); if (spark.age > 6) { level.sparks.removeElement(spark); @@ -284,7 +324,7 @@ public class RoomDisplay extends JPanel { // Paint Sparks for (int a = 0; a < level.sparks.size(); a++) { - Spark spark = (Spark) level.sparks.elementAt(a); + Spark spark = level.sparks.elementAt(a); if (spark.room == level.currentViewer.room) { spark.Draw(g2); } diff --git a/src/com/droidquest/avatars/Avatar.java b/src/com/droidquest/avatars/Avatar.java new file mode 100644 index 0000000..86d9d3f --- /dev/null +++ b/src/com/droidquest/avatars/Avatar.java @@ -0,0 +1,83 @@ +package com.droidquest.avatars; + +/** + * Interface to support handling a common interface for player types. + * Particularly, since SolderingPen needs to be a Device, this can + * be used to provide a player avatar contract. + */ +public interface Avatar { + + /** + * Handle change to game cursor. + * @return boolean whether the change was handled. + */ + public boolean handleGameCursor(); + + /** + * Handle change to solder pen. + * @return boolean whether the change was handled. + */ + public boolean handleSolderPen(); + + /** + * Handle opening / summoning the toolbox + * @return boolean whether the change was handled. + */ + public boolean handleToolbox(); + + /** + * Handle starting / stopping the remote. + * @return boolean whether the change was handled. + */ + public boolean handleRadio(); + + /** + * Handle rotating a Device object + * @param direction -1 for counter clockwise, 1 for clockwise + * @return boolean whether the change was handled. + */ + public boolean handleRotateDevice(int direction); + + /** + * Handle setting the cursor to hot. + * @return boolean whether the change was handled. + */ + public boolean handleHotCursor(); + + /** + * Handle transforming player to the paintbrush + * @return boolean whether the change was handled. + */ + public boolean handlePaintbrush(); + + /** + * Handle loading a small chip from a saved program. + * @return boolean whether the change was handled. + */ + public boolean handleLoadSmallChip(); + + /** + * Handle context specific help (including chip help) + * @return boolean whether the change was handled. + */ + public boolean handleHelp(); + + /** + * Handle entering an inner room (robot) + * @return boolean whether the change was handled. + */ + public boolean handleEnterRoom(); + + /** + * Handle exiting an inner room (robot) + * @return boolean whether the change was handled. + */ + public boolean handleExitRoom(); + + /** + * Handle flipping a device - either state or direction. + * @return boolean whether the change was handled. + */ + public boolean handleFlipDevice(); + +} diff --git a/src/com/droidquest/avatars/GameCursor.java b/src/com/droidquest/avatars/GameCursor.java index d2e5225..4ee9fa3 100644 --- a/src/com/droidquest/avatars/GameCursor.java +++ b/src/com/droidquest/avatars/GameCursor.java @@ -2,20 +2,13 @@ package com.droidquest.avatars; import com.droidquest.Room; import com.droidquest.RoomDisplay; -import com.droidquest.devices.Device; -import com.droidquest.devices.GenericChip; -import com.droidquest.devices.SmallChip; -import com.droidquest.items.GenericRobot; -import com.droidquest.items.Item; -import com.droidquest.items.ToolBox; -import com.droidquest.items.Train; +import com.droidquest.items.*; import javax.swing.*; import java.awt.*; -import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; -public class GameCursor extends Item { +public class GameCursor extends Player { private int walk = 0; // 0 or 1, used in animation private boolean outline; // Draw outline around GameCursor? @@ -268,74 +261,30 @@ public class GameCursor extends Item { } - public void MoveUp(boolean nudge) { - Item item = level.FindNearestItem(this); - if (item != null) { - if (item.InternalRoom != null) { - if (item.UpEnterOverlap(this)) { - int newX = 280; // 10 * 28 - int newY = 320; // 10 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - } - super.MoveUp(nudge); + @Override + public void moveUp(boolean nudge) { + super.moveUp(nudge); walk = 1 - walk; currentIcon = icons[0 + walk].getImage(); } - public void MoveDown(boolean nudge) { - Item item = level.FindNearestItem(this); - if (item != null) { - if (item.InternalRoom != null) { - if (item.DownEnterOverlap(this)) { - int newX = 280; // 10 * 28 - int newY = 0; // 0 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - } - super.MoveDown(nudge); + @Override + public void moveDown(boolean nudge) { + super.moveDown(nudge); walk = 1 - walk; currentIcon = icons[2 + walk].getImage(); } - public void MoveLeft(boolean nudge) { - Item item = level.FindNearestItem(this); - if (item != null) { - if (item.InternalRoom != null) { - if (item.LeftEnterOverlap(this)) { - int newX = 532; // 19 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - } - super.MoveLeft(nudge); + @Override + public void moveLeft(boolean nudge) { + super.moveLeft(nudge); walk = 1 - walk; currentIcon = icons[4 + walk].getImage(); } - public void MoveRight(boolean nudge) { - Item item = level.FindNearestItem(this); - if (item != null) { - if (item.InternalRoom != null) { - if (item.RightEnterOverlap(this)) { - int newX = 0; // 0 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - } - super.MoveRight(nudge); + @Override + public void moveRight(boolean nudge) { + super.moveRight(nudge); walk = 1 - walk; currentIcon = icons[6 + walk].getImage(); } @@ -352,303 +301,27 @@ public class GameCursor extends Item { return !i.getClass().toString().endsWith("Robot"); } - public boolean KeyUp(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_L) { - if (carrying != null) { - if (carrying instanceof SmallChip) { - FileDialog fd = new FileDialog(level.roomdisplay.dq, "Load Chip", FileDialog.LOAD); - fd.setDirectory("chips"); - fd.show(); - System.out.println("Dialog returned with " - + fd.getDirectory() - + fd.getFile()); - if (fd.getFile() != null) { - ((SmallChip) carrying).Empty(); - ((SmallChip) carrying).LoadChip(fd.getDirectory() + fd.getFile()); - } - } - } - } - if (e.getKeyCode() == KeyEvent.VK_S) { - if (level.solderingPen == null) { - return false; - } - if (carrying != null) { - Drops(); - } - level.solderingPen.x = x; - level.solderingPen.y = y; - level.solderingPen.room = room; - room = null; - if (level.currentViewer == level.player) { - level.currentViewer = level.solderingPen; - } - level.player = level.solderingPen; - if (level.remote != null) { - if (level.remote.carriedBy != null) { - level.remote.carriedBy = level.player; - } - } - } - if (e.getKeyCode() == KeyEvent.VK_R) { - if (level.remote == null) { - return false; - } - if (level.remote.carriedBy == null) { // Summon Remote - level.remote.x = 28; - level.remote.y = -20; - level.remote.carriedBy = level.player; - level.remote.room = level.player.room; - level.electricity = true; - } - else { // Hide Remote - level.remote.carriedBy = null; - level.remote.room = null; - level.electricity = false; - } - // if (carrying != null) - // Drops(); - // level.remote.x = x; - // level.remote.y = y; - // level.remote.room = room; - // room = null; - // if (level.currentViewer == level.player) - // level.currentViewer=level.remote; - // level.player = level.remote; - } - if (e.getKeyCode() == KeyEvent.VK_T) { - if (level.toolbox == null) { - if (carrying != null) { - Drops(); - } - level.toolbox = new ToolBox(x, y + 8, room); - level.items.addElement(level.toolbox); - ((ToolBox) level.toolbox).Toggle(); - PicksUp(level.toolbox); - } - if (level.toolbox.room != room) { - // Summon Toolbox - if (carrying != null) { - return false; - } - if (((ToolBox) level.toolbox).open) { - ((ToolBox) level.toolbox).Toggle(); - } - level.toolbox.room = room; - level.toolbox.x = x + 28; - level.toolbox.y = y + 6; - PicksUp(level.toolbox); - } - else { - ((ToolBox) level.toolbox).Toggle(); - } - } - if (e.getKeyCode() == KeyEvent.VK_SLASH) { - if (carrying != null) { - if (carrying instanceof GenericChip) { - ((GenericChip) carrying).ShowText(true); - return false; - } - } - if (level.helpCam == null) { - return false; - } - level.player = level.helpCam; - level.currentViewer = level.helpCam; - } - if (e.getKeyCode() == KeyEvent.VK_RIGHT) { - if (level.cheatmode) { - if (e.isShiftDown() && room != null) { - SetRoom(room.rightRoom); - } - } - if (carriedBy == null) { - MoveRight(e.isControlDown()); - } - repeating = 0; - return true; - } - if (e.getKeyCode() == KeyEvent.VK_LEFT) { - if (level.cheatmode) { - if (e.isShiftDown() && room != null) { - SetRoom(room.leftRoom); - } - } - if (carriedBy == null) { - MoveLeft(e.isControlDown()); - } - repeating = 0; - return true; - } - if (e.getKeyCode() == KeyEvent.VK_UP) { - if (level.cheatmode) { - if (e.isShiftDown() && room != null) { - SetRoom(room.upRoom); - } - } - if (carriedBy == null) { - MoveUp(e.isControlDown()); - } - repeating = 0; - return true; - } - if (e.getKeyCode() == KeyEvent.VK_DOWN) { - if (level.cheatmode) { - if (e.isShiftDown() && room != null) { - SetRoom(room.downRoom); - } - } - if (carriedBy == null) { - MoveDown(e.isControlDown()); - } - repeating = 0; - return true; - } - if (e.getKeyCode() == KeyEvent.VK_SPACE) { - { - Item item = level.FindNearestItem(level.gameCursor); - if (item != null) { - if (item instanceof Train) { - item.CanBePickedUp(this); - return false; - } - } - } - if (carrying != null) { - Drops(); - } - else { - Item item = level.FindNearestItem(level.gameCursor); - if (item != null) { - if (item.CanBePickedUp(level.gameCursor)) { - PicksUp(item); - } - } - } - outline = false; - return false; - } - if (e.getKeyCode() == KeyEvent.VK_CLOSE_BRACKET) { - if (carrying != null) { - if (carrying.isDevice()) { - ((Device) carrying).rotate(1); - } - } - return false; - } - if (e.getKeyCode() == KeyEvent.VK_OPEN_BRACKET) { - if (carrying != null) { - if (carrying.isDevice()) { - ((Device) carrying).rotate(-1); - } - } - return false; - } - if (e.getKeyCode() == KeyEvent.VK_E) { - Item item = level.FindNearestItem(this); - if (item != null) { - if (item.InternalRoom != null) { - if (Overlaps(item)) - // if (x>=item.x && y>=item.y - // && x+width <= item.x + item.width - // && y+height <= item.y + item.height) - { - if (!item.OverWall()) { - int newX = 280; // 10 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - } + @Override + protected boolean handleTrain() { + Item item = level.FindNearestItem(level.gameCursor); + if (item != null) { + if (item instanceof Train) { + item.CanBePickedUp(this); + return true; } } - if (e.getKeyCode() == KeyEvent.VK_X) { - if (room != null && room.portalItem != null) { - Dimension d = room.portalItem.GetXY(); - int newX = d.width - + room.portalItem.getWidth() / 2 - - width / 2; - int newY = d.height - + room.portalItem.getHeight() / 4 * 2 - - height / 2; - x = newX; - y = newY; - SetRoom(room.portalItem.room); - level.currentViewer = level.player; - } - } - if (e.getKeyCode() == KeyEvent.VK_F) { - if (carrying != null) { - if (carrying instanceof Device) { - ((Device) carrying).flip(); - } - } - } - if (e.getKeyCode() == KeyEvent.VK_M) { - Runtime runtime = Runtime.getRuntime(); - long freemem = runtime.freeMemory(); - long totalmem = runtime.totalMemory(); - System.out.println("Total Memory = " + totalmem - + ", (" + totalmem / 1024 + "K), (" - + totalmem / 1024 / 1024 + "M)"); - System.out.println("Free Memory = " + freemem - + ", (" + freemem / 1024 + "K), (" - + freemem / 1024 / 1024 + "M)"); - } - return false; } - public boolean KeyDown(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_RIGHT) { - repeating++; - if (repeating > 5) { - if (carriedBy == null) { - MoveRight(e.isControlDown()); - } - return true; - } - return false; - } - if (e.getKeyCode() == KeyEvent.VK_LEFT) { - repeating++; - if (repeating > 5) { - if (carriedBy == null) { - MoveLeft(e.isControlDown()); - } - return true; - } - return false; - } - if (e.getKeyCode() == KeyEvent.VK_UP) { - repeating++; - if (repeating > 5) { - if (carriedBy == null) { - MoveUp(e.isControlDown()); - } - return true; - } - return false; - } - if (e.getKeyCode() == KeyEvent.VK_DOWN) { - repeating++; - if (repeating > 5) { - if (carriedBy == null) { - MoveDown(e.isControlDown()); - } - return true; - } - return false; - } - if (e.getKeyCode() == KeyEvent.VK_SPACE) { - if (level.player == level.gameCursor) { - outline = true; - } - } - return false; + @Override + protected void setOutline(boolean outline) { + this.outline = outline; + } + + @Override + protected boolean isCheatMode() { + return level.cheatmode; } public void Animate() { @@ -692,38 +365,38 @@ public class GameCursor extends Item { } } if (dx > 0) { - MoveRight(dx); + moveRight(dx); } if (dx < 0) { - MoveLeft(-dx); + moveLeft(-dx); } if (dy > 0) { - MoveDown(dy); + moveDown(dy); } if (dy < 0) { - MoveUp(-dy); + moveUp(-dy); } } if (automove == 2) { walk = 1 - walk; if (autoX > 0) { currentIcon = icons[6 + walk].getImage(); - MoveRight(autoX); + moveRight(autoX); } if (autoX < 0) { currentIcon = icons[4 + walk].getImage(); - MoveLeft(-autoX); + moveLeft(-autoX); } if (autoY > 0) { currentIcon = icons[2 + walk].getImage(); - MoveDown(autoY); + moveDown(autoY); } if (autoY < 0) { currentIcon = icons[0 + walk].getImage(); - MoveUp(-autoY); + moveUp(-autoY); } } } diff --git a/src/com/droidquest/avatars/HelpCam.java b/src/com/droidquest/avatars/HelpCam.java index e6ee4fe..ecd5894 100644 --- a/src/com/droidquest/avatars/HelpCam.java +++ b/src/com/droidquest/avatars/HelpCam.java @@ -8,7 +8,7 @@ import java.awt.*; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; -public class HelpCam extends Item { +public class HelpCam extends Item implements Avatar { public HelpCam(Room r) { charge = 0; x = 28; @@ -38,4 +38,63 @@ public class HelpCam extends Item { } + @Override + public boolean handleGameCursor() { + return false; + } + + @Override + public boolean handleSolderPen() { + return false; + } + + @Override + public boolean handleToolbox() { + return false; + } + + @Override + public boolean handleRadio() { + return false; + } + + @Override + public boolean handleRotateDevice(int direction) { + return false; + } + + @Override + public boolean handleHotCursor() { + return false; + } + + @Override + public boolean handlePaintbrush() { + return false; + } + + @Override + public boolean handleLoadSmallChip() { + return false; + } + + @Override + public boolean handleHelp() { + return false; + } + + @Override + public boolean handleEnterRoom() { + return false; + } + + @Override + public boolean handleExitRoom() { + return false; + } + + @Override + public boolean handleFlipDevice() { + return false; + } } diff --git a/src/com/droidquest/avatars/LabCursor.java b/src/com/droidquest/avatars/LabCursor.java index aa167e1..edc6cfd 100644 --- a/src/com/droidquest/avatars/LabCursor.java +++ b/src/com/droidquest/avatars/LabCursor.java @@ -1,8 +1,6 @@ package com.droidquest.avatars; import com.droidquest.Room; -import com.droidquest.devices.Device; -import com.droidquest.devices.GenericChip; import com.droidquest.devices.SmallChip; import com.droidquest.items.GenericRobot; import com.droidquest.items.Item; @@ -10,14 +8,12 @@ import com.droidquest.items.ToolBox; import javax.swing.*; import java.awt.*; -import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; -public class LabCursor extends Item { +public class LabCursor extends Player { public boolean hot; - public LabCursor(int X, int Y, Room r) { x = X; y = Y; @@ -26,6 +22,10 @@ public class LabCursor extends Item { width = 28; height = 32; GenerateIcons(); + + // Lab cursor has a longer key repeat rate than the game cursor + setKeyRepeatRate(10); + } public void GenerateIcons() { @@ -63,359 +63,93 @@ public class LabCursor extends Item { return !(i instanceof GenericRobot); } - public boolean KeyUp(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_L) { - if (carrying != null) { - if (carrying instanceof SmallChip) { - FileDialog fd = new FileDialog(level.roomdisplay.dq, "Load Chip", FileDialog.LOAD); - fd.setDirectory("chips"); - fd.show(); - System.out.println("Dialog returned with " - + fd.getDirectory() - + fd.getFile()); - if (fd.getFile() != null) { - ((SmallChip) carrying).Empty(); - ((SmallChip) carrying).LoadChip(fd.getDirectory() + fd.getFile()); - } + + @Override + protected boolean handleSaveSmallChip() { + if (carrying != null) { + if (carrying instanceof SmallChip) { + FileDialog fd = new FileDialog(level.roomdisplay.dq, "Save Chip", FileDialog.SAVE); + fd.setDirectory("chips"); + fd.show(); + System.out.println("Dialog returned with " + + fd.getDirectory() + + fd.getFile()); + if (fd.getFile() != null) { + ((SmallChip) carrying).SaveChip(fd.getDirectory() + fd.getFile()); } + return true; } } - else if (e.getKeyCode() == KeyEvent.VK_H) { - hot = !hot; - if (hot) { - currentIcon = icons[1].getImage(); - } - else { - currentIcon = icons[0].getImage(); - } + return false; + } + + + @Override + public boolean handleHotCursor() { + hot = !hot; + if (hot) { + currentIcon = icons[1].getImage(); + } + else { + currentIcon = icons[0].getImage(); + } + + this.room.level.roomdisplay.dq.setHotCursorSelected(hot); + + return true; + } + + @Override + public boolean handlePaintbrush() { + if (level.paintbrush == null) { return false; } - else if (e.getKeyCode() == KeyEvent.VK_S) { - if (level.solderingPen == null) { - return false; - } - if (carrying != null) { - if (carrying instanceof SmallChip) { - FileDialog fd = new FileDialog(level.roomdisplay.dq, "Save Chip", FileDialog.SAVE); - fd.setDirectory("chips"); - fd.show(); - System.out.println("Dialog returned with " - + fd.getDirectory() - + fd.getFile()); - if (fd.getFile() != null) { - ((SmallChip) carrying).SaveChip(fd.getDirectory() + fd.getFile()); - } - return false; - } - } - if (carrying != null) { - Drops(); - } - level.solderingPen.x = x; - level.solderingPen.y = y; - level.solderingPen.room = room; - room = null; - if (level.currentViewer == level.player) { - level.currentViewer = level.solderingPen; - } - level.player = level.solderingPen; - if (level.remote != null) { - if (level.remote.carriedBy != null) { - level.remote.carriedBy = level.player; - } - } + if (carrying != null) { + Drops(); } - else if (e.getKeyCode() == KeyEvent.VK_R) { - if (level.remote == null) { - return false; - } - if (level.remote.carriedBy == null) { // Summon Remote - level.remote.x = 28; - level.remote.y = -20; - level.remote.carriedBy = level.player; - level.remote.room = level.player.room; - level.electricity = true; - } - else { // Hide Remote - level.remote.carriedBy = null; - level.remote.room = null; - level.electricity = false; - } -// if (carrying != null) -// Drops(); -// level.remote.x = x; -// level.remote.y = y; -// level.remote.room = room; -// room = null; -// if (level.currentViewer == level.player) -// level.currentViewer=level.remote; -// level.player = level.remote; + level.paintbrush.x = (x / 28) * 28; + level.paintbrush.y = (y / 32) * 32; + level.paintbrush.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.paintbrush; } - else if (e.getKeyCode() == KeyEvent.VK_P) { - if (level.paintbrush == null) { - return false; - } + level.player = level.paintbrush; + handleRemote(); + + level.roomdisplay.dq.selectPaintBrush(); + + return true; + } + + @Override + public boolean handleToolbox() { + if (level.toolbox == null) { + return false; + } + if (level.toolbox.room != room) { + // Summon Toolbox if (carrying != null) { - Drops(); - } - level.paintbrush.x = (x / 28) * 28; - level.paintbrush.y = (y / 32) * 32; - level.paintbrush.room = room; - room = null; - if (level.currentViewer == level.player) { - level.currentViewer = level.paintbrush; - } - level.player = level.paintbrush; - } - else if (e.getKeyCode() == KeyEvent.VK_T) { - if (level.toolbox == null) { return false; } - if (level.toolbox.room != room) { - // Summon Toolbox - if (carrying != null) { - return false; - } - if (((ToolBox) level.toolbox).open) { - ((ToolBox) level.toolbox).Toggle(); - } - level.toolbox.room = room; - level.toolbox.x = x + 28; - level.toolbox.y = y + 6; - PicksUp(level.toolbox); - } - else { + if (((ToolBox) level.toolbox).open) { ((ToolBox) level.toolbox).Toggle(); } + level.toolbox.room = room; + level.toolbox.x = x + 28; + level.toolbox.y = y + 6; + PicksUp(level.toolbox); } - else if (e.getKeyCode() == KeyEvent.VK_SLASH) { - if (carrying != null) { - if (carrying instanceof GenericChip) { - ((GenericChip) carrying).ShowText(true); - return false; - } - } - if (level.helpCam == null) { - return false; - } - level.player = level.helpCam; - level.currentViewer = level.helpCam; + else { + ((ToolBox) level.toolbox).Toggle(); } - else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { - if (carriedBy == null) { - MoveRight(e.isControlDown()); - } - repeating = 0; - return true; - } - else if (e.getKeyCode() == KeyEvent.VK_LEFT) { - if (carriedBy == null) { - MoveLeft(e.isControlDown()); - } - repeating = 0; - return true; - } - else if (e.getKeyCode() == KeyEvent.VK_UP) { - if (carriedBy == null) { - MoveUp(e.isControlDown()); - } - repeating = 0; - return true; - } - else if (e.getKeyCode() == KeyEvent.VK_DOWN) { - if (carriedBy == null) { - MoveDown(e.isControlDown()); - } - repeating = 0; - return true; - } - else if (e.getKeyCode() == KeyEvent.VK_SPACE) { - if (carrying != null) { - Drops(); - } - else { - Item item = level.FindNearestItem(level.gameCursor); - if (item != null) { - if (item.CanBePickedUp(level.gameCursor)) { - PicksUp(item); - } - } - } - return false; - } - else if (e.getKeyCode() == KeyEvent.VK_CLOSE_BRACKET) { - if (carrying != null) { - if (carrying.isDevice()) { - ((Device) carrying).rotate(1); - } - } - return false; - } - else if (e.getKeyCode() == KeyEvent.VK_OPEN_BRACKET) { - if (carrying != null) { - if (carrying.isDevice()) { - ((Device) carrying).rotate(-1); - } - } - return false; - } - else if (e.getKeyCode() == KeyEvent.VK_E) { - Item item = level.FindNearestItem(this); - if (item != null) { - if (item.InternalRoom != null) { - if (Overlaps(item)) { - if (!item.OverWall()) { - int newX = 280; // 10 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - } - } - } - else if (e.getKeyCode() == KeyEvent.VK_X) { - if (room != null && room.portalItem != null) { - Dimension d = room.portalItem.GetXY(); - int newX = d.width - + room.portalItem.getWidth() / 2 - - width / 2; - int newY = d.height - + room.portalItem.getHeight() / 4 * 2 - - height / 2; - x = newX; - y = newY; - SetRoom(room.portalItem.room); - level.currentViewer = level.player; - } - } else if (e.getKeyCode() == KeyEvent.VK_F) { - if (carrying != null) { - if (carrying instanceof Device) { - ((Device) carrying).flip(); - } - } - } else if (e.getKeyCode() == KeyEvent.VK_M) { - Runtime runtime = Runtime.getRuntime(); - long freemem = runtime.freeMemory(); - long totalmem = runtime.totalMemory(); - System.out.println("Total Memory = " + totalmem - + ", (" + totalmem / 1024 + "K), (" - + totalmem / 1024 / 1024 + "M)"); - System.out.println("Free Memory = " + freemem - + ", (" + freemem / 1024 + "K), (" - + freemem / 1024 / 1024 + "M)"); - } - - return false; + return true; } - public boolean KeyDown(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_RIGHT) { - repeating++; - if (repeating > 10) { - if (carriedBy == null) { - MoveRight(e.isControlDown()); - } - return true; - } - return false; - } - if (e.getKeyCode() == KeyEvent.VK_LEFT) { - repeating++; - if (repeating > 10) { - if (carriedBy == null) { - MoveLeft(e.isControlDown()); - } - return true; - } - return false; - } - if (e.getKeyCode() == KeyEvent.VK_UP) { - repeating++; - if (repeating > 10) { - if (carriedBy == null) { - MoveUp(e.isControlDown()); - } - return true; - } - return false; - } - if (e.getKeyCode() == KeyEvent.VK_DOWN) { - repeating++; - if (repeating > 10) { - if (carriedBy == null) { - MoveDown(e.isControlDown()); - } - return true; - } - return false; - } - return false; - } - public void MoveUp(boolean nudge) { - Item item = level.FindNearestItem(this); - if (item != null) { - if (item.InternalRoom != null) { - if (item.UpEnterOverlap(this)) { - int newX = 280; // 10 * 28 - int newY = 320; // 10 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - } - super.MoveUp(nudge); - } - public void MoveDown(boolean nudge) { - Item item = level.FindNearestItem(this); - if (item != null) { - if (item.InternalRoom != null) { - if (item.DownEnterOverlap(this)) { - int newX = 280; // 10 * 28 - int newY = 0; // 0 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - } - super.MoveDown(nudge); - } - public void MoveLeft(boolean nudge) { - Item item = level.FindNearestItem(this); - if (item != null) { - if (item.InternalRoom != null) { - if (item.LeftEnterOverlap(this)) { - int newX = 532; // 19 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - } - super.MoveLeft(nudge); - } - public void MoveRight(boolean nudge) { - Item item = level.FindNearestItem(this); - if (item != null) { - if (item.InternalRoom != null) { - if (item.RightEnterOverlap(this)) { - int newX = 0; // 0 * 28 - int newY = 176; // 5.5 * 32 - x = newX; - y = newY; - SetRoom(item.InternalRoom); - } - } - } - super.MoveRight(nudge); - } + } \ No newline at end of file diff --git a/src/com/droidquest/avatars/PaintBrush.java b/src/com/droidquest/avatars/PaintBrush.java index e8c31c8..16b11c6 100644 --- a/src/com/droidquest/avatars/PaintBrush.java +++ b/src/com/droidquest/avatars/PaintBrush.java @@ -9,10 +9,9 @@ import com.droidquest.materials.RobotBlocker; import javax.swing.*; import java.awt.*; -import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; -public class PaintBrush extends Item { +public class PaintBrush extends Player { // The Paintbrush works just like the original, except it allows // differnt color paints for differnt materials. Pressing 'P' as the // Paintbrush switches the Material Settings. @@ -34,6 +33,11 @@ public class PaintBrush extends Item { GenerateIcons(); } + @Override + protected boolean isCheatMode() { + return true; + } + public void GenerateIcons() { icons = new ImageIcon[5]; icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); @@ -119,115 +123,97 @@ public class PaintBrush extends Item { } - public boolean KeyUp(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_C) { - level.gameCursor.x = x; - level.gameCursor.y = y; - level.gameCursor.room = room; - room = null; - if (level.currentViewer == level.player) { - level.currentViewer = level.gameCursor; - } - level.player = level.gameCursor; - } - if (e.getKeyCode() == KeyEvent.VK_S) { - if (level.solderingPen == null) { - return false; - } - level.solderingPen.x = x; - level.solderingPen.y = y; - level.solderingPen.room = room; - room = null; - if (level.currentViewer == level.player) { - level.currentViewer = level.solderingPen; - } - level.player = level.solderingPen; - } - if (e.getKeyCode() == KeyEvent.VK_R) { - if (level.remote == null) { - return false; - } - level.remote.x = x; - level.remote.y = y; - level.remote.room = room; - room = null; - if (level.currentViewer == level.player) { - level.currentViewer = level.remote; - } - level.player = level.remote; - } - if (e.getKeyCode() == KeyEvent.VK_SLASH) { - if (level.helpCam == null) { - return false; - } - level.player = level.helpCam; - level.currentViewer = level.helpCam; - } - if (e.getKeyCode() == KeyEvent.VK_RIGHT) { - if (e.isShiftDown()) { - SetRoom(room.rightRoom); - } - if (carriedBy == null) { - MoveRight(e.isControlDown()); - } - repeating = 0; - return true; - } - if (e.getKeyCode() == KeyEvent.VK_LEFT) { - if (e.isShiftDown()) { - SetRoom(room.leftRoom); - } - if (carriedBy == null) { - MoveLeft(e.isControlDown()); - } - repeating = 0; - return true; - } - if (e.getKeyCode() == KeyEvent.VK_UP) { - if (e.isShiftDown()) { - SetRoom(room.upRoom); - } - if (carriedBy == null) { - MoveUp(e.isControlDown()); - } - repeating = 0; - return true; - } - if (e.getKeyCode() == KeyEvent.VK_DOWN) { - if (e.isShiftDown()) { - SetRoom(room.downRoom); - } - if (carriedBy == null) { - MoveDown(e.isControlDown()); - } - repeating = 0; - return true; - } - if (e.getKeyCode() == KeyEvent.VK_P) { - paintIndex++; - if (paintIndex == 5) { - paintIndex = 0; - } - matIndex = level.materials.indexOf(paintMats[paintIndex]); - currentIcon = icons[paintIndex].getImage(); - } - if (e.getKeyCode() == KeyEvent.VK_SPACE) { - if (!room.editable) { - return false; - } - int bigX = (x + 14) / 28; - int bigY = (y + 16) / 32; - if (room.RoomArray[bigY][bigX] == emptyIndex) { - room.SetMaterial(bigX, bigY, matIndex); - } - else { - room.SetMaterial(bigX, bigY, emptyIndex); - } - } + @Override + public boolean handleHelp() { + handleGameCursor(); + return super.handleHelp(); + } + + @Override + public boolean handleLoadSmallChip() { return false; } - public void MoveUp(boolean nudge) { + @Override + public boolean handlePaintbrush() { + paintIndex++; + if (paintIndex == 5) { + paintIndex = 0; + } + matIndex = level.materials.indexOf(paintMats[paintIndex]); + currentIcon = icons[paintIndex].getImage(); + return true; + } + + @Override + public boolean handleToolbox() { + // Paintbrush doesn't handle toolbox + return false; + } + + @Override + public boolean handlePickupDrop() { + // Paintbrush uses space for painting instead of pickup/drop + if (!room.editable) { + return false; + } + int bigX = (x + 14) / 28; + int bigY = (y + 16) / 32; + if (room.RoomArray[bigY][bigX] == emptyIndex) { + room.SetMaterial(bigX, bigY, matIndex); + } + else { + room.SetMaterial(bigX, bigY, emptyIndex); + } + return true; + } + + @Override + public boolean handleEnterRoom() { + return false; + } + + @Override + public boolean handleExitRoom() { + return false; + } + + @Override + public boolean handleFlipDevice() { + return false; + } + + @Override + public boolean handleRotateDevice(int direction) { + return false; + } + + + @Override + public boolean handleGameCursor() { + level.gameCursor.x = x; + level.gameCursor.y = y; + level.gameCursor.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.gameCursor; + } + level.player = level.gameCursor; + + handleRemote(); + + level.roomdisplay.dq.selectCursor(); + + return true; + } + + + @Override + protected boolean handleRepeatSpace() { + return false; + } + + public void moveUp(boolean nudge) { int dist = 32; if (nudge) { dist = 2; @@ -245,7 +231,7 @@ public class PaintBrush extends Item { } } - public void MoveDown(boolean nudge) { + public void moveDown(boolean nudge) { int dist = 32; if (nudge) { dist = 2; @@ -263,7 +249,7 @@ public class PaintBrush extends Item { } } - public void MoveLeft(boolean nudge) { + public void moveLeft(boolean nudge) { int dist = 28; if (nudge) { dist = 2; @@ -281,7 +267,7 @@ public class PaintBrush extends Item { } } - public void MoveRight(boolean nudge) { + public void moveRight(boolean nudge) { int dist = 28; if (nudge) { dist = 2; diff --git a/src/com/droidquest/avatars/Player.java b/src/com/droidquest/avatars/Player.java new file mode 100644 index 0000000..a145678 --- /dev/null +++ b/src/com/droidquest/avatars/Player.java @@ -0,0 +1,562 @@ +package com.droidquest.avatars; + +import com.droidquest.devices.Device; +import com.droidquest.devices.GenericChip; +import com.droidquest.devices.SmallChip; +import com.droidquest.items.Item; +import com.droidquest.items.ToolBox; + +import java.awt.*; +import java.awt.event.KeyEvent; + +/** + * Parent class to handle common Player functions. + */ +public class Player extends Item implements Avatar { + + private int keyRepeatRate = 5; + + + protected boolean handleSaveSmallChip() { + return false; + } + + public void handleRemote() { + if (level.remote != null) { + if (level.remote.carriedBy != null) { + level.remote.carriedBy = level.player; + } + } + } + + public boolean handleSolderPen() { + if (level.solderingPen == null) { + return false; + } + if (carrying != null) { + if (handleSaveSmallChip()) { + // Actually a save small chip command, + // skip solder pen + return true; + } + Drops(); + } + level.solderingPen.x = x; + level.solderingPen.y = y; + level.solderingPen.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.solderingPen; + } + level.player = level.solderingPen; + + handleRemote(); + + level.roomdisplay.dq.selectSolderpen(); + + return true; + } + + public boolean handleRadio() { + if (level.remote == null) { + return false; + } + if (level.remote.carriedBy == null) { // Summon Remote + level.remote.x = 28; + level.remote.y = -20; + level.remote.carriedBy = level.player; + level.remote.room = level.player.room; + level.electricity = true; + + level.roomdisplay.dq.setRadioSelected(true); + } + else { // Hide Remote + level.remote.carriedBy = null; + level.remote.room = null; + level.electricity = false; + + level.roomdisplay.dq.setRadioSelected(false); + } + return true; + } + + public boolean handleHelp() { + if (carrying != null) { + if (carrying instanceof GenericChip) { + ((GenericChip) carrying).ShowText(true); + return false; + } + } + if (level.helpCam == null) { + return false; + } + level.player = level.helpCam; + level.currentViewer = level.helpCam; + return true; + } + + public boolean handleToolbox() { + if (level.toolbox == null) { + if (carrying != null) { + Drops(); + } + level.toolbox = new ToolBox(x, y + 8, room); + level.items.addElement(level.toolbox); + ((ToolBox) level.toolbox).Toggle(); + PicksUp(level.toolbox); + } + if (level.toolbox.room != room) { + // Summon Toolbox + if (carrying != null) { + return false; + } + if (((ToolBox) level.toolbox).open) { + ((ToolBox) level.toolbox).Toggle(); + } + level.toolbox.room = room; + level.toolbox.x = x + 28; + level.toolbox.y = y + 6; + PicksUp(level.toolbox); + } + else { + ((ToolBox) level.toolbox).Toggle(); + } + return true; + } + + + public boolean handleLoadSmallChip() { + if (carrying != null) { + if (carrying instanceof SmallChip) { + FileDialog fd = new FileDialog(level.roomdisplay.dq, "Load Chip", FileDialog.LOAD); + fd.setDirectory("chips"); + fd.show(); + System.out.println("Dialog returned with " + + fd.getDirectory() + + fd.getFile()); + if (fd.getFile() != null) { + ((SmallChip) carrying).Empty(); + ((SmallChip) carrying).LoadChip(fd.getDirectory() + fd.getFile()); + } + return true; + } + } + return false; + } + + protected boolean handleTrain() { + return false; + } + + @Override + public void PicksUp(Item item) { + super.PicksUp(item); + if (carrying instanceof SmallChip) { + level.roomdisplay.dq.setLoadChipEnabled(true); + } + else { + level.roomdisplay.dq.setLoadChipEnabled(false); + + if (carrying.isDevice()) { + level.roomdisplay.dq.setRotateEnabled(true); + level.roomdisplay.dq.setFlipDeviceEnabled(true); + } + else { + level.roomdisplay.dq.setRotateEnabled(false); + level.roomdisplay.dq.setFlipDeviceEnabled(false); + } + } + } + + @Override + public void Drops() { + super.Drops(); + level.roomdisplay.dq.setRotateEnabled(false); + level.roomdisplay.dq.setLoadChipEnabled(false); + level.roomdisplay.dq.setFlipDeviceEnabled(false); + } + + public boolean handlePickupDrop() { + if (handleTrain()) { + return false; + } + if (carrying != null) { + Drops(); + } + else { + Item item = level.FindNearestItem(level.gameCursor); + if (item != null) { + if (item.CanBePickedUp(level.gameCursor)) { + PicksUp(item); + } + } + } + setOutline(false); + return true; + } + + // Default implementation doesn't do anything, + // needed by GameCursor to set outline + protected void setOutline(boolean outline) { + } + + public boolean handleRotateDevice(int direction) { + if (carrying != null) { + if (carrying.isDevice()) { + ((Device) carrying).rotate(direction); + } + } + return true; + } + + public boolean handleEnterRoom() { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (Overlaps(item)) { + if (!item.OverWall()) { + int newX = 280; // 10 * 28 + int newY = 176; // 5.5 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + return true; + } + } + } + } + return false; + } + + public boolean handleExitRoom() { + if (room != null && room.portalItem != null) { + Dimension d = room.portalItem.GetXY(); + int newX = d.width + + room.portalItem.getWidth() / 2 + - width / 2; + int newY = d.height + + room.portalItem.getHeight() / 4 * 2 + - height / 2; + x = newX; + y = newY; + SetRoom(room.portalItem.room); + level.currentViewer = level.player; + return true; + } + return false; + } + + public boolean handleFlipDevice() { + if (carrying != null) { + if (carrying instanceof Device) { + ((Device) carrying).flip(); + } + } + return true; + } + + protected boolean handleMemory() { + Runtime runtime = Runtime.getRuntime(); + long freemem = runtime.freeMemory(); + long totalmem = runtime.totalMemory(); + System.out.println("Total Memory = " + totalmem + + ", (" + totalmem / 1024 + "K), (" + + totalmem / 1024 / 1024 + "M)"); + System.out.println("Free Memory = " + freemem + + ", (" + freemem / 1024 + "K), (" + + freemem / 1024 / 1024 + "M)"); + return true; + } + + protected boolean isCheatMode() { + return false; + } + + public boolean handleMoveDown(boolean isShiftDown, boolean isControlDown) { + if (isCheatMode()) { + if (isShiftDown && room != null) { + SetRoom(room.downRoom); + } + } + if (carriedBy == null) { + moveDown(isControlDown); + } + repeating = 0; + return true; + } + + public boolean handleMoveUp(boolean isShiftDown, boolean isControlDown) { + if (isCheatMode()) { + if (isShiftDown && room != null) { + SetRoom(room.upRoom); + } + } + if (carriedBy == null) { + moveUp(isControlDown); + } + repeating = 0; + return true; + } + + public boolean handleMoveLeft(boolean isShiftDown, boolean isControlDown) { + if (isCheatMode()) { + if (isShiftDown && room != null) { + SetRoom(room.leftRoom); + } + } + if (carriedBy == null) { + moveLeft(isControlDown); + } + repeating = 0; + return true; + } + + public boolean handleMoveRight(boolean isShiftDown, boolean isControlDown) { + if (isCheatMode()) { + if (isShiftDown && room != null) { + SetRoom(room.rightRoom); + } + } + if (carriedBy == null) { + moveRight(isControlDown); + } + repeating = 0; + return true; + } + + public boolean handleHotCursor() { + return false; + } + + public boolean handlePaintbrush() { + return false; + } + + // Default assume that we are already a game cursor + public boolean handleGameCursor() { + return false; + } + + public boolean KeyUp(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_L && handleLoadSmallChip()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_C && handleGameCursor()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_H && handleHotCursor()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_S && handleSolderPen()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_R && handleRadio()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_P && handlePaintbrush()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_T && handleToolbox()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_SLASH && handleHelp()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_RIGHT && handleMoveRight(e.isShiftDown(), e.isControlDown())) { + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_LEFT && handleMoveLeft(e.isShiftDown(), e.isControlDown())) { + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_UP && handleMoveUp(e.isShiftDown(), e.isControlDown())) { + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_DOWN && handleMoveDown(e.isShiftDown(), e.isControlDown())) { + return true; + } + else if (e.getKeyCode() == KeyEvent.VK_SPACE && handlePickupDrop()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_CLOSE_BRACKET && handleRotateDevice(1)) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_OPEN_BRACKET && handleRotateDevice(-1)) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_E && handleEnterRoom()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_X && handleExitRoom()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_F && handleFlipDevice()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_M && handleMemory()) { + return false; + } + + return false; + } + + protected boolean handleRepeatRight(boolean isControlDown) { + repeating++; + if (repeating > getKeyRepeatRate()) { + if (carriedBy == null) { + moveRight(isControlDown); + } + return true; + } + return false; + + } + + protected boolean handleRepeatLeft(boolean isControlDown) { + repeating++; + if (repeating > getKeyRepeatRate()) { + if (carriedBy == null) { + moveLeft(isControlDown); + } + return true; + } + return false; + } + + protected boolean handleRepeatUp(boolean isControlDown) { + repeating++; + if (repeating > getKeyRepeatRate()) { + if (carriedBy == null) { + moveUp(isControlDown); + } + return true; + } + return false; + } + + protected boolean handleRepeatDown(boolean isControlDown) { + repeating++; + if (repeating > getKeyRepeatRate()) { + if (carriedBy == null) { + moveDown(isControlDown); + } + return true; + } + return false; + + } + + protected boolean handleRepeatSpace() { + if (level.player == level.gameCursor) { + setOutline(true); + return true; + } + return false; + } + + public boolean KeyDown(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + if (handleRepeatRight(e.isControlDown())) { + return true; + } + } + else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + if (handleRepeatLeft(e.isControlDown())) { + return true; + } + } + else if (e.getKeyCode() == KeyEvent.VK_UP) { + if (handleRepeatUp(e.isControlDown())) { + return true; + } + } + else if (e.getKeyCode() == KeyEvent.VK_DOWN) { + if (handleRepeatDown(e.isControlDown())) { + return true; + } + } + if (e.getKeyCode() == KeyEvent.VK_SPACE) { + if (handleRepeatSpace()) { + return false; + } + } + return false; + } + + + public int getKeyRepeatRate() { + return keyRepeatRate; + } + + public void setKeyRepeatRate(int keyRepeatRate) { + this.keyRepeatRate = keyRepeatRate; + } + + @Override + public void moveRight(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.RightEnterOverlap(this)) { + int newX = 0; // 0 * 28 + int newY = 176; // 5.5 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.moveRight(nudge); + } + + @Override + public void moveLeft(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.LeftEnterOverlap(this)) { + int newX = 532; // 19 * 28 + int newY = 176; // 5.5 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.moveLeft(nudge); + } + + @Override + public void moveDown(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.DownEnterOverlap(this)) { + int newX = 280; // 10 * 28 + int newY = 0; // 0 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.moveDown(nudge); + } + + @Override + public void moveUp(boolean nudge) { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (item.UpEnterOverlap(this)) { + int newX = 280; // 10 * 28 + int newY = 320; // 10 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + } + } + } + super.moveUp(nudge); + } + +} diff --git a/src/com/droidquest/avatars/Remote.java b/src/com/droidquest/avatars/Remote.java index fcbb215..564b18b 100644 --- a/src/com/droidquest/avatars/Remote.java +++ b/src/com/droidquest/avatars/Remote.java @@ -7,7 +7,7 @@ import java.awt.*; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; -public class Remote extends Item { +public class Remote extends Item implements Avatar { public Remote() { width = 4; height = 20; @@ -98,28 +98,28 @@ public class Remote extends Item { } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { if (carriedBy == null) { - MoveRight(e.isControlDown()); + moveRight(e.isControlDown()); } repeating = 0; return true; } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { if (carriedBy == null) { - MoveLeft(e.isControlDown()); + moveLeft(e.isControlDown()); } repeating = 0; return true; } else if (e.getKeyCode() == KeyEvent.VK_UP) { if (carriedBy == null) { - MoveUp(e.isControlDown()); + moveUp(e.isControlDown()); } repeating = 0; return true; } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { if (carriedBy == null) { - MoveDown(e.isControlDown()); + moveDown(e.isControlDown()); } repeating = 0; return true; @@ -134,7 +134,7 @@ public class Remote extends Item { if (e.getKeyCode() == KeyEvent.VK_RIGHT) { repeating++; if (repeating > 10) { - MoveRight(e.isControlDown()); + moveRight(e.isControlDown()); return true; } return false; @@ -142,7 +142,7 @@ public class Remote extends Item { else if (e.getKeyCode() == KeyEvent.VK_LEFT) { repeating++; if (repeating > 10) { - MoveLeft(e.isControlDown()); + moveLeft(e.isControlDown()); return true; } return false; @@ -150,7 +150,7 @@ public class Remote extends Item { else if (e.getKeyCode() == KeyEvent.VK_UP) { repeating++; if (repeating > 10) { - MoveUp(e.isControlDown()); + moveUp(e.isControlDown()); return true; } return false; @@ -158,7 +158,7 @@ public class Remote extends Item { else if (e.getKeyCode() == KeyEvent.VK_DOWN) { repeating++; if (repeating > 10) { - MoveDown(e.isControlDown()); + moveDown(e.isControlDown()); return true; } return false; @@ -166,7 +166,7 @@ public class Remote extends Item { return false; } - public void MoveUp(boolean nudge) { + public void moveUp(boolean nudge) { Item item = level.FindNearestItem(this); if (item != null) { if (item.InternalRoom != null) { @@ -179,10 +179,10 @@ public class Remote extends Item { } } } - super.MoveUp(nudge); + super.moveUp(nudge); } - public void MoveDown(boolean nudge) { + public void moveDown(boolean nudge) { Item item = level.FindNearestItem(this); if (item != null) { if (item.InternalRoom != null) { @@ -195,10 +195,10 @@ public class Remote extends Item { } } } - super.MoveDown(nudge); + super.moveDown(nudge); } - public void MoveLeft(boolean nudge) { + public void moveLeft(boolean nudge) { Item item = level.FindNearestItem(this); if (item != null) { if (item.InternalRoom != null) { @@ -211,10 +211,10 @@ public class Remote extends Item { } } } - super.MoveLeft(nudge); + super.moveLeft(nudge); } - public void MoveRight(boolean nudge) { + public void moveRight(boolean nudge) { Item item = level.FindNearestItem(this); if (item != null) { if (item.InternalRoom != null) { @@ -227,7 +227,66 @@ public class Remote extends Item { } } } - super.MoveRight(nudge); + super.moveRight(nudge); } + @Override + public boolean handleGameCursor() { + return false; + } + + @Override + public boolean handleSolderPen() { + return false; + } + + @Override + public boolean handleToolbox() { + return false; + } + + @Override + public boolean handleRadio() { + return false; + } + + @Override + public boolean handleRotateDevice(int direction) { + return false; + } + + @Override + public boolean handleHotCursor() { + return false; + } + + @Override + public boolean handlePaintbrush() { + return false; + } + + @Override + public boolean handleLoadSmallChip() { + return false; + } + + @Override + public boolean handleHelp() { + return false; + } + + @Override + public boolean handleEnterRoom() { + return false; + } + + @Override + public boolean handleExitRoom() { + return false; + } + + @Override + public boolean handleFlipDevice() { + return false; + } } diff --git a/src/com/droidquest/avatars/SolderingPen.java b/src/com/droidquest/avatars/SolderingPen.java index c5e43ec..a82d041 100644 --- a/src/com/droidquest/avatars/SolderingPen.java +++ b/src/com/droidquest/avatars/SolderingPen.java @@ -13,7 +13,7 @@ import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; -public class SolderingPen extends Device { +public class SolderingPen extends Device implements Avatar { private boolean hot; private Port currentPort = null; // Port that Soldering pen is currently over @@ -140,7 +140,7 @@ public class SolderingPen extends Device { } } - public void MoveUp(boolean nudge) { + public void moveUp(boolean nudge) { Room tempRoom = room; Item item = level.FindNearestItem(this); if (item != null) { @@ -154,7 +154,7 @@ public class SolderingPen extends Device { } } } - super.MoveUp(nudge); + super.moveUp(nudge); if (tempRoom != room && ports[0].myWire != null) { ports[0].myWire.Remove(); } @@ -162,7 +162,7 @@ public class SolderingPen extends Device { CheckPort(); } - public void MoveDown(boolean nudge) { + public void moveDown(boolean nudge) { Room tempRoom = room; Item item = level.FindNearestItem(this); if (item != null) { @@ -176,14 +176,14 @@ public class SolderingPen extends Device { } } } - super.MoveDown(nudge); + super.moveDown(nudge); if (tempRoom != room && ports[0].myWire != null) { ports[0].myWire.Remove(); } CheckPort(); } - public void MoveLeft(boolean nudge) { + public void moveLeft(boolean nudge) { Room tempRoom = room; Item item = level.FindNearestItem(this); if (item != null) { @@ -197,14 +197,14 @@ public class SolderingPen extends Device { } } } - super.MoveLeft(nudge); + super.moveLeft(nudge); if (tempRoom != room && ports[0].myWire != null) { ports[0].myWire.Remove(); } CheckPort(); } - public void MoveRight(boolean nudge) { + public void moveRight(boolean nudge) { Room tempRoom = room; Item item = level.FindNearestItem(this); if (item != null) { @@ -218,7 +218,7 @@ public class SolderingPen extends Device { } } } - super.MoveRight(nudge); + super.moveRight(nudge); if (tempRoom != room && ports[0].myWire != null) { ports[0].myWire.Remove(); } @@ -296,89 +296,42 @@ public class SolderingPen extends Device { } public boolean KeyUp(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_C) { - if (ports[0].myWire != null) { - ports[0].myWire.Remove(); - } - level.gameCursor.x = x; - level.gameCursor.y = y; - level.gameCursor.room = room; - room = null; - if (level.currentViewer == level.player) { - level.currentViewer = level.gameCursor; - } - level.player = level.gameCursor; - if (level.remote != null) { - if (level.remote.carriedBy != null) { - level.remote.carriedBy = level.player; - } - } - } - else if (e.getKeyCode() == KeyEvent.VK_R) { - if (level.remote == null) { + if (e.getKeyCode() == KeyEvent.VK_C && handleGameCursor()) { return false; - } - if (level.remote.carriedBy == null) { // Summon Remote - level.remote.x = 28; - level.remote.y = -20; - level.remote.carriedBy = level.player; - level.remote.room = level.player.room; - level.electricity = true; - } - else { // Hide Remote - level.remote.carriedBy = null; - level.remote.room = null; - level.electricity = false; - } - } - else if (e.getKeyCode() == KeyEvent.VK_P) { - if (level.paintbrush == null) { + else if (e.getKeyCode() == KeyEvent.VK_R && handleRadio()) { return false; - } - if (ports[0].myWire != null) { - ports[0].myWire.Remove(); - } - level.paintbrush.x = x; - level.paintbrush.y = y; - level.paintbrush.room = room; - room = null; - if (level.currentViewer == level.player) { - level.currentViewer = level.paintbrush; - } - level.player = level.paintbrush; } - else if (e.getKeyCode() == KeyEvent.VK_SLASH) { - if (level.helpCam == null) { + else if (e.getKeyCode() == KeyEvent.VK_P && handlePaintbrush()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_SLASH && handleHelp()) { return false; - } - level.player = level.helpCam; - level.currentViewer = level.helpCam; } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { if (carriedBy == null) { - MoveRight(e.isControlDown()); + moveRight(e.isControlDown()); } repeating = 0; return true; } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { if (carriedBy == null) { - MoveLeft(e.isControlDown()); + moveLeft(e.isControlDown()); } repeating = 0; return true; } else if (e.getKeyCode() == KeyEvent.VK_UP) { if (carriedBy == null) { - MoveUp(e.isControlDown()); + moveUp(e.isControlDown()); } repeating = 0; return true; } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { if (carriedBy == null) { - MoveDown(e.isControlDown()); + moveDown(e.isControlDown()); } repeating = 0; return true; @@ -386,34 +339,14 @@ public class SolderingPen extends Device { else if (e.getKeyCode() == KeyEvent.VK_SPACE) { WirePort(); } - else if (e.getKeyCode() == KeyEvent.VK_F) { - if (hot) { - if (ports[0].myWire != null) // If SP is wired - { - // Flip wire attached to SP - Port tempPort = ports[0].myWire.fromPort; - ports[0].myWire.fromPort = ports[0].myWire.toPort; - ports[0].myWire.toPort = tempPort; - } - else if (ports[0].myWire == null) // If SP is not wired - { - // Flip wire attached to CurrentPort - if (currentPort.myWire != null) { - Port tempPort = currentPort.myWire.fromPort; - currentPort.myWire.fromPort = currentPort.myWire.toPort; - currentPort.myWire.toPort = tempPort; - } - } - } - else { - if (ports[0].myWire != null) // If SP is wired - { - // Flip wire attached to SP - Port tempPort = ports[0].myWire.fromPort; - ports[0].myWire.fromPort = ports[0].myWire.toPort; - ports[0].myWire.toPort = tempPort; - } - } + else if (e.getKeyCode() == KeyEvent.VK_F && handleFlipDevice()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_E && handleEnterRoom()) { + return false; + } + else if (e.getKeyCode() == KeyEvent.VK_X && handleExitRoom()) { + return false; } return false; } @@ -422,7 +355,7 @@ public class SolderingPen extends Device { if (e.getKeyCode() == KeyEvent.VK_RIGHT) { repeating++; if (repeating > 10) { - MoveRight(e.isControlDown()); + moveRight(e.isControlDown()); return true; } return false; @@ -430,7 +363,7 @@ public class SolderingPen extends Device { else if (e.getKeyCode() == KeyEvent.VK_LEFT) { repeating++; if (repeating > 10) { - MoveLeft(e.isControlDown()); + moveLeft(e.isControlDown()); return true; } return false; @@ -438,7 +371,7 @@ public class SolderingPen extends Device { else if (e.getKeyCode() == KeyEvent.VK_UP) { repeating++; if (repeating > 10) { - MoveUp(e.isControlDown()); + moveUp(e.isControlDown()); return true; } return false; @@ -446,7 +379,7 @@ public class SolderingPen extends Device { else if (e.getKeyCode() == KeyEvent.VK_DOWN) { repeating++; if (repeating > 10) { - MoveDown(e.isControlDown()); + moveDown(e.isControlDown()); return true; } return false; @@ -500,4 +433,191 @@ public class SolderingPen extends Device { } + @Override + public boolean handleGameCursor() { + if (ports[0].myWire != null) { + ports[0].myWire.Remove(); + } + level.gameCursor.x = x; + level.gameCursor.y = y; + level.gameCursor.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.gameCursor; + } + level.player = level.gameCursor; + if (level.remote != null) { + if (level.remote.carriedBy != null) { + level.remote.carriedBy = level.player; + } + } + + level.roomdisplay.dq.selectCursor(); + return true; + } + + @Override + public boolean handleSolderPen() { + return false; + } + + @Override + public boolean handleToolbox() { + return false; + } + + @Override + public boolean handleRadio() { + if (level.remote == null) { + return false; + } + if (level.remote.carriedBy == null) { // Summon Remote + level.remote.x = 28; + level.remote.y = -20; + level.remote.carriedBy = level.player; + level.remote.room = level.player.room; + level.electricity = true; + + level.roomdisplay.dq.setRadioSelected(true); + } + else { // Hide Remote + level.remote.carriedBy = null; + level.remote.room = null; + level.electricity = false; + + level.roomdisplay.dq.setRadioSelected(false); + } + return true; + } + + @Override + public boolean handleRotateDevice(int direction) { + return false; + } + + @Override + public boolean handleHotCursor() { + return false; + } + + public void handleRemote() { + if (level.remote != null) { + if (level.remote.carriedBy != null) { + level.remote.carriedBy = level.player; + } + } + } + + @Override + public boolean handlePaintbrush() { + if (level.paintbrush == null) { + return false; + } + if (ports[0].myWire != null) { + ports[0].myWire.Remove(); + } + level.paintbrush.x = x; + level.paintbrush.y = y; + level.paintbrush.room = room; + room = null; + if (level.currentViewer == level.player) { + level.currentViewer = level.paintbrush; + } + level.player = level.paintbrush; + + level.roomdisplay.dq.selectPaintBrush(); + + handleRemote(); + + return true; + } + + @Override + public boolean handleLoadSmallChip() { + return false; + } + + @Override + public boolean handleHelp() { + if (level.helpCam == null) { + return false; + } + // First switch to game cursor + handleGameCursor(); + + level.player = level.helpCam; + level.currentViewer = level.helpCam; + return true; + } + + @Override + public boolean handleEnterRoom() { + Item item = level.FindNearestItem(this); + if (item != null) { + if (item.InternalRoom != null) { + if (Overlaps(item)) { + if (!item.OverWall()) { + int newX = 280; // 10 * 28 + int newY = 176; // 5.5 * 32 + x = newX; + y = newY; + SetRoom(item.InternalRoom); + return true; + } + } + } + } + return false; + } + + @Override + public boolean handleExitRoom() { + if (room != null && room.portalItem != null) { + Dimension d = room.portalItem.GetXY(); + int newX = d.width + + room.portalItem.getWidth() / 2 + - width / 2; + int newY = d.height + + room.portalItem.getHeight() / 4 * 2 + - height / 2; + x = newX; + y = newY; + SetRoom(room.portalItem.room); + level.currentViewer = level.player; + return true; + } + return false; + } + + @Override + public boolean handleFlipDevice() { + if (hot) { + if (ports[0].myWire != null) // If SP is wired + { + // Flip wire attached to SP + Port tempPort = ports[0].myWire.fromPort; + ports[0].myWire.fromPort = ports[0].myWire.toPort; + ports[0].myWire.toPort = tempPort; + } + else if (ports[0].myWire == null) // If SP is not wired + { + // Flip wire attached to CurrentPort + if (currentPort.myWire != null) { + Port tempPort = currentPort.myWire.fromPort; + currentPort.myWire.fromPort = currentPort.myWire.toPort; + currentPort.myWire.toPort = tempPort; + } + } + } + else { + if (ports[0].myWire != null) // If SP is wired + { + // Flip wire attached to SP + Port tempPort = ports[0].myWire.fromPort; + ports[0].myWire.fromPort = ports[0].myWire.toPort; + ports[0].myWire.toPort = tempPort; + } + } + return true; + } } diff --git a/src/com/droidquest/devices/Device.java b/src/com/droidquest/devices/Device.java index d886ed2..f0367e4 100644 --- a/src/com/droidquest/devices/Device.java +++ b/src/com/droidquest/devices/Device.java @@ -169,6 +169,9 @@ public class Device extends Item { } public void flip() { + // Just rotate twice to flip + rotate(1); + rotate(1); } public Object clone() { diff --git a/src/com/droidquest/items/AmpireBot.java b/src/com/droidquest/items/AmpireBot.java index 055f8fa..83bc288 100644 --- a/src/com/droidquest/items/AmpireBot.java +++ b/src/com/droidquest/items/AmpireBot.java @@ -253,12 +253,12 @@ public class AmpireBot extends Item { behaviorState = 2; } else { - MoveDown(8); + moveDown(8); if (x < 280) { - MoveRight(8); + moveRight(8); } if (x > 280) { - MoveLeft(8); + moveLeft(8); } } break; @@ -267,12 +267,12 @@ public class AmpireBot extends Item { behaviorState = 3; } else { - MoveLeft(8); + moveLeft(8); if (y < 192) { - MoveDown(8); + moveDown(8); } if (y > 192) { - MoveUp(8); + moveUp(8); } } break; @@ -281,12 +281,12 @@ public class AmpireBot extends Item { behaviorState = 4; } else { - MoveUp(8); + moveUp(8); if (x < 280) { - MoveRight(8); + moveRight(8); } if (x > 280) { - MoveLeft(8); + moveLeft(8); } } break; @@ -295,12 +295,12 @@ public class AmpireBot extends Item { behaviorState = 5; } else { - MoveRight(8); + moveRight(8); if (y < 192) { - MoveDown(8); + moveDown(8); } if (y > 192) { - MoveUp(8); + moveUp(8); } } break; @@ -309,12 +309,12 @@ public class AmpireBot extends Item { behaviorState = 2; } else { - MoveDown(8); + moveDown(8); if (x < 280) { - MoveRight(8); + moveRight(8); } if (x > 280) { - MoveLeft(8); + moveLeft(8); } } break; @@ -328,16 +328,16 @@ public class AmpireBot extends Item { } Dimension d = target.GetXY(); if (d.width < x) { - MoveLeft(false); + moveLeft(false); } if (d.width > x) { - MoveRight(false); + moveRight(false); } if (d.height < y) { - MoveUp(false); + moveUp(false); } if (d.height > y) { - MoveDown(false); + moveDown(false); } break; case 7: diff --git a/src/com/droidquest/items/ChipDecompiler.java b/src/com/droidquest/items/ChipDecompiler.java index ec1429b..d4e24f4 100644 --- a/src/com/droidquest/items/ChipDecompiler.java +++ b/src/com/droidquest/items/ChipDecompiler.java @@ -95,14 +95,14 @@ class ChipDecompiler extends Thread { for (int c = 0; c < 8; c++) { if (oldgate.portSignals[c].externalSignal != null) { int sigIndex = gate.mySignals.indexOf(oldgate.portSignals[c].externalSignal); - newgate.portSignals[c].externalSignal = (Signal) smallchip.signals.elementAt(sigIndex); + newgate.portSignals[c].externalSignal = smallchip.signals.elementAt(sigIndex); } } } for (int b = 0; b < 8; b++) { if (gate.portSignals[b].internalSignal != null) { int sigIndex = gate.mySignals.indexOf(gate.portSignals[b].internalSignal); - smallchip.portSignals[b].internalSignal = (Signal) smallchip.signals.elementAt(sigIndex); + smallchip.portSignals[b].internalSignal = smallchip.signals.elementAt(sigIndex); } smallchip.portSignals[b].type = gate.portSignals[b].type; smallchip.ports[b].type = gate.portSignals[b].type; diff --git a/src/com/droidquest/items/GateKeeper.java b/src/com/droidquest/items/GateKeeper.java index b8ffa5b..7ef1b6e 100644 --- a/src/com/droidquest/items/GateKeeper.java +++ b/src/com/droidquest/items/GateKeeper.java @@ -71,7 +71,7 @@ public class GateKeeper extends Item { if (diff > 2) { diff = 2; } - MoveRight(diff * dir); + moveRight(diff * dir); } if (y != goToY) { int diff = Math.abs(goToY - y); @@ -79,7 +79,7 @@ public class GateKeeper extends Item { if (diff > 2) { diff = 2; } - MoveDown(diff * dir); + moveDown(diff * dir); } } else { diff --git a/src/com/droidquest/items/GenericRobot.java b/src/com/droidquest/items/GenericRobot.java index 91ef09f..f9c41c4 100644 --- a/src/com/droidquest/items/GenericRobot.java +++ b/src/com/droidquest/items/GenericRobot.java @@ -290,16 +290,16 @@ public class GenericRobot extends Item { // Do Thrusting if (charge > 0 && level.electricity && (carriedBy == null) && thrusterPower) { if (topThruster) { - MoveDown(8); + moveDown(8); } if (rightThruster) { - MoveLeft(8); + moveLeft(8); } if (bottomThruster) { - MoveUp(8); + moveUp(8); } if (leftThruster) { - MoveRight(8); + moveRight(8); } } @@ -461,15 +461,7 @@ public class GenericRobot extends Item { } } -// g.setColor(Color.magenta); -// g.drawRect(orgX+leftPortal.x, orgY+leftPortal.y, -// leftPortal.width+28, leftPortal.height+32); -// g.drawRect(orgX+rightPortal.x, orgY+rightPortal.y, -// rightPortal.width+28, rightPortal.height+32); -// g.drawRect(orgX+upPortal.x, orgY+upPortal.y, -// upPortal.width+28, upPortal.height+32); -// g.drawRect(orgX+downPortal.x, orgY+downPortal.y, -// downPortal.width+28, downPortal.height+32); + } diff --git a/src/com/droidquest/items/Ghost.java b/src/com/droidquest/items/Ghost.java index 030d4b9..bbdb145 100644 --- a/src/com/droidquest/items/Ghost.java +++ b/src/com/droidquest/items/Ghost.java @@ -164,16 +164,16 @@ public class Ghost extends Item { switch (animationState) { case 0: // Right - MoveRight(4); + moveRight(4); break; case 1: // Down - MoveDown(4); + moveDown(4); break; case 2: // Left - MoveLeft(4); + moveLeft(4); break; case 3: // Up - MoveUp(4); + moveUp(4); break; } currentIcon = icons[animationState].getImage(); diff --git a/src/com/droidquest/items/Handle.java b/src/com/droidquest/items/Handle.java index 109ecd3..f2209aa 100644 --- a/src/com/droidquest/items/Handle.java +++ b/src/com/droidquest/items/Handle.java @@ -54,7 +54,7 @@ public class Handle extends Item { if (e.getKeyCode() == e.VK_RIGHT) { if (x < 15 * 28) { room.SetMaterial(x / 28 - 12, 4, 0); - MoveRight(28); + moveRight(28); room.SetMaterial(x / 28 - 1, 4, 8); } } @@ -63,7 +63,7 @@ public class Handle extends Item { if (x > 13 * 28) { room.SetMaterial(x / 28 - 13, 4, 8); room.SetMaterial(x / 28 - 1, 4, 0); - MoveLeft(28); + moveLeft(28); } } diff --git a/src/com/droidquest/items/Item.java b/src/com/droidquest/items/Item.java index d32bb98..1eee5af 100644 --- a/src/com/droidquest/items/Item.java +++ b/src/com/droidquest/items/Item.java @@ -273,7 +273,7 @@ public class Item implements Serializable, Cloneable { } - protected void MoveUp(int dist) { + protected void moveUp(int dist) { int bigXl = x / 28; int bigXr = (x + getWidth() - 1) / 28; int bigY = (y - dist) / 32; @@ -295,7 +295,7 @@ public class Item implements Serializable, Cloneable { x = d.width + (room.portalItem.width - width) / 2; y = d.height + (room.portalItem.height - height) / 2; SetRoom(room.portalItem.room); - MoveUp(dist); + moveUp(dist); } else { // stop at top y += 384; @@ -305,7 +305,7 @@ public class Item implements Serializable, Cloneable { ItemEffectsMaterials(); } - protected void MoveDown(int dist) { + protected void moveDown(int dist) { int bigXl = x / 28; int bigXr = (x + getWidth() - 1) / 28; int bigY = (y + getHeight() - 1 + dist) / 32; @@ -328,7 +328,7 @@ public class Item implements Serializable, Cloneable { x = d.width + (room.portalItem.width - width) / 2; y = d.height + (room.portalItem.height - height) / 2; SetRoom(room.portalItem.room); - MoveDown(dist); + moveDown(dist); } else { // stop at bottom y -= 384; @@ -338,7 +338,7 @@ public class Item implements Serializable, Cloneable { ItemEffectsMaterials(); } - protected void MoveLeft(int dist) { + protected void moveLeft(int dist) { int bigX = (x - dist) / 28; int bigYt = y / 32; int bigYb = (y + getHeight() - 1) / 32; @@ -360,7 +360,7 @@ public class Item implements Serializable, Cloneable { x = d.width + (room.portalItem.width - width) / 2; y = d.height + (room.portalItem.height - height) / 2; SetRoom(room.portalItem.room); - MoveLeft(dist); + moveLeft(dist); } else { // stop at Left x += 560; @@ -370,7 +370,7 @@ public class Item implements Serializable, Cloneable { ItemEffectsMaterials(); } - protected void MoveRight(int dist) { + protected void moveRight(int dist) { int bigX = (x + getWidth() - 1 + dist) / 28; int bigYt = y / 32; int bigYb = (y + getHeight() - 1) / 32; @@ -394,7 +394,7 @@ public class Item implements Serializable, Cloneable { x = d.width + (room.portalItem.width - width) / 2; y = d.height + (room.portalItem.height - height) / 2; SetRoom(room.portalItem.room); - MoveRight(dist); + moveRight(dist); } else { // stop at Right x -= 560; @@ -404,36 +404,36 @@ public class Item implements Serializable, Cloneable { ItemEffectsMaterials(); } - protected void MoveUp(boolean nudge) { + protected void moveUp(boolean nudge) { int dist = 32; if (nudge) { dist = 2; } - MoveUp(dist); + moveUp(dist); } - protected void MoveDown(boolean nudge) { + protected void moveDown(boolean nudge) { int dist = 32; if (nudge) { dist = 2; } - MoveDown(dist); + moveDown(dist); } - protected void MoveLeft(boolean nudge) { + protected void moveLeft(boolean nudge) { int dist = 28; if (nudge) { dist = 2; } - MoveLeft(dist); + moveLeft(dist); } - protected void MoveRight(boolean nudge) { + protected void moveRight(boolean nudge) { int dist = 28; if (nudge) { dist = 2; } - MoveRight(dist); + moveRight(dist); } public void Animate() { @@ -459,30 +459,30 @@ public class Item implements Serializable, Cloneable { dy = 32; } if (dx > 0) { - MoveRight(dx); + moveRight(dx); } if (dx < 0) { - MoveLeft(-dx); + moveLeft(-dx); } if (dy > 0) { - MoveDown(dy); + moveDown(dy); } if (dy < 0) { - MoveUp(-dy); + moveUp(-dy); } } if (automove == 2) { if (autoX > 0) { - MoveRight(autoX); + moveRight(autoX); } if (autoX < 0) { - MoveLeft(-autoX); + moveLeft(-autoX); } if (autoY > 0) { - MoveDown(autoY); + moveDown(autoY); } if (autoY < 0) { - MoveUp(-autoY); + moveUp(-autoY); } } } diff --git a/src/com/droidquest/items/Sentry.java b/src/com/droidquest/items/Sentry.java index 4626dc8..5e08dc3 100644 --- a/src/com/droidquest/items/Sentry.java +++ b/src/com/droidquest/items/Sentry.java @@ -288,7 +288,7 @@ public class Sentry extends Item { if (diff > 8) { diff = 8; } - MoveRight(diff * dir); + moveRight(diff * dir); } if (y != goToY) { int diff = Math.abs(goToY - y); @@ -296,7 +296,7 @@ public class Sentry extends Item { if (diff > 8) { diff = 8; } - MoveDown(diff * dir); + moveDown(diff * dir); } } } @@ -314,7 +314,7 @@ public class Sentry extends Item { if (diff > 50) { diff /= 2; } - MoveRight(diff * dir); + moveRight(diff * dir); } if (y != level.player.y) { int diff = Math.abs(level.player.y - y); @@ -322,7 +322,7 @@ public class Sentry extends Item { if (diff > 50) { diff /= 2; } - MoveDown(diff * dir); + moveDown(diff * dir); } if (x == level.player.x && y == level.player.y) { PicksUp(level.player); @@ -343,7 +343,7 @@ public class Sentry extends Item { if (diff > 8) { diff = 8; } - MoveRight(diff * dir); + moveRight(diff * dir); } if (y != carryToY) { int diff = Math.abs(carryToY - y); @@ -351,7 +351,7 @@ public class Sentry extends Item { if (diff > 8) { diff = 8; } - MoveDown(diff * dir); + moveDown(diff * dir); } } } @@ -389,7 +389,7 @@ public class Sentry extends Item { } } - public void MoveUp(int dist) { + public void moveUp(int dist) { int newY = y - dist; if (newY < 0) { newY = 0; @@ -397,7 +397,7 @@ public class Sentry extends Item { y = newY; } - public void MoveDown(int dist) { + public void moveDown(int dist) { int newY = y + dist; if (newY > 383) { newY = 383; @@ -405,7 +405,7 @@ public class Sentry extends Item { y = newY; } - public void MoveLeft(int dist) { + public void moveLeft(int dist) { int newX = x - dist; if (newX < 0) { newX = 0; @@ -413,7 +413,7 @@ public class Sentry extends Item { x = newX; } - public void MoveRight(int dist) { + public void moveRight(int dist) { int newX = x + dist; if (newX > 579) { newX = 579; diff --git a/src/com/droidquest/items/Sentry3.java b/src/com/droidquest/items/Sentry3.java index 6adef2f..f958728 100644 --- a/src/com/droidquest/items/Sentry3.java +++ b/src/com/droidquest/items/Sentry3.java @@ -56,30 +56,30 @@ public class Sentry3 extends Sentry { switch (behavior) { case 0: if (y < 256) { - MoveDown(8); + moveDown(8); } else { behavior = 1; } if (x < 56) { - MoveRight(8); + moveRight(8); } if (x > 56) { - MoveLeft(8); + moveLeft(8); } break; case 1: if (y > 64) { - MoveUp(8); + moveUp(8); } else { behavior = 0; } if (x < 56) { - MoveRight(8); + moveRight(8); } if (x > 56) { - MoveLeft(8); + moveLeft(8); } break; case 2: @@ -102,16 +102,16 @@ public class Sentry3 extends Sentry { dy = 50; } if (dx < 0) { - MoveLeft(-dx); + moveLeft(-dx); } if (dx > 0) { - MoveRight(dx); + moveRight(dx); } if (dy < 0) { - MoveUp(-dy); + moveUp(-dy); } if (dy > 0) { - MoveDown(dy); + moveDown(dy); } if (dx == 0 && dy == 0) { PicksUp(level.player); @@ -126,16 +126,16 @@ public class Sentry3 extends Sentry { } else { if (y < 312) { - MoveDown(8); + moveDown(8); } else if (y < 320) { - MoveDown(320 - y); + moveDown(320 - y); } if (x < carryToX) { - MoveRight(8); + moveRight(8); } if (x > carryToX) { - MoveLeft(8); + moveLeft(8); } } break; diff --git a/src/com/droidquest/items/SentryT1.java b/src/com/droidquest/items/SentryT1.java index 60c50ff..7da88c6 100644 --- a/src/com/droidquest/items/SentryT1.java +++ b/src/com/droidquest/items/SentryT1.java @@ -166,14 +166,14 @@ public class SentryT1 extends Item { switch (behavior) { case 0: oldX = x; - MoveLeft(4); + moveLeft(4); if (oldX == x) { behavior = 1; } break; case 1: oldX = x; - MoveRight(4); + moveRight(4); if (oldX == x) { behavior = 0; } diff --git a/src/com/droidquest/items/SentryT2.java b/src/com/droidquest/items/SentryT2.java index 89dfefc..c95889a 100644 --- a/src/com/droidquest/items/SentryT2.java +++ b/src/com/droidquest/items/SentryT2.java @@ -43,30 +43,30 @@ public class SentryT2 extends Sentry { switch (behavior) { case 0: if (y < 256) { - MoveDown(4); + moveDown(4); } else { behavior = 1; } if (x < 56) { - MoveRight(4); + moveRight(4); } if (x > 56) { - MoveLeft(4); + moveLeft(4); } break; case 1: if (y > 64) { - MoveUp(4); + moveUp(4); } else { behavior = 0; } if (x < 56) { - MoveRight(4); + moveRight(4); } if (x > 56) { - MoveLeft(4); + moveLeft(4); } break; case 2: @@ -89,16 +89,16 @@ public class SentryT2 extends Sentry { dy = 50; } if (dx < 0) { - MoveLeft(-dx); + moveLeft(-dx); } if (dx > 0) { - MoveRight(dx); + moveRight(dx); } if (dy < 0) { - MoveUp(-dy); + moveUp(-dy); } if (dy > 0) { - MoveDown(dy); + moveDown(dy); } if (dx == 0 && dy == 0) { PicksUp(level.player); @@ -113,13 +113,13 @@ public class SentryT2 extends Sentry { } else { if (x > 56) { - MoveLeft(4); + moveLeft(4); } if (y < 20) { - MoveDown(4); + moveDown(4); } if (y > 30) { - MoveUp(4); + moveUp(4); } } break; diff --git a/src/com/droidquest/items/SkyGuard.java b/src/com/droidquest/items/SkyGuard.java index c94b2fd..4906ff1 100644 --- a/src/com/droidquest/items/SkyGuard.java +++ b/src/com/droidquest/items/SkyGuard.java @@ -32,7 +32,7 @@ public class SkyGuard extends Item { if (speed > 0) { if (speed + x < 420) { - MoveRight(speed); + moveRight(speed); currentIcon = icons[animationState].getImage(); } else { @@ -42,7 +42,7 @@ public class SkyGuard extends Item { } else if (speed < 0) { if (speed + x > 112) { - MoveLeft(-speed); + moveLeft(-speed); currentIcon = icons[3 + animationState].getImage(); } else { diff --git a/src/com/droidquest/items/SkywayFlyer.java b/src/com/droidquest/items/SkywayFlyer.java index 69d0cd3..f915d10 100644 --- a/src/com/droidquest/items/SkywayFlyer.java +++ b/src/com/droidquest/items/SkywayFlyer.java @@ -30,14 +30,14 @@ public class SkywayFlyer extends Item { currentIcon = icons[0].getImage(); } - public void MoveUp(int dist) { + public void moveUp(int dist) { y = y - dist; if (y < 32) { y = 320; } } - public void MoveDown(int dist) { + public void moveDown(int dist) { y = y + dist; if (y > 320) { y = 32; @@ -52,10 +52,10 @@ public class SkywayFlyer extends Item { currentIcon = icons[animationState].getImage(); if (speed < 0) { - MoveUp(-speed); + moveUp(-speed); } else { - MoveDown(speed); + moveDown(speed); } if (Overlaps(level.player)) { diff --git a/src/com/droidquest/items/SpyCam.java b/src/com/droidquest/items/SpyCam.java index c9134db..9f7aa8a 100644 --- a/src/com/droidquest/items/SpyCam.java +++ b/src/com/droidquest/items/SpyCam.java @@ -1,13 +1,14 @@ package com.droidquest.items; import com.droidquest.Room; +import com.droidquest.avatars.Avatar; import com.droidquest.decorations.TextBox; import javax.swing.*; import java.awt.*; import java.awt.event.KeyEvent; -public class SpyCam extends Item { +public class SpyCam extends Item implements Avatar { public SpyCam(Room r) { x = 0; y = 0; @@ -21,23 +22,23 @@ public class SpyCam extends Item { } public boolean KeyUp(KeyEvent e) { - if (e.getKeyCode() == e.VK_RIGHT) { + if (e.getKeyCode() == KeyEvent.VK_RIGHT) { SetRoom(room.rightRoom); return true; } - if (e.getKeyCode() == e.VK_LEFT) { + if (e.getKeyCode() == KeyEvent.VK_LEFT) { SetRoom(room.leftRoom); return true; } - if (e.getKeyCode() == e.VK_UP) { + if (e.getKeyCode() == KeyEvent.VK_UP) { SetRoom(room.upRoom); return true; } - if (e.getKeyCode() == e.VK_DOWN) { + if (e.getKeyCode() == KeyEvent.VK_DOWN) { SetRoom(room.downRoom); return true; } - if (e.getKeyCode() == e.VK_SPACE) { + if (e.getKeyCode() == KeyEvent.VK_SPACE) { level.player = level.gameCursor; level.currentViewer = level.player; for (int a = 5; a < 60; a++) { @@ -50,4 +51,63 @@ public class SpyCam extends Item { return false; } + @Override + public boolean handleGameCursor() { + return false; + } + + @Override + public boolean handleSolderPen() { + return false; + } + + @Override + public boolean handleToolbox() { + return false; + } + + @Override + public boolean handleRadio() { + return false; + } + + @Override + public boolean handleRotateDevice(int direction) { + return false; + } + + @Override + public boolean handleHotCursor() { + return false; + } + + @Override + public boolean handlePaintbrush() { + return false; + } + + @Override + public boolean handleLoadSmallChip() { + return false; + } + + @Override + public boolean handleHelp() { + return false; + } + + @Override + public boolean handleEnterRoom() { + return false; + } + + @Override + public boolean handleExitRoom() { + return false; + } + + @Override + public boolean handleFlipDevice() { + return false; + } } \ No newline at end of file diff --git a/src/com/droidquest/items/StormCloud.java b/src/com/droidquest/items/StormCloud.java index a001e92..111aaf3 100644 --- a/src/com/droidquest/items/StormCloud.java +++ b/src/com/droidquest/items/StormCloud.java @@ -174,16 +174,16 @@ public class StormCloud extends Item { } if (xDirection > 0) { - MoveRight(xDirection); + moveRight(xDirection); } if (xDirection < 0) { - MoveLeft(-xDirection); + moveLeft(-xDirection); } if (yDirection > 0) { - MoveDown(yDirection); + moveDown(yDirection); } if (yDirection < 0) { - MoveUp(-yDirection); + moveUp(-yDirection); } if (brobot != null) { @@ -239,7 +239,7 @@ public class StormCloud extends Item { } - public void MoveRight(int dist) { + public void moveRight(int dist) { int newX = x + dist; if (newX > 559 - 4 * 28 / 2) { xDirection = -(level.random.nextInt(maxspeed) + 1); @@ -248,7 +248,7 @@ public class StormCloud extends Item { x = newX; } - public void MoveLeft(int dist) { + public void moveLeft(int dist) { int newX = x - dist; if (newX < 0) { xDirection = level.random.nextInt(maxspeed) + 1; @@ -257,7 +257,7 @@ public class StormCloud extends Item { x = newX; } - public void MoveUp(int dist) { + public void moveUp(int dist) { y -= dist; if (y < 0) { room = room.upRoom; @@ -265,7 +265,7 @@ public class StormCloud extends Item { } } - public void MoveDown(int dist) { + public void moveDown(int dist) { y += dist; if (y > 383) { room = room.downRoom; diff --git a/src/com/droidquest/items/Sweeper.java b/src/com/droidquest/items/Sweeper.java index 841d856..cc3f009 100644 --- a/src/com/droidquest/items/Sweeper.java +++ b/src/com/droidquest/items/Sweeper.java @@ -175,7 +175,7 @@ public class Sweeper extends Item { currentIcon = icons[1].getImage(); } else { - MoveRight(8); + moveRight(8); } break; @@ -190,7 +190,7 @@ public class Sweeper extends Item { currentIcon = icons[2].getImage(); } else { - MoveLeft(8); + moveLeft(8); } break; diff --git a/src/com/droidquest/items/Train.java b/src/com/droidquest/items/Train.java index a8c9d35..e370715 100644 --- a/src/com/droidquest/items/Train.java +++ b/src/com/droidquest/items/Train.java @@ -1,5 +1,6 @@ package com.droidquest.items; +import com.droidquest.avatars.Avatar; import com.droidquest.materials.Material; import javax.swing.*; @@ -7,7 +8,7 @@ import java.awt.*; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; -public class Train extends Item { +public class Train extends Item implements Avatar { public Train() { x = 0; y = 0; @@ -85,10 +86,69 @@ public class Train extends Item { public void Animate() { if (room != null) { if (carrying != null) { - MoveRight(8); + moveRight(8); } } } + @Override + public boolean handleGameCursor() { + return false; + } + + @Override + public boolean handleSolderPen() { + return false; + } + + @Override + public boolean handleToolbox() { + return false; + } + + @Override + public boolean handleRadio() { + return false; + } + + @Override + public boolean handleRotateDevice(int direction) { + return false; + } + + @Override + public boolean handleHotCursor() { + return false; + } + + @Override + public boolean handlePaintbrush() { + return false; + } + + @Override + public boolean handleLoadSmallChip() { + return false; + } + + @Override + public boolean handleHelp() { + return false; + } + + @Override + public boolean handleEnterRoom() { + return false; + } + + @Override + public boolean handleExitRoom() { + return false; + } + + @Override + public boolean handleFlipDevice() { + return false; + } } diff --git a/src/com/droidquest/items/TrashCollector.java b/src/com/droidquest/items/TrashCollector.java index 8e175f6..dd81b74 100644 --- a/src/com/droidquest/items/TrashCollector.java +++ b/src/com/droidquest/items/TrashCollector.java @@ -89,14 +89,14 @@ public class TrashCollector extends Item { switch (behavior) { case 0: // Move Left to Room 31 if (room != gotoRoom) { - MoveLeft(4); + moveLeft(4); if (y != 176) { int diff = Math.abs(176 - y); int dir = diff / (176 - y); if (diff > 4) { diff = 4; } - MoveDown(diff * dir); + moveDown(diff * dir); } } else { @@ -110,7 +110,7 @@ public class TrashCollector extends Item { if (diff > 4) { diff = 4; } - MoveRight(diff * dir); + moveRight(diff * dir); } if (y != gotoY) { int diff = Math.abs(gotoY - y); @@ -118,20 +118,20 @@ public class TrashCollector extends Item { if (diff > 4) { diff = 4; } - MoveDown(diff * dir); + moveDown(diff * dir); } } break; case 1: // Move Up to Room 5 if (room != gotoRoom) { - MoveUp(4); + moveUp(4); if (x != 266) { int diff = Math.abs(266 - y); int dir = diff / (266 - y); if (diff > 4) { diff = 4; } - MoveRight(diff * dir); + moveRight(diff * dir); } } else { @@ -145,7 +145,7 @@ public class TrashCollector extends Item { if (diff > 4) { diff = 4; } - MoveRight(diff * dir); + moveRight(diff * dir); } if (y != gotoY) { int diff = Math.abs(gotoY - y); @@ -153,20 +153,20 @@ public class TrashCollector extends Item { if (diff > 4) { diff = 4; } - MoveDown(diff * dir); + moveDown(diff * dir); } } break; case 2: // Move Right to Room 11 if (room != gotoRoom) { - MoveRight(4); + moveRight(4); if (y != 176) { int diff = Math.abs(176 - y); int dir = diff / (176 - y); if (diff > 4) { diff = 4; } - MoveDown(diff * dir); + moveDown(diff * dir); } } else { @@ -180,7 +180,7 @@ public class TrashCollector extends Item { if (diff > 4) { diff = 4; } - MoveRight(diff * dir); + moveRight(diff * dir); } if (y != gotoY) { int diff = Math.abs(gotoY - y); @@ -188,20 +188,20 @@ public class TrashCollector extends Item { if (diff > 4) { diff = 4; } - MoveDown(diff * dir); + moveDown(diff * dir); } } break; case 3: // Move Down to Room 17 if (room != gotoRoom) { - MoveDown(4); + moveDown(4); if (x != 266) { int diff = Math.abs(266 - y); int dir = diff / (266 - y); if (diff > 4) { diff = 4; } - MoveRight(diff * dir); + moveRight(diff * dir); } } else { @@ -215,7 +215,7 @@ public class TrashCollector extends Item { if (diff > 4) { diff = 4; } - MoveRight(diff * dir); + moveRight(diff * dir); } if (y != gotoY) { int diff = Math.abs(gotoY - y); @@ -223,20 +223,20 @@ public class TrashCollector extends Item { if (diff > 4) { diff = 4; } - MoveDown(diff * dir); + moveDown(diff * dir); } } break; case 4: // Move Left to Room 19 if (room != gotoRoom) { - MoveLeft(4); + moveLeft(4); if (y != 176) { int diff = Math.abs(176 - y); int dir = diff / (176 - y); if (diff > 4) { diff = 4; } - MoveDown(diff * dir); + moveDown(diff * dir); } } else { @@ -263,7 +263,7 @@ public class TrashCollector extends Item { if (diff > 4) { diff = 4; } - MoveRight(diff * dir); + moveRight(diff * dir); } if (y != gotoY) { int diff = Math.abs(gotoY - y); @@ -271,20 +271,20 @@ public class TrashCollector extends Item { if (diff > 4) { diff = 4; } - MoveDown(diff * dir); + moveDown(diff * dir); } } break; case 5: // Move Up to Room 58 if (room != gotoRoom) { - MoveUp(4); + moveUp(4); if (x != 266) { int diff = Math.abs(266 - y); int dir = diff / (266 - y); if (diff > 4) { diff = 4; } - MoveRight(diff * dir); + moveRight(diff * dir); } } else { @@ -305,7 +305,7 @@ public class TrashCollector extends Item { if (diff > 4) { diff = 4; } - MoveRight(diff * dir); + moveRight(diff * dir); } if (y != gotoY) { int diff = Math.abs(gotoY - y); @@ -313,20 +313,20 @@ public class TrashCollector extends Item { if (diff > 4) { diff = 4; } - MoveDown(diff * dir); + moveDown(diff * dir); } } break; case 6: // Move Down to Room 19 if (room != gotoRoom) { - MoveDown(4); + moveDown(4); if (x != 266) { int diff = Math.abs(266 - y); int dir = diff / (266 - y); if (diff > 4) { diff = 4; } - MoveRight(diff * dir); + moveRight(diff * dir); } } else { @@ -340,7 +340,7 @@ public class TrashCollector extends Item { if (diff > 4) { diff = 4; } - MoveRight(diff * dir); + moveRight(diff * dir); } if (y != gotoY) { int diff = Math.abs(gotoY - y); @@ -348,7 +348,7 @@ public class TrashCollector extends Item { if (diff > 4) { diff = 4; } - MoveDown(diff * dir); + moveDown(diff * dir); } } break; @@ -365,7 +365,7 @@ public class TrashCollector extends Item { if (diff > 8) { diff = 8; } - MoveRight(diff * dir); + moveRight(diff * dir); } if (y != target.y) { int diff = Math.abs(target.y - y); @@ -373,7 +373,7 @@ public class TrashCollector extends Item { if (diff > 8) { diff = 8; } - MoveDown(diff * dir); + moveDown(diff * dir); } } } diff --git a/src/com/droidquest/items/Turbine.java b/src/com/droidquest/items/Turbine.java index 1310fa5..da40cca 100644 --- a/src/com/droidquest/items/Turbine.java +++ b/src/com/droidquest/items/Turbine.java @@ -82,7 +82,7 @@ public class Turbine extends Item { public void Animate() { boolean flag = false; for (int a = 0; a < level.sparks.size(); a++) { - Spark spark = (Spark) level.sparks.elementAt(a); + Spark spark = level.sparks.elementAt(a); if (spark.room == room) { if (spark.y >= y && spark.y <= y + height) { if (spark.x >= x && spark.x <= x + width) { diff --git a/src/com/droidquest/items/VendingHandle.java b/src/com/droidquest/items/VendingHandle.java index edc1c13..d12b80d 100644 --- a/src/com/droidquest/items/VendingHandle.java +++ b/src/com/droidquest/items/VendingHandle.java @@ -87,13 +87,13 @@ public class VendingHandle extends Item { int tempX = d.width; int tempY = d.height; if (tempY != startY) { - carriedBy.MoveDown(startY - tempY); + carriedBy.moveDown(startY - tempY); } if (tempX < startX) { - carriedBy.MoveRight(startX - tempX); + carriedBy.moveRight(startX - tempX); } if (tempX > (startX + maxPull)) { - carriedBy.MoveLeft(tempX - (startX + maxPull)); + carriedBy.moveLeft(tempX - (startX + maxPull)); } d = GetXY(); diff --git a/src/com/droidquest/items/WallHandle.java b/src/com/droidquest/items/WallHandle.java index 00d756f..03fffaf 100644 --- a/src/com/droidquest/items/WallHandle.java +++ b/src/com/droidquest/items/WallHandle.java @@ -75,13 +75,13 @@ public class WallHandle extends Item { int tempX = d.width; int tempY = d.height; if (tempY != startY) { - carriedBy.MoveDown(startY - tempY); + carriedBy.moveDown(startY - tempY); } if (tempX < startX) { - carriedBy.MoveRight(startX - tempX); + carriedBy.moveRight(startX - tempX); } if (tempX > (startX + maxPull)) { - carriedBy.MoveLeft(tempX - (startX + maxPull)); + carriedBy.moveLeft(tempX - (startX + maxPull)); } d = GetXY(); diff --git a/src/com/droidquest/materials/AntiPlayer.java b/src/com/droidquest/materials/AntiPlayer.java index 0660556..f4fc091 100644 --- a/src/com/droidquest/materials/AntiPlayer.java +++ b/src/com/droidquest/materials/AntiPlayer.java @@ -1,6 +1,5 @@ package com.droidquest.materials; -import com.droidquest.Room; import com.droidquest.avatars.GameCursor; import com.droidquest.items.GenericRobot; import com.droidquest.items.Item; diff --git a/src/com/droidquest/materials/ElevatorDoor.java b/src/com/droidquest/materials/ElevatorDoor.java index 5fbd6e4..80204b0 100644 --- a/src/com/droidquest/materials/ElevatorDoor.java +++ b/src/com/droidquest/materials/ElevatorDoor.java @@ -2,7 +2,6 @@ package com.droidquest.materials; import com.droidquest.avatars.GameCursor; import com.droidquest.decorations.Graphix; -import com.droidquest.decorations.TextBox; import com.droidquest.items.GenericRobot; import com.droidquest.items.Item; import com.droidquest.items.Magnet;