import greenfoot.*; // (World, Actor, GreenfootImage, and Greenfoot) import java.util.List; import javax.swing.*; import java.util.ArrayList; public class Player1 extends Actor { private static final int EAST = 0; private static final int WEST = 1; private static final int NORTH = 2; private static final int SOUTH = 3; private int direction; private int leavesEaten; boolean shoot = false; int x; public Player1() { setDirection(EAST); } int coincount = 0; Bullet b = new Bullet(); public int nom = 1; public int getNom() { return nom; } public void act() { if(processKeys()); if(foundMONEY()) { ++coincount; eatCoin(); } if(Greenfoot.isKeyDown("1")) getWorld().addObject(b, getX() + 1, getY()); if(foundStore()) { String Choice; int ChoiceFix; int Choice1 = 1; int Choice2 = 2; int Choice3 = 3; int Choice4 = 4; int Choice5 = 5; int Choice6 = 6; int Choice7 = 7; int Choice8 = 8; int choice9 = 9; Choice = JOptionPane.showInputDialog(null, "Hello! Welcome to the store!\nYou have " + coincount + " coins!\n1. Buy grey- 2 coins \n2. Buy blue- 2 coins \n3. Buy green- 2 coins \n4. Buy red- 2 coins \n5. Buy white- 2 coins \n6. Buy black- 3 coins \n7. Buy gold- 3 coins \n8. Buy NPC1- 5 coins\n9. Buy ZOMBEH- 10 coins"); ChoiceFix = Integer.parseInt(Choice); Actor Player1 = getOneObjectAtOffset(0, 0, Player1.class); World myWorld = getWorld(); if (ChoiceFix == 1){ if(coincount < 2){ JOptionPane.showMessageDialog(null, "Sorry, you do not have enough money to buy this"); setLocation(getX() + 1, getY());} else {--coincount; --coincount; setImage("greyPlayer.png"); nom = 1; setLocation(getX() + 1, getY());} }
import greenfoot.*; // (World, Actor, GreenfootImage, and Greenfoot) import java.util.Random; import java.util.List; import java.util.ArrayList; import javax.swing.JOptionPane; import java.awt.*; public class Zombeh extends Actor { private static final int EAST = 0; private static final int WEST = 1; private static final int NORTH = 2; private static final int SOUTH = 3; private int direction; public void Zombeh() { setDirection(EAST); } public void act() { int nom = Player1.getNom();