/** * Check character collision with all kinds of objects * * @param x X Coordinate * @param y Y Coordinate * @return if Character is about to collide with something */ public boolean Collision(double x, double y) { boolean blnCol = false; // Wall Collision for (int i = 0; i < MAP.size(); i++) { blnCol = blnCol || WallCollision(x, y, MAP.elementAt(i)); } // Game Object Collision for (int i = 0; i < OBJECTS.size(); i++) { blnCol = blnCol || ObjectCollision(x, y, OBJECTS.elementAt(i)); } // Game Character collision for (int i = 0; i < CHARACTERS.size(); i++) { blnCol = blnCol || CharacterCollision(x, y, CHARACTERS.elementAt(i)); } // Game Building Collision for (int i = 0; i < BUILD.size(); i++) { blnCol = blnCol || BuildingCollision(x, y, BUILD.elementAt(i)); } return blnCol; }
/** * Used for debugging get list of spells available to character * * @return List */ public String[] getSpellList() { // Make Array String[] arg = new String[SPELL_LIST.size()]; // Assign names for (int i = 0; i < arg.length; i++) { arg[i] = SPELL_LIST.elementAt(i)[0].NAME; System.out.println(arg[i]); } // Return list return arg; }
public void giveQuest(GameCharacter Reciever) { if (QUEST_LIST.size() > 0) { if (QUEST_LIST.elementAt(0).STATUS == 0) { Reciever.QUEST_LIST.add(QUEST_LIST.elementAt(0)); QUEST_LIST.elementAt(0).play_UpdateSound(); if (QUEST_LIST.elementAt(0).QTYPE == Quest_Type.DELIVERY) { for (int i = 0; i < QUEST_LIST.elementAt(0).TARGET_LIST.ITEM_NAME.size(); i++) { Reciever.INVENTORY.addItem( QUEST_LIST.elementAt(0).TARGET_LIST.ITEM_NAME.elementAt(i), QUEST_LIST.elementAt(0).TARGET_LIST.ITEM_PRICE.elementAt(i), QUEST_LIST.elementAt(0).TARGET_LIST.ITEM_QUANTITY.elementAt(i), QUEST_LIST.elementAt(0).TARGET_LIST.ITEM_IMAGE.elementAt(i), QUEST_LIST.elementAt(0).TARGET_LIST.ITEM_TAG.elementAt(i), QUEST_LIST.elementAt(0).TARGET_LIST.STATS.elementAt(i)); } } QUEST_LIST.elementAt(0).STATUS = 1; } } }
/** * Draw character in game window * * @param g Graphics * @param Dx X Displacement * @param Dy Y Displacement * @param G Growth factor */ public void Draw(Graphics g, int Dx, int Dy, double G) { // Draw blood if (ISDEAD) { g.drawImage( imgBLOOD, (int) (X + Dx - 25), (int) (Y + Dy - 15), (int) (W * GROWTHFACTOR + 35), (int) (H * GROWTHFACTOR + 35), null); } // Quest Givers if (CLASS != "Player") { for (int i = 0; i < QUEST_LIST.size(); i++) { if (QUEST_LIST.elementAt(i).STATUS == 0) { g.drawImage(imgQStart, (int) (X + Dx + 5), (int) (Y + Dy - 30), (int) W, 35, null); } else if (QUEST_LIST.elementAt(i).STATUS == 2) { g.drawImage(imgQEnd, (int) (X + Dx), (int) (Y + Dy - 30), (int) W + 5, 35, null); } } } // Draw character g.drawImage( imgCHARAC, (int) (X + Dx), (int) (Y + Dy), (int) (X + Dx + W * G), (int) (Y + Dy + H * G), (int) (W * FX), (int) (H * FY), (int) (W * FX + W), (int) (H * FY + H), null); GROWTHFACTOR = G; }