nomadburger.blogg.se

Bluej program to make a game
Bluej program to make a game














The loop ends if the player or enemy's health falls to or below 0, and a congratulatory or sorry! message is printed depending on which fell to or below 0 first. A message indicating which skill the player and enemy used is then printed, and the health and energy of player and enemy are displayed. After the player enters a skill, a random integer 1-8 is generated and conditional statements similar to the ones for the player make relevant calculations to the enemy's state. For example, if a player enters "2" (a damage skill), that integer will act as the element of the ArrayList, and subtract health from the enemy state and energy from the player state. The integer between 1 and 8 that the user enters is stored in a Scanner variable, and then conditional statements based on whether the skill is damage, healing, or energy regen, make calculations to the player's or enemy's state, 2 classes which have 2 fields, health and energy. When the game starts, it prints a welcome message and instructions to the terminal and asks the user to "use" a skill. It has 6 interacting classes, 2 of which were ArrayLists, each with a collection of 8 "skills", which are objects that have a name, energy cost, delta, and type ("damage," "healing" or "energy regen"). The original game worked by printing messages to and getting user input from the terminal.

bluej program to make a game

#Bluej program to make a game how to#

I learned how to implement basic graphics by using a java applet and using the paint() method to create the game screen. I am writing a simple java game for a programming class and I would like to know how to integrate graphics into it (I am using BlueJ).














Bluej program to make a game