+ 1

Coding DotA2 Invoker's skills

Hi everyone, I just want a little help from those guys that are familiar with DotA2, because i want to know how can I code the logic of Invoker's skills with simple C++ Methods, I mean i should start declaring some variables with "char" but what am i supposed to do when i want to invoke those basic skills ( For instance: Exort,Exort,Wex) that brings the new one( that is called) : Chaos Meteor. The program would be coded with simple things, just simple program!

18th Jun 2017, 7:54 PM
Amirali nedaee
Amirali nedaee - avatar
3 Réponses
+ 3
First you would need a way for the keyboard input to change the current spell the user is going to cast, or atleast keep track of it. For example, If I type: 'eew', I need to know those were the last thing typed. If I then type q, I need to move everything over to have: 'ewq'. You could do this with an array, vector, or string. Just need some way to store it. Then once you have the spell ready and it's casted there's a couple ways to cast the correct spell. If this is done with OOP, you could have created a Spell object when the spell was activated, then call some useSpell() method when the spell is used. This method would be in every class that extends the spell class. Or you could do a bunch of if statements. Like: if(curSpell.Equals("eew")) cout << "Casted Meteor!"; If curSpell was a string or array. Something like that, there's lots of different ways to approach this.
18th Jun 2017, 8:41 PM
Rrestoring faith
Rrestoring faith - avatar
+ 3
if statements are easier, OOP is more practical and would make modifications very easy.
18th Jun 2017, 8:58 PM
Rrestoring faith
Rrestoring faith - avatar
0
Thanks for the answer. Which approach do you suggest and prefer? Which one of these would make codes much easier?
18th Jun 2017, 8:57 PM
Amirali nedaee
Amirali nedaee - avatar