Abilities - OxiStudios/OrbMain GitHub Wiki
Intro
I have to say, this is probably going to be the hardest part of the game. (Besides the art and sound effects lol). We will have to figure out the fastest way to implement the abilities that they select. When I say implement, I mean, some will be a click of the button and then they will just work, like the shield or invisibility. However, some may work where you have to click the button that you want and then click where on the screen you want that ability to affect, like a black hole. So what I have propose is that we start with a class called abilities and see where that takes us.
Abilities Class
- This class will have a super method called
startAbility()
andqueueAbility()
. - It will have a render method that will have a timer in it.
- The timer will have a variable called
length
which will set how long the timer will run for - It may also have a variable called
coolDownTime
which be set by the sub Classes and that is it(maybe) - For now that is all I see fit for what every single ability needs to have.
Sub Ability Class
-
Each sub class will set the variable called
length
to the sub classes correct length. -
Each sub class will set its
coolDownTime
-
Each sub class will have an id in its class name (ex:ability1 and ability15)this will help us organize or ability classes.
-
Each will house their own button that the Abilities Table Class will call and handle correctly
-
They will also store their own images for their button.
-
They will also have a render method that will get called in the world's render method and will handle, art wise, what the ability will do and look like.
-
It will probably also have the amount of damage it does too.
-
each sub class will override the
startAbility()
andqueueAbility()
. -
if the sub class does not need a location to be used the class will set the
needsLocation
boolean tofalse
-
it will then also call
startAbility()
insidequeueAbility()
-
if the ability needs a location to be used the class will set the
needsLocation
boolean totrue
-
it will then not call the
startAbility()
insidequeueAbility()
-
what will be set inside the
queueAbility()
is theisClicked boolean
(totrue
). -
then in the
startAbility()
,isClicked
will be set tofalse
, so they cant just keep clicking on the screen
Selecting The Abilities
- The player will be able to select their abilities in the hanger section of the menu
- They will first pick their first ability and then their second.
- When they click on a certain ability it will set the saveGame class's abilitySelected1 variable to the correct index and when they game starts it will instantiate two object using a method in the Abilities Class.
Instantiating the Correct Class
- The method in the Abilities Class called
createAbility(int index)
, will return a new sub Abilities class. - The
createAbility(int index)
takes one parameter, which will beabilitySelected1
for the first Ability object being made andabilitySelected2
for the second Ability object being made. - The
createAbility(int index)
will return the correct Ability the player has selected for their game.
Input Listener For the Button
- The button listener will take an Ability (generic) as a parameter and then call the
queueAbility()
andstartAbility()
of that abilities class. - There will be two listeners, one for each button.
- Each abilities object will be instantiated before their input handlers and then they will be past to the input handlers.
- Because some abilities will require you to click on the button in-game then on the screen for a location. We will have two methods for the sub class to call.
queueAbility()
andstartAbility()
. Those two methods are explained up top. - The method in the input handler called
touch()
will have an if statement that checks ifneedsLocation
istrue
- If it is
true
and ifisClicked
istrue
then thestartAbility(
) method from the ability class that was passed into the input handler class will be called. - There will also be a time check (for
cooldown
).