Posted by Epitaph64 on Sun 14 Jun 00:13
report abuse | download | new post
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package bytemasking;
- /**
- *
- * @author Walter
- */
- public class Main {
- /* Player Properties by Bit
- * 64 - Is the player alive
- * 32 - Is the player male
- * 16 & 8 - Is the player a Warrior, Rogue, Mage, or Druid
- * ( 1 is Warrior, 2 is Rogue, 3 is Mage, 4 is Druid )
- * 4, 2 & 1 - What is the player's level between 1 and 8
- */
- {
- for (int i = 0; i < 5; i++)
- {
- }
- }
- {
- boolean playerAlive = false;
- boolean playerMale = false;
- int playerClass = 0;
- int playerLevel = 0;
- if ((playerData & 64) != 0)
- {
- playerAlive = true;
- }
- if ((playerData & 32) != 0)
- {
- playerMale = true;
- }
- if ((playerData & 16) != 0)
- {
- playerClass += 2;
- }
- if ((playerData & 16) != 0)
- {
- playerClass += 1;
- }
- playerLevel += (playerData &= 7) + 1;
- String playerDescription = "";
- playerDescription += "The player is a level " + playerLevel;
- String playerClassName = "Citizen";
- switch(playerClass)
- {
- case 0:
- {
- playerClassName = "Warrior";
- break;
- }
- case 1:
- {
- playerClassName = "Rogue";
- break;
- }
- case 2:
- {
- playerClassName = "Mage";
- break;
- }
- case 3:
- {
- playerClassName = "Druid";
- break;
- }
- }
- playerDescription += " " + playerClassName + " ";
- if (playerMale)
- {
- playerDescription += "Male who is ";
- }
- else
- {
- playerDescription += "Female who is ";
- }
- if (playerAlive)
- {
- playerDescription += "Alive.";
- }
- else
- {
- playerDescription += "Dead.";
- }
- return playerDescription;
- }
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.