Completed ShipWarfareGUI

This commit is contained in:
KahootChampion
2019-03-25 11:06:39 -06:00
parent 5caca9c9e3
commit 61f88c0a86
3 changed files with 944 additions and 160 deletions

436
.idea/workspace.xml generated
View File

@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3114a2b9-4919-4fdf-8fd9-d03b60109ce4" name="Default Changelist" comment="Made the fight gif runnable by everyone hopefully"> <list default="true" id="3114a2b9-4919-4fdf-8fd9-d03b60109ce4" name="Default Changelist" comment="Completed ShipWarfareGUI">
<change afterPath="$PROJECT_DIR$/src/ShipsRunning.gif" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ShipWarfareGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ShipWarfareGUI.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/saves/playerSave.txt" beforeDir="false" afterPath="$PROJECT_DIR$/src/saves/playerSave.txt" afterDir="false" />
</list> </list>
<ignored path="$PROJECT_DIR$/out/" /> <ignored path="$PROJECT_DIR$/out/" />
<ignored path="C:\Users\Harkamal Randhawa\IdeaProjects\TaipanClone\.idea\shelf/" /> <ignored path="C:\Users\Harkamal Randhawa\IdeaProjects\TaipanClone\.idea\shelf/" />
@@ -20,8 +19,8 @@
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java"> <entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="99"> <state relative-caret-position="-1380">
<caret line="466" column="51" lean-forward="true" selection-start-line="466" selection-start-column="51" selection-end-line="466" selection-end-column="51" /> <caret line="341" column="35" lean-forward="true" selection-start-line="341" selection-start-column="35" selection-end-line="341" selection-end-column="35" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
@@ -30,20 +29,44 @@
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ShipsRunning.gif"> <entry file="file://$PROJECT_DIR$/src/TaipanShopGUI.java">
<provider selected="true" editor-type-id="images" /> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="291">
<caret line="277" column="43" selection-start-line="277" selection-start-column="43" selection-end-line="277" selection-end-column="43" />
<folding>
<element signature="n#!!doc" expanded="true" />
</folding>
</state>
</provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/ShipsAttacking.gif"> <entry file="file://$PROJECT_DIR$/src/MainGUI.java">
<provider selected="true" editor-type-id="images" /> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="356">
<caret line="28" selection-start-line="18" selection-start-column="4" selection-end-line="28" />
<folding>
<element signature="e#551#552#0" expanded="true" />
<element signature="e#579#580#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/GameEndGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="750">
<caret line="56" column="24" selection-start-line="56" selection-start-column="24" selection-end-line="56" selection-end-column="24" />
</state>
</provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/TravelGUI.java"> <entry file="file://$PROJECT_DIR$/src/TravelGUI.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="251"> <state relative-caret-position="313">
<caret line="180" column="18" selection-start-line="180" selection-start-column="18" selection-end-line="182" selection-end-column="17" /> <caret line="188" column="11" selection-start-line="188" selection-start-column="11" selection-end-line="188" selection-end-column="11" />
</state> </state>
</provider> </provider>
</entry> </entry>
@@ -54,41 +77,42 @@
<option name="RECENT_TEMPLATES"> <option name="RECENT_TEMPLATES">
<list> <list>
<option value="Class" /> <option value="Class" />
<option value="JavaFXApplication" />
</list> </list>
</option> </option>
</component> </component>
<component name="FindInProjectRecents"> <component name="FindInProjectRecents">
<findStrings> <findStrings>
<find>initialize</find> <find>.setvis</find>
<find>gif</find> <find>durati</find>
<find>shipsRemainingGIF</find> <find>setText</find>
<find>initial</find> <find>setVisi</find>
<find>initializeS</find> <find>continue</find>
<find>ship</find> <find>userSh</find>
<find>imageView</find> <find>continueButton</find>
<find>20</find> <find>continueButton.setV</find>
<find>shipsAttackingGif.set</find> <find>.setText</find>
<find>continueto</find> <find>.setVisi</find>
<find>setprefwidth</find> <find>taipanSH</find>
<find>setvisible(false)</find> <find>runButton.setOn</find>
<find>chooseF</find> <find>runButton.se</find>
<find>setPadd</find> <find>setVis</find>
<find>setvisible</find> <find>counter</find>
<find>vbox.se</find> <find>stage</find>
<find>attacking</find>
<find>would</find>
<find>choosefightorrun.set</find>
<find>setpre</find>
<find>run</find> <find>run</find>
<find>setvisi</find> <find>flee</find>
<find>fightand</find> <find>runFrom</find>
<find>shipWarfa</find> <find>report</find>
<find>imageview</find> <find>report.setVisible</find>
<find>image</find> <find>playerSh</find>
<find>shipsAttack</find> <find>fightButton</find>
<find>shipsAttackingOr</find> <find>PlayerSh</find>
<find>ships</find> <find>andT</find>
<find>shipw</find> <find>dest</find>
<find>playerShoots</find>
<find>shotsFired</find>
<find>duration</find>
<find>shop()</find>
</findStrings> </findStrings>
<replaceStrings> <replaceStrings>
<replace>HP</replace> <replace>HP</replace>
@@ -100,6 +124,12 @@
<replace>attackImage</replace> <replace>attackImage</replace>
<replace>shipsAttacking</replace> <replace>shipsAttacking</replace>
<replace>shipsApproachingGIF</replace> <replace>shipsApproachingGIF</replace>
<replace>centeringLittyShipPane</replace>
<replace>numOfLittyShips</replace>
<replace>startingLitty</replace>
<replace>littyShip</replace>
<replace>whenfinished</replace>
<replace>whenFinished</replace>
</replaceStrings> </replaceStrings>
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
@@ -116,11 +146,12 @@
<option value="$PROJECT_DIR$/src/main.java" /> <option value="$PROJECT_DIR$/src/main.java" />
<option value="$PROJECT_DIR$/src/Travel.java" /> <option value="$PROJECT_DIR$/src/Travel.java" />
<option value="$PROJECT_DIR$/src/ShipWarfare.java" /> <option value="$PROJECT_DIR$/src/ShipWarfare.java" />
<option value="$PROJECT_DIR$/src/TaipanShopGUI.java" />
<option value="$PROJECT_DIR$/src/StartGUI.java" /> <option value="$PROJECT_DIR$/src/StartGUI.java" />
<option value="$PROJECT_DIR$/src/Player.java" /> <option value="$PROJECT_DIR$/src/Player.java" />
<option value="$PROJECT_DIR$/src/AnimationTesting.java" />
<option value="$PROJECT_DIR$/src/TravelGUI.java" /> <option value="$PROJECT_DIR$/src/TravelGUI.java" />
<option value="$PROJECT_DIR$/src/ShipWarfareGUI.java" /> <option value="$PROJECT_DIR$/src/ShipWarfareGUI.java" />
<option value="$PROJECT_DIR$/src/TaipanShopGUI.java" />
</list> </list>
</option> </option>
</component> </component>
@@ -135,7 +166,6 @@
<foldersAlwaysOnTop value="true" /> <foldersAlwaysOnTop value="true" />
</navigator> </navigator>
<panes> <panes>
<pane id="Scope" />
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<expand> <expand>
@@ -148,18 +178,25 @@
<item name="TaipanClone" type="462c0819:PsiDirectoryNode" /> <item name="TaipanClone" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" /> <item name="src" type="462c0819:PsiDirectoryNode" />
</path> </path>
<path>
<item name="TaipanClone" type="b2602c69:ProjectViewProjectNode" />
<item name="TaipanClone" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="images" type="462c0819:PsiDirectoryNode" />
</path>
</expand> </expand>
<select /> <select />
</subPane> </subPane>
</pane> </pane>
<pane id="PackagesPane" /> <pane id="PackagesPane" />
<pane id="Scope" />
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="ChangesTree.GroupingKeys" value="" /> <property name="ChangesTree.GroupingKeys" value="" />
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" /> <property name="aspect.path.notification.shown" value="true" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1552534669451" /> <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1553533565975" />
<property name="extract.method.default.visibility" value="public" /> <property name="extract.method.default.visibility" value="public" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../GitHub/Cpsc233" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/../GitHub/Cpsc233" />
<property name="project.structure.last.edited" value="Modules" /> <property name="project.structure.last.edited" value="Modules" />
@@ -169,6 +206,7 @@
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS"> <key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/images" />
<recent name="$PROJECT_DIR$/src" /> <recent name="$PROJECT_DIR$/src" />
</key> </key>
</component> </component>
@@ -185,15 +223,15 @@
</option> </option>
</component> </component>
<component name="RunManager" selected="Application.MainGUI"> <component name="RunManager" selected="Application.MainGUI">
<configuration name="Game" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> <configuration name="MainGUI" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Game" /> <option name="MAIN_CLASS_NAME" value="MainGUI" />
<module name="TaipanClone" /> <module name="TaipanClone" />
<method v="2"> <method v="2">
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration name="MainGUI" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> <configuration name="ShipWarfareGUI" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="MainGUI" /> <option name="MAIN_CLASS_NAME" value="ShipWarfareGUI" />
<module name="TaipanClone" /> <module name="TaipanClone" />
<method v="2"> <method v="2">
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
@@ -222,18 +260,18 @@
</configuration> </configuration>
<list> <list>
<item itemvalue="Application.TaipanShop" /> <item itemvalue="Application.TaipanShop" />
<item itemvalue="Application.Game" />
<item itemvalue="Application.main" /> <item itemvalue="Application.main" />
<item itemvalue="Application.ShipWarfareGUI" /> <item itemvalue="Application.ShipWarfareGUI" />
<item itemvalue="Application.MainGUI" /> <item itemvalue="Application.MainGUI" />
<item itemvalue="Application.ShipWarfareGUI" />
</list> </list>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Application.MainGUI" /> <item itemvalue="Application.MainGUI" />
<item itemvalue="Application.ShipWarfareGUI" /> <item itemvalue="Application.ShipWarfareGUI" />
<item itemvalue="Application.ShipWarfareGUI" />
<item itemvalue="Application.main" /> <item itemvalue="Application.main" />
<item itemvalue="Application.TaipanShop" /> <item itemvalue="Application.TaipanShop" />
<item itemvalue="Application.Game" />
</list> </list>
</recent_temporary> </recent_temporary>
</component> </component>
@@ -288,63 +326,17 @@
<workItem from="1553047073421" duration="2245000" /> <workItem from="1553047073421" duration="2245000" />
<workItem from="1553050110780" duration="21000" /> <workItem from="1553050110780" duration="21000" />
<workItem from="1553051761247" duration="104000" /> <workItem from="1553051761247" duration="104000" />
<workItem from="1553051882218" duration="9623000" /> <workItem from="1553051882218" duration="12177000" />
</task> <workItem from="1553369996499" duration="3948000" />
<task id="LOCAL-00001" summary="This should fix the ShipWarfare file and bring it up to date with the rest of the file."> <workItem from="1553376520648" duration="32000" />
<created>1550458470138</created> <workItem from="1553383476219" duration="1349000" />
<option name="number" value="00001" /> <workItem from="1553386923955" duration="4000" />
<option name="presentableId" value="LOCAL-00001" /> <workItem from="1553387088425" duration="330000" />
<option name="project" value="LOCAL" /> <workItem from="1553387443301" duration="11000" />
<updated>1550458470138</updated> <workItem from="1553387530005" duration="22322000" />
</task> <workItem from="1553444493182" duration="159000" />
<task id="LOCAL-00002" summary="Created Core class"> <workItem from="1553444769737" duration="82000" />
<created>1550540282400</created> <workItem from="1553444880371" duration="34292000" />
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1550540282400</updated>
</task>
<task id="LOCAL-00003" summary="Created Player class">
<created>1550540820542</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1550540820542</updated>
</task>
<task id="LOCAL-00004" summary="Created Player class">
<created>1550541406597</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1550541406597</updated>
</task>
<task id="LOCAL-00005" summary="Fixed the setters to be greater than 0">
<created>1550541751914</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1550541751914</updated>
</task>
<task id="LOCAL-00006" summary="Created Player class">
<created>1550543764970</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1550543764971</updated>
</task>
<task id="LOCAL-00007" summary="Added some stuff for the Travel Class">
<created>1550575512841</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1550575512841</updated>
</task>
<task id="LOCAL-00008" summary="Added disasters as well as removing a bug from the flee method in Haris's code">
<created>1550623749854</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1550623749854</updated>
</task> </task>
<task id="LOCAL-00009" summary="Fixed a bunch of stuff inside of Travel, but also discovered a MASSIVE problem with our code"> <task id="LOCAL-00009" summary="Fixed a bunch of stuff inside of Travel, but also discovered a MASSIVE problem with our code">
<created>1550628232136</created> <created>1550628232136</created>
@@ -591,17 +583,115 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1553061205759</updated> <updated>1553061205759</updated>
</task> </task>
<option name="localTasksCounter" value="44" /> <task id="LOCAL-00044" summary="Ayy added all the gifs needed.">
<created>1553124112040</created>
<option name="number" value="00044" />
<option name="presentableId" value="LOCAL-00044" />
<option name="project" value="LOCAL" />
<updated>1553124112040</updated>
</task>
<task id="LOCAL-00045" summary="Maybe this is whack idk">
<created>1553193939606</created>
<option name="number" value="00045" />
<option name="presentableId" value="LOCAL-00045" />
<option name="project" value="LOCAL" />
<updated>1553193939606</updated>
</task>
<task id="LOCAL-00046" summary="Litty Animation Practice">
<created>1553387960582</created>
<option name="number" value="00046" />
<option name="presentableId" value="LOCAL-00046" />
<option name="project" value="LOCAL" />
<updated>1553387960582</updated>
</task>
<task id="LOCAL-00047" summary="Added gifs back">
<created>1553389067767</created>
<option name="number" value="00047" />
<option name="presentableId" value="LOCAL-00047" />
<option name="project" value="LOCAL" />
<updated>1553389067767</updated>
</task>
<task id="LOCAL-00048" summary="Added method for animation">
<created>1553390319733</created>
<option name="number" value="00048" />
<option name="presentableId" value="LOCAL-00048" />
<option name="project" value="LOCAL" />
<updated>1553390319734</updated>
</task>
<task id="LOCAL-00049" summary="Litty Animation Practice littier">
<created>1553390384762</created>
<option name="number" value="00049" />
<option name="presentableId" value="LOCAL-00049" />
<option name="project" value="LOCAL" />
<updated>1553390384762</updated>
</task>
<task id="LOCAL-00050" summary="Sep up the scene which will be used for animation">
<created>1553400771267</created>
<option name="number" value="00050" />
<option name="presentableId" value="LOCAL-00050" />
<option name="project" value="LOCAL" />
<updated>1553400771272</updated>
</task>
<task id="LOCAL-00051" summary="Made fight button basically functional for AnimationTesting">
<created>1553476072174</created>
<option name="number" value="00051" />
<option name="presentableId" value="LOCAL-00051" />
<option name="project" value="LOCAL" />
<updated>1553476072175</updated>
</task>
<task id="LOCAL-00052" summary="changed some stuff related to the fight button animation">
<created>1553478643204</created>
<option name="number" value="00052" />
<option name="presentableId" value="LOCAL-00052" />
<option name="project" value="LOCAL" />
<updated>1553478643204</updated>
</task>
<task id="LOCAL-00053" summary="Small error in animation whcih shoots even if no guns must fix that">
<created>1553482933744</created>
<option name="number" value="00053" />
<option name="presentableId" value="LOCAL-00053" />
<option name="project" value="LOCAL" />
<updated>1553482933744</updated>
</task>
<task id="LOCAL-00054" summary="Fixed the issue where the ship shot with no guns">
<created>1553484357669</created>
<option name="number" value="00054" />
<option name="presentableId" value="LOCAL-00054" />
<option name="project" value="LOCAL" />
<updated>1553484357670</updated>
</task>
<task id="LOCAL-00055" summary="ShipWarfare javaDocs completed">
<created>1553485725159</created>
<option name="number" value="00055" />
<option name="presentableId" value="LOCAL-00055" />
<option name="project" value="LOCAL" />
<updated>1553485725159</updated>
</task>
<task id="LOCAL-00056" summary="Completed ShipWarfareGUI">
<created>1553486334208</created>
<option name="number" value="00056" />
<option name="presentableId" value="LOCAL-00056" />
<option name="project" value="LOCAL" />
<updated>1553486334209</updated>
</task>
<task id="LOCAL-00057" summary="Fixed silk issue">
<created>1553533396273</created>
<option name="number" value="00057" />
<option name="presentableId" value="LOCAL-00057" />
<option name="project" value="LOCAL" />
<updated>1553533396273</updated>
</task>
<option name="localTasksCounter" value="58" />
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="99878000" /> <option name="totallyTimeSpent" value="164961000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="0" y="23" width="1189" height="652" extended-state="0" /> <frame x="0" y="23" width="1189" height="652" extended-state="0" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.32519618" /> <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2205754" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" /> <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Image Layers" order="2" /> <window_info id="Image Layers" order="2" />
<window_info id="Designer" order="3" /> <window_info id="Designer" order="3" />
@@ -610,7 +700,7 @@
<window_info id="Favorites" order="6" side_tool="true" /> <window_info id="Favorites" order="6" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32922733" /> <window_info anchor="bottom" id="Find" order="1" weight="0.32922733" />
<window_info anchor="bottom" id="Run" order="2" weight="0.9357143" /> <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.22678572" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@@ -698,21 +788,7 @@
<ignored-roots> <ignored-roots>
<path value="$PROJECT_DIR$" /> <path value="$PROJECT_DIR$" />
</ignored-roots> </ignored-roots>
<MESSAGE value="Super broken but fight button is in progress for shipwarfare" />
<MESSAGE value="Forces you to fight in ShipWarfareGUI unfortunately" />
<MESSAGE value="ShipWarfare fight button coming along nicely" />
<MESSAGE value="Shipwarfare fight button GUI almost complete" />
<MESSAGE value="Fixed numOfShips method for ShipWarfareGUI" />
<MESSAGE value="Fixed the loot system a bit" />
<MESSAGE value="Completely ruined shipWarfare with a previous edit, fixed it and added a better loot feature for peasant ships" />
<MESSAGE value="Basic functionality of buttons completed, think all I have to do now is to find a way to break the code when the user wins, loses or runs away." />
<MESSAGE value="Fixed probability of ships running away" />
<MESSAGE value="Fined minor bugs in shipwarfareGUI" />
<MESSAGE value="Fined minor bugs in shipwarfareGUI including the &quot;gun frustration&quot; variable" />
<MESSAGE value="Just checking" />
<MESSAGE value="A lot of errors but easily fixable SHipwarfareGUI" />
<MESSAGE value="Completed SHipWarfareGUI" /> <MESSAGE value="Completed SHipWarfareGUI" />
<MESSAGE value="Completed ShipWarfareGUI" />
<MESSAGE value="Probably should upload" /> <MESSAGE value="Probably should upload" />
<MESSAGE value="Fixed ShipWarfare bug about one-shotting." /> <MESSAGE value="Fixed ShipWarfare bug about one-shotting." />
<MESSAGE value="Completed javadocs for shipwarfare GUI" /> <MESSAGE value="Completed javadocs for shipwarfare GUI" />
@@ -723,7 +799,21 @@
<MESSAGE value="wrote javadocs for authorname" /> <MESSAGE value="wrote javadocs for authorname" />
<MESSAGE value="Added fight Button gif. Might not work on your computers yet though... I inputed my own local documents folder as the library temporarily." /> <MESSAGE value="Added fight Button gif. Might not work on your computers yet though... I inputed my own local documents folder as the library temporarily." />
<MESSAGE value="Made the fight gif runnable by everyone hopefully" /> <MESSAGE value="Made the fight gif runnable by everyone hopefully" />
<option name="LAST_COMMIT_MESSAGE" value="Made the fight gif runnable by everyone hopefully" /> <MESSAGE value="Ayy added all the gifs needed." />
<MESSAGE value="Maybe this is whack idk" />
<MESSAGE value="Litty Animation Practice" />
<MESSAGE value="Added gifs back" />
<MESSAGE value="Added method for animation" />
<MESSAGE value="Litty Animation Practice littier" />
<MESSAGE value="Sep up the scene which will be used for animation" />
<MESSAGE value="Made fight button basically functional for AnimationTesting" />
<MESSAGE value="changed some stuff related to the fight button animation" />
<MESSAGE value="Small error in animation whcih shoots even if no guns must fix that" />
<MESSAGE value="Fixed the issue where the ship shot with no guns" />
<MESSAGE value="ShipWarfare javaDocs completed" />
<MESSAGE value="Completed ShipWarfareGUI" />
<MESSAGE value="Fixed silk issue" />
<option name="LAST_COMMIT_MESSAGE" value="Fixed silk issue" />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="uml://JAVA/ShipWarfare"> <entry file="uml://JAVA/ShipWarfare">
@@ -794,13 +884,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/GameEndGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="14" column="13" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/LoanSharkGUI.java"> <entry file="file://$PROJECT_DIR$/src/LoanSharkGUI.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30"> <state relative-caret-position="30">
@@ -815,28 +898,7 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/MainGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
<folding>
<element signature="e#551#552#0" expanded="true" />
<element signature="e#579#580#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Ships Approaching.gif" /> <entry file="file://$PROJECT_DIR$/src/Ships Approaching.gif" />
<entry file="file://$PROJECT_DIR$/src/TaipanShopGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="4902">
<caret line="370" column="35" selection-start-line="370" selection-start-column="35" selection-end-line="370" selection-end-column="35" />
<folding>
<element signature="n#!!doc" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Player.java"> <entry file="file://$PROJECT_DIR$/src/Player.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300"> <state relative-caret-position="300">
@@ -844,23 +906,77 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/ShipsAttacking.gif"> <entry file="file://$PROJECT_DIR$/src/ShipsRunning.gif" />
<entry file="file://$PROJECT_DIR$/src/images/ShipsRunning.gif">
<provider selected="true" editor-type-id="images" /> <provider selected="true" editor-type-id="images" />
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/ShipsRunning.gif"> <entry file="file://$PROJECT_DIR$/src/images/ShipsAttacking.gif">
<provider selected="true" editor-type-id="images" /> <provider selected="true" editor-type-id="images" />
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/TravelGUI.java"> <entry file="file://$PROJECT_DIR$/src/FinalShipWarfareGUI.java" />
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/javafx-src.zip!/javafx/application/Application.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="251"> <state relative-caret-position="842">
<caret line="180" column="18" selection-start-line="180" selection-start-column="18" selection-end-line="182" selection-end-column="17" /> <caret line="145" column="7" lean-forward="true" selection-start-line="145" selection-start-column="7" selection-end-line="145" selection-end-column="7" />
</state>
</provider>
</entry>
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/javafx-src.zip!/javafx/event/EventHandler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="298">
<caret line="44" column="9" selection-start-line="44" selection-start-column="9" selection-end-line="44" selection-end-column="9" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/GameEndGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="750">
<caret line="56" column="24" selection-start-line="56" selection-start-column="24" selection-end-line="56" selection-end-column="24" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/MainGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="356">
<caret line="28" selection-start-line="18" selection-start-column="4" selection-end-line="28" />
<folding>
<element signature="e#551#552#0" expanded="true" />
<element signature="e#579#580#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java"> <entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="99"> <state relative-caret-position="104">
<caret line="466" column="51" lean-forward="true" selection-start-line="466" selection-start-column="51" selection-end-line="466" selection-end-column="51" /> <caret line="156" column="7" lean-forward="true" selection-start-line="152" selection-start-column="4" selection-end-line="156" selection-end-column="7" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/TravelGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="313">
<caret line="188" column="11" selection-start-line="188" selection-start-column="11" selection-end-line="188" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/TaipanShopGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="291">
<caret line="277" column="43" selection-start-line="277" selection-start-column="43" selection-end-line="277" selection-end-column="43" />
<folding>
<element signature="n#!!doc" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/ShipWarfareGUI.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1380">
<caret line="341" column="35" lean-forward="true" selection-start-line="341" selection-start-column="35" selection-end-line="341" selection-end-column="35" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>

668
src/ShipWarfareGUI.java Normal file
View File

@@ -0,0 +1,668 @@
import javafx.animation.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
import javafx.util.Duration;
import java.io.FileInputStream;
import java.util.Random;
/**
* 2019-03-10 (Edited on 2019-03-23)
* Author: Haris Muhammad
* ShipWarfareGUI class, Generates and utilizes ships which the user can attack or run from
*/
public class ShipWarfareGUI extends Player {
private ShipWarfareGUI ship;
private Circle cannon;
private VBox buttonBox;
private HBox fightRunBox;
private Button fightButton;
private Button runButton;
private Button continueButton;
private VBox labelBox;
private Label title;
private Label HPLeft;
private Label gunsLeftOrTaken;
private Label runAwayOrLeft;
private Label shipsRemaining;
private Label report;
private boolean winOrLose= false;
private int counter1;
private int timeCounter;
private int numOfLittyShips = 0;
private boolean userAttacks = true;
private int startingLittyShips = 0;
private int howMuchRun = 0;
private int counter = 0;
private String pirateName = "Liu Yen";
private int beginningX = 150;
private int beginningY = 245;
private int endX = 350;
private int endY = 90;
private TranslateTransition shotsFired = new TranslateTransition();
private TranslateTransition enemyShots = new TranslateTransition();
/**
* constructor; only runs when a Player object is provided. The constructor is fully encapsulated.
*
* @param player is a Player object that will be copied and the player instance variable is set to the copy.
*/
public ShipWarfareGUI(Player player) {
Player playerDummy = new Player(player);
setPlayer(playerDummy);
}
/**
* The number of ships that attack is based on the amount of money one has on hand
*
* @return the number of ships which will attack
*/
public int numOfShips() {
int numOfShipsAttacking = 0;
Random randomValue = new Random();
if (getMoney() <= 100000) {
//Minimum one ship will attack, maximum 20
numOfShipsAttacking = randomValue.nextInt(20) + 1;
} else if (getMoney() <= 200000) {
//Minimum 30 Ships will attack, maximum 70
numOfShipsAttacking = randomValue.nextInt(40) + 31;
} else if (getMoney() <= 500000) {
//Minimum 50 ships will attack, maximum 140
numOfShipsAttacking = randomValue.nextInt(90) + 51;
} else if (getMoney() >= 1000000) {
//Minimum 100 ships will attack, maximum 300 ships
numOfShipsAttacking = randomValue.nextInt(200) + 101;
}
return numOfShipsAttacking;
}
/**
* setter method that takes in an integer as an argument
*
* @param numOfLittyShips the number of ships to be used in the peasant fleet attack
*/
public void setNumOfLittyShips(int numOfLittyShips) {
counter1++;
this.numOfLittyShips = numOfLittyShips;
if (counter1 == 1) {
startingLittyShips = numOfLittyShips;
}
}
/**
* One in two chance of running away
*
* @return true if the user is allowed to run, false if not, the "default" is false
*/
public boolean runFromShips() {
userAttacks = false;
Random randomValue = new Random();
int runSuccessChance = randomValue.nextInt(10) + 1;
if (runSuccessChance == 2) {
return true;
} else if (runSuccessChance == 1) {
return false;
}
return false;
}
/**
* Sets most of the labels invisible except for the "fight or run" label
*/
public void wipe() {
title.setVisible(false);
runAwayOrLeft.setVisible(false);
shipsRemaining.setVisible(false);
HPLeft.setVisible(false);
gunsLeftOrTaken.setVisible(false);
}
/**
* Sets most of the labels invisible including the fight or run label
*/
public void completeWipe() {
title.setVisible(false);
runAwayOrLeft.setVisible(false);
shipsRemaining.setVisible(false);
HPLeft.setVisible(false);
gunsLeftOrTaken.setVisible(false);
report.setVisible(false);
}
/**
* The user faces off against the litty ships and either prevails, dies, or runs away
*
* @return true if the user wins, loses, or flees, it returns false otherwise
*/
public boolean destroyLittyShipsOrEscape(Stage stage) throws Exception {
cannon.setLayoutX(beginningX);
cannon.setLayoutY(beginningY);
int calculateLoot = 0;
int chanceOfEnemyRun = 0;
int hitCounter = 0;
int missCounter = 0;
boolean gunFrustration = false;
Random randomValue = new Random();
int exitValue = 0;
//Player volley
//while (exitValue == 0) {
if (getGuns() > 0) {
for (int j = 0; j < getGuns(); j++) {
if (userAttacks == true) {
int hitOrMiss = randomValue.nextInt(2) + 1;
if (hitOrMiss == 2) {
numOfLittyShips--;
if (numOfLittyShips <= 0) {
exitValue = 1;
//break;
}
hitCounter++;
} else {
missCounter++;
}
} else {
//continue;
}
}
if (userAttacks == true) {
report.setText(String.format("Report: Ships hit: %d, Shots missed: %d", hitCounter, missCounter));
}
} else {
report.setText("We don't have any guns!!!");
}
if (numOfLittyShips <= 0) {
exitValue = 1;
//break;
}
if (getGuns() > 0) {
chanceOfEnemyRun = randomValue.nextInt(2) + 1;
if (chanceOfEnemyRun == 2) {
howMuchRun = randomValue.nextInt(15) + 1;
if (howMuchRun != 0 && howMuchRun < numOfLittyShips) {
setNumOfLittyShips(numOfLittyShips - howMuchRun);
if (userAttacks == true) {
if (howMuchRun > 0) {
runAwayOrLeft.setText(String.format("Cowards! %d ships ran away %s! ", howMuchRun, getName()));
//runAwayOrLeft.setVisible(true);
}
} else {
report.setText((String.format("Escaped %d of them %s!", howMuchRun, getName())));
}
}
}
}
shipsRemaining.setText(String.format("%d ships remaining and they look angry!", numOfLittyShips));
//Computer volley
int takeGunChance = randomValue.nextInt(4) + 1;
if (takeGunChance == 1 && getGuns() > 0) {
setGuns(getGuns() - 1);
gunFrustration = true;
} else {
if (numOfLittyShips > 0) {
int HPTaken = randomValue.nextInt(10);
setHP(getHP() - (HPTaken));
}
}
if (getHP() <= 0) {
exitValue = 2;
//break;
}
if (gunFrustration == true) {
gunsLeftOrTaken.setText(String.format("Dang it! We only have %d guns left", getGuns()));
} else {
gunsLeftOrTaken.setText(String.format("We still have %d guns left", getGuns()));
}
HPLeft.setText(String.format("EEK, our current ship status is %d%% ", getHP()));
if (userAttacks == false) {
userAttacks = true;
}
if (exitValue == 1) {
wipe();
calculateLoot = (startingLittyShips * 100) + randomValue.nextInt(startingLittyShips) * 200;
setMoney(getMoney() + calculateLoot);
report.setText(String.format("Our firm has earned $%,d in loot! ", calculateLoot));
continueButton.setVisible(true);
completeWipe();
fightButton.setVisible(false);
runButton.setVisible(false);
continueButton.setDefaultButton(true);
return true;
} else if (exitValue == 2) {
GameEndGUI gameEndGUI = new GameEndGUI(getPlayer());
gameEndGUI.initializeGameEndGUI(stage);
stage.show();
return true;
} else if (exitValue == 3) {
report.setText(String.format("We made it out at %d%% ship status!", getHP()));
continueButton.setVisible(true);
completeWipe();
fightButton.setVisible(false);
runButton.setVisible(false);
continueButton.setDefaultButton(true);
return true;
}
return false;
}
/**
* Player attacks enemy ships in an animation
*/
public void playerShoots() {
userAttacks=true;
shotsFired.setFromX(0);
shotsFired.setFromY(0);
shotsFired.setToX(endX);
shotsFired.setToY(endY);
shotsFired.setDuration(Duration.seconds(0.5));
if(getGuns()>0) {
shotsFired.setCycleCount(getGuns());
}
else{
shotsFired.setCycleCount(0);
shotsFired.stop();
cannon.setVisible(false);
}
shotsFired.setNode(cannon);
shotsFired.play();
}
/**
* Ships attack player ship back in an animation
*/
public void shipsRetaliate(){
cannon.setVisible(true);
enemyShots.setFromX(270);
enemyShots.setFromY(0);
enemyShots.setToX(-30);
enemyShots.setToY(90);
enemyShots.setDuration(Duration.seconds(0.5));
enemyShots.setCycleCount(1);
enemyShots.setNode(cannon);
enemyShots.play();
}
/**
* Sets most buttons to being invisble and switches to TaipanShop scene
*
* @param stage stage the user incorporates when they utilize the GUI
*/
public void setVisibilitiesAndTransition(Stage stage) {
completeWipe();
continueButton.setVisible(true);
continueButton.setDefaultButton(true);
fightButton.setVisible(false);
runButton.setVisible(false);
/**
* Switches to Taipan Shop scene
* @param event, once button is clicked, executes graphical information
*/
continueButton.setOnAction(event -> {
TaipanShopGUI shop = new TaipanShopGUI(getPlayer());
shop.initializeShop(stage);
stage.show();
});
}
/**
* Generaties ships and deploys logic for the shipwarfare
* @param primaryStage sets up the stage to whcih the GUI may be based around
* @throws Exception in case of interruptions withing the graphical interface
*/
public void initializeShip(Stage primaryStage) throws Exception {
setNumOfLittyShips(numOfShips());
Pane root = new Pane();
HBox usAgainstEnemyDivisor;
BorderPane centeringUserShipPane = new BorderPane();
Circle cannon;
BorderPane centeringLittyShipPane = new BorderPane();
BorderPane encompassingPane = new BorderPane();
usAgainstEnemyDivisor = new HBox();
cannon = new Circle();
this.cannon = cannon;
cannon.setVisible(false);
buttonBox = new VBox();
fightRunBox = new HBox();
fightButton = new Button();
runButton = new Button();
continueButton = new Button();
labelBox = new VBox();
title = new Label();
HPLeft = new Label();
gunsLeftOrTaken = new Label();
runAwayOrLeft = new Label();
shipsRemaining = new Label();
report = new Label();
title.setText(String.format("%d ships from Liu Yuen's Fleet are attacking, Would you like to fight or run?", numOfLittyShips));
fightButton.setText("Fight");
runButton.setText("Run");
continueButton.setText("Continue");
fightButton.setVisible(true);
runButton.setVisible(true);
continueButton.setVisible(false);
encompassingPane.setAlignment(labelBox, javafx.geometry.Pos.CENTER);
labelBox.setAlignment(javafx.geometry.Pos.CENTER);
labelBox.setPrefHeight(41.0);
labelBox.setPrefWidth(600.0);
labelBox.setSpacing(20.0);
labelBox.setPadding(new Insets(10.0, 0.0, 0.0, 0.0));
encompassingPane.setAlignment(buttonBox, javafx.geometry.Pos.CENTER);
buttonBox.setAlignment(javafx.geometry.Pos.TOP_CENTER);
fightRunBox.setAlignment(javafx.geometry.Pos.CENTER);
fightRunBox.setPrefHeight(100.0);
fightRunBox.setPrefWidth(200.0);
fightRunBox.setSpacing(10.0);
VBox.setMargin(continueButton, new Insets(0.0, 0.0, 20.0, 0.0));
root.getChildren().add(cannon);
encompassingPane.setPrefHeight(480);
encompassingPane.setPrefWidth(600);
usAgainstEnemyDivisor.setPrefHeight(0.0);
usAgainstEnemyDivisor.setPrefWidth(600.0);
centeringUserShipPane.setPrefHeight(200.0);
centeringUserShipPane.setPrefWidth(200.0);
Image ourShip = new Image(new FileInputStream("src/images/ourShip.png"));
Image enemyShip = new Image(new FileInputStream("src/images/enemyShip.png"));
//Setting the image view
ImageView userShip = new ImageView(ourShip);
ImageView littyShip = new ImageView(enemyShip);
BorderPane.setAlignment(userShip, javafx.geometry.Pos.CENTER);
userShip.setFitHeight(150.0);
userShip.setFitWidth(248.0);
userShip.setPickOnBounds(true);
userShip.setPreserveRatio(true);
centeringUserShipPane.setCenter(userShip);
BorderPane.setAlignment(buttonBox, javafx.geometry.Pos.CENTER);
buttonBox.setAlignment(javafx.geometry.Pos.TOP_CENTER);
usAgainstEnemyDivisor.setTranslateY(-20.0);
cannon.setRadius(10.0);
cannon.setStroke(javafx.scene.paint.Color.BLACK);
cannon.setStrokeType(javafx.scene.shape.StrokeType.INSIDE);
centeringUserShipPane.setRight(cannon);
centeringLittyShipPane.setPrefHeight(200.0);
centeringLittyShipPane.setPrefWidth(200.0);
centeringLittyShipPane.setOpaqueInsets(new Insets(0.0));
HBox.setMargin(centeringLittyShipPane, new Insets(0.0, 0.0, 0.0, 200.0));
encompassingPane.setAlignment(littyShip, javafx.geometry.Pos.CENTER);
littyShip.setFitHeight(165.0);
littyShip.setFitWidth(180.0);
littyShip.setPickOnBounds(true);
littyShip.setPreserveRatio(true);
encompassingPane.setMargin(littyShip, new Insets(0.0, 0.0, 20.0, 0.0));
centeringLittyShipPane.setCenter(littyShip);
usAgainstEnemyDivisor.getChildren().add(centeringUserShipPane);
usAgainstEnemyDivisor.getChildren().add(centeringLittyShipPane);
fightRunBox.getChildren().add(fightButton);
fightRunBox.getChildren().add(continueButton);
fightRunBox.getChildren().add(runButton);
buttonBox.getChildren().add(fightRunBox);
labelBox.getChildren().add(title);
labelBox.getChildren().add(HPLeft);
labelBox.getChildren().add(gunsLeftOrTaken);
labelBox.getChildren().add(runAwayOrLeft);
labelBox.getChildren().add(shipsRemaining);
labelBox.getChildren().add(report);
encompassingPane.setTop(labelBox);
encompassingPane.setCenter(usAgainstEnemyDivisor);
encompassingPane.setBottom(buttonBox);
root.getChildren().addAll(encompassingPane, cannon);
Scene scene = new Scene(root, 600, 480);
root.getStylesheets().add("styleguide.css");
primaryStage.setResizable(false);
primaryStage.setScene(scene);
primaryStage.show();
continueButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
/**
* Continue Button, engages in run logic and graphical interface
* @param event, once button is clicked, executes graphical information
*/
public void handle(ActionEvent event) {
shotsFired.stop();
/**
* Switches to Taipan Shop scene
*/
TaipanShopGUI shop = new TaipanShopGUI(getPlayer());
shop.initializeShop(primaryStage);
primaryStage.show();
}
});
//Flee
runButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
/**
* Run Button, engages in run logic and graphical interface
* @param event, once button is clicked, executes graphical information
*/
public void handle(ActionEvent event) {
report.setVisible(true);
title.setVisible(true);
shipsRemaining.setVisible(true);
gunsLeftOrTaken.setVisible(true);
title.setText("Ayy captain we will try to run!");
report.setText("Epic");
counter++;
if (runFromShips() == false) {
report.setText(("Couldn't run away"));
try {
winOrLose= destroyLittyShipsOrEscape(primaryStage);
} catch (Exception e) {
e.printStackTrace();
}
if(winOrLose==true){
report.setVisible(true);
title.setVisible(true);
shipsRemaining.setVisible(true);
gunsLeftOrTaken.setVisible(true);
}
} else {
report.setText("Phew! Got away safely");
setVisibilitiesAndTransition(primaryStage);
}
}
});
//Fight
fightButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
/**
* Fight Button, engages in fight logic and graphical interface
* @param event, once button is clicked, executes graphical information
*/
public void handle(ActionEvent event) {
report.setVisible(false);
runAwayOrLeft.setVisible(false);
shipsRemaining.setVisible(false);
HPLeft.setVisible(false);
gunsLeftOrTaken.setVisible(false);
fightButton.setVisible(false);
runButton.setVisible(false);
try {
winOrLose= destroyLittyShipsOrEscape(primaryStage);
} catch (Exception e) {
e.printStackTrace();
}
counter++;
cannon.setVisible(true);
cannon.setLayoutX(beginningX);
cannon.setLayoutY(beginningY);
if (counter >= 1) {
title.setVisible(false);
}
playerShoots();
shotsFired.setOnFinished(new EventHandler<ActionEvent>() {
@Override
/**
* When the user is completed their volley this information will be accessed
* @param event, once the shots fired transition is completed, execute graphical information
*/
public void handle(ActionEvent event) {
shotsFired.stop();
if(!winOrLose) {
shipsRetaliate();
}
else{
report.setVisible(true);
continueButton.setVisible(true);
usAgainstEnemyDivisor.setVisible(false);
cannon.setVisible(false);
shotsFired.stop();
}
enemyShots.setOnFinished(new EventHandler<ActionEvent>() {
@Override
/**
* When the user is completed their volley, this information will be accessed
* @param event, once the enemy shots transition is completed, execute graphical information
*/
public void handle(ActionEvent event) {
fightButton.setVisible(true);
runButton.setVisible(true);
report.setVisible(true);
cannon.setVisible(false);
runAwayOrLeft.setVisible(true);
gunsLeftOrTaken.setVisible(true);
shipsRemaining.setVisible(true);
HPLeft.setVisible(true);
gunsLeftOrTaken.setVisible(true);
if(winOrLose==true){
usAgainstEnemyDivisor.setVisible(false);
}
}
});
}
});
}
});
}
}

Binary file not shown.