9/12/2023 0 Comments Greenfoot score counter![]() ![]() If(scoreCounter.getValue() < highScoreCounter. Public void act()//makes one virus spawn in a random location for every 100 calls of the act methodĪddObject(new Virus(), Greenfoot.getRandomNumber(680) + 100, Greenfoot.getRandomNumber(710) + 70 ) tValue(ORIGINAL_BEST_TIME) īestTimeHolder = ORIGINAL_BEST_TIME_HOLDER HighScoreCounter = new Counter("Best Time: " + bestTimeHolder + ": ") ![]() ScoreCounter = new Counter(player1.getName() + "'s Time: ") \nGood luck!") ĪddObject(new Key(), Greenfoot.getRandomNumber(680) + 100, Greenfoot.getRandomNumber(710) + 70 ) \nViruses will try to attack you but I have equipped you with weapons that will aid you on your quest. JOptionPane.showMessageDialog(null, "Nice to meet you" + " " + inputstr + "! \nI am sorry to tell you this but you are trapped in my system and the only way to get out is to collect the 9 keys in this world. ![]() String inputstr = JOptionPane.showInputDialog("Hello, thank you for playing 9 keys.\n What is your Name?") \n Be Careful!!! Bombs will destroy everything in range including keys and yourself") JOptionPane.showMessageDialog(null, "Instructions: \n \n Arrow Keys: Movement \n Q Key: fire arrow \n W Key: drop bomb \n Spacebar: pick up key \n Pick up all 9 keys to win. The player and the original virus start in the same spot but the keys are spawned in random locations which makes the game different every time. Public void populateWorld()//creates the player, all of the keys, and one virus. Create a new world with 600x400 cells with a cell size of 1x1 pixels. Public GameWorld1()//construcotr sets the spawnCounter to 100, populates the world, and starts the game * Constructor for objects of class GameWorld. Public static final String ORIGINAL_BEST_TIME_HOLDER = "Nobody" Public static final int ORIGINAL_BEST_TIME = 36000 Private int spawnCounter //the rate at which enemies spawn in the world. Public class GameWorld1 extends World//Class heading In the future I will have different levels which are the other GameWorlds. * At the moment this is the only gameworld class that has code in it. This class represents the world in which the game takes place. JOptionPane.Import greenfoot.* // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) If(scoreCounter.getValue() < highScoreCounter.getValue()) Any feedback would help java greenfoot Share Improve this question Follow edited at 9:10 the busybee 10. \nViruses will try to attack you but I have equipped you with weapons that will aid you on your quest. 1 I'm making a game right now and want to add a timer to count down to my end game screen, I can get the text to show up on my game screen but the numbers won't go down. ![]() Import greenfoot.* // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |