Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package src;
- public class MobBandit extends ObjectLiving{
- public String banditType;
- public MobBandit()
- {
- chooseType();
- hp = 8;
- strength = 2;
- setSpeed(2, 3);
- sprite = appendStringToType();
- loot = appendToType();
- goldDrop = 6;
- }
- public void chooseType()
- {
- int random = (int) (Math.random() * 2);
- if(random == 0)
- {
- banditType = "archer";
- }
- else if(random == 1)
- {
- banditType = "fighter";
- }
- }
- public String appendStringToType()
- {
- if(banditType == "archer")
- {
- return "/banditarcher.png";
- }
- else if(banditType == "fighter")
- {
- return "/bandit.png";
- }
- else return "/banit.png";
- }
- public Item appendToType()
- {
- if(banditType == "archer")
- {
- return Item.bone;
- }
- else if(banditType == "fighter")
- {
- return Item.swordSteel;
- }
- else return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement