Refactored and cleaned up code. Modernized some constructs.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
}
|
@@ -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; a<level.items.size(); a++)
|
||||
if (((Item)level.items.elementAt(a)).getClass().toString().endsWith("OrangeRobot"))
|
||||
robot = (GenericRobot) level.items.elementAt(a);
|
||||
if (robot==null)
|
||||
System.out.println("Create paintbrush AFTER creating robots.");
|
||||
paintMats[2] = Material.FindSimiliar(new RobotBlocker(robot, new Color(255,128,0)));
|
||||
for (int a=0; a<level.items.size(); a++)
|
||||
if (((Item)level.items.elementAt(a)).getClass().toString().endsWith("WhiteRobot"))
|
||||
robot = (GenericRobot) level.items.elementAt(a);
|
||||
paintMats[3] = Material.FindSimiliar(new RobotBlocker(robot, Color.white));
|
||||
for (int a=0; a<level.items.size(); a++)
|
||||
if (((Item)level.items.elementAt(a)).getClass().toString().endsWith("BlueRobot"))
|
||||
robot = (GenericRobot) level.items.elementAt(a);
|
||||
paintMats[4] = Material.FindSimiliar(new RobotBlocker(robot, Color.blue));
|
||||
|
||||
paintIndex=0;
|
||||
matIndex = level.materials.indexOf(paintMats[paintIndex]);
|
||||
|
||||
}
|
||||
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 boolean KeyUp(KeyEvent e)
|
||||
{
|
||||
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_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_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() == e.VK_SLASH)
|
||||
{
|
||||
if (level.helpCam == null) return false;
|
||||
level.player = level.helpCam;
|
||||
level.currentViewer = level.helpCam;
|
||||
}
|
||||
if (e.getKeyCode() == e.VK_RIGHT)
|
||||
{
|
||||
if (e.isShiftDown())
|
||||
SetRoom(room.rightRoom);
|
||||
if (carriedBy==null)
|
||||
MoveRight(e.isControlDown());
|
||||
repeating=0;
|
||||
return true;
|
||||
}
|
||||
if (e.getKeyCode() == e.VK_LEFT)
|
||||
{
|
||||
if (e.isShiftDown())
|
||||
SetRoom(room.leftRoom);
|
||||
if (carriedBy==null)
|
||||
MoveLeft(e.isControlDown());
|
||||
repeating=0;
|
||||
return true;
|
||||
}
|
||||
if (e.getKeyCode() == e.VK_UP)
|
||||
{
|
||||
if (e.isShiftDown())
|
||||
SetRoom(room.upRoom);
|
||||
if (carriedBy==null)
|
||||
MoveUp(e.isControlDown());
|
||||
repeating=0;
|
||||
return true;
|
||||
}
|
||||
if (e.getKeyCode() == e.VK_DOWN)
|
||||
{
|
||||
if (e.isShiftDown())
|
||||
SetRoom(room.downRoom);
|
||||
if (carriedBy==null)
|
||||
MoveDown(e.isControlDown());
|
||||
repeating=0;
|
||||
return true;
|
||||
}
|
||||
if (e.getKeyCode() == e.VK_P)
|
||||
{
|
||||
paintIndex++;
|
||||
if (paintIndex==5) paintIndex=0;
|
||||
matIndex = level.materials.indexOf(paintMats[paintIndex]);
|
||||
currentIcon=icons[paintIndex].getImage();
|
||||
}
|
||||
if (e.getKeyCode() == e.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;
|
||||
}
|
||||
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();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user