Question: Build a pretend adventure game with JavaFX: Create a 2d Array/ArrayList of Rooms, about 10x10 or large, at the edges, or if a room is

Build a pretend adventure game with JavaFX:


Create a 2d Array/ArrayList of Rooms, about 10x10 or large, at the edges, or if a room is blocked, don't let them travel to it with the navigation buttons.

Create a class from Room that stores whether it is blocked or not, and the NPC for that room, how much gold there is to find.

 

Player Character ( class )

-Hit Points - start with 20

- Strength - 3 rolls of a 6 sided die

- Dexterity - 3 rolls of a 6 sided die 

- Intelligence - 3 rolls of a 6 sided die

- total gold

 

In a room, there is a 1 in 2 chance of encountering a NPC to fight/run away from.  Or if there is no NPC, or after you kill it, you can search the room for gold or sleep.

 

Non Player Characters ( monsters )

- Hit Points - randomly 1-6 ( use the same number for the stats below )

- Strength ( 1-6 ) x 2

- Dexterity ( 1-6 ) x 2 

- Intelligence ( 1-6 ) x 2 

 

 

- Searching the room, 'roll' a 20 sided die, and if we roll a value < our intelligence, we find a the gold in the room  ( you pick some random amount in the code ).

- Fight - 'roll' a 20 sided die, if we roll >= monster dexterity, we hit.  They take our strength / 3 damage if hit ( reduces NPC hit points by that value ).

  after we attack, if the monster is alive ( has > 0 hit points ) it can attack us, same rules, but in reverse ( minimum 1 damage )

- Run away - the monster gets to make 1 attack as we run away if it "sees" us, roll a 20 sided die, if it rolls < it's intelligence it saw us and gets to attack. ( go to the previous room, or random direction, or let them pick )

- Sleep, if we sleep, we regain all of our hit points, but there is a 1/6 chance a NPC finds us while sleeping and gets to attack us ( add a new NPC to the room )

 

Game runs forever, or until the player dies.

Step by Step Solution

3.33 Rating (147 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The answer provided below has been developed in a clear step by step manner Step 1 Create a class from Room that stores its location whether it is blocked or not and the NPC for that room how much gol... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!