How to creat a cast system like in Magicka ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nymb

Hello, I’m trying to create a game in which the player doesn’t have the skills in a hotbar, he has the elemental powers and using their combination certain spells or attacks are cast. The closest I can think of it would be like in Magicka or Magicka 2, having just started with general programming and game creation I can’t think of how I could write this in GDScript to make it work, check if the player has the right mana to use (fire, water etc) put the combination in a cast bar and finally release the magic with the click of a button if the combination is correct. Would anyone have a tutorial on this or could instruct me on how to write this script? Ty

:bust_in_silhouette: Reply From: wildcard

I am by no means an experienced programmer, but I think that labeling an element as a string e.g “fire” or “ice” and just stuffing them into an array, and then checking the insides of an array to give the end result might work.

:bust_in_silhouette: Reply From: JimArtificer

Unless you want all of your spells to be subtle variations of each other, it’s a matter of defining all of the combinations.

Start by working on the simplest version of what you want to do. Then iterate on things as you learn and add additional complexity.

For example:

  • Implement casting a spell that costs zero mana.
  • Implement casting a spell that costs one mana.
  • Implement casting a spell that costs one mana of a different type.
  • Implement casting a spell that costs two mana.
  • Implement casting a spell that costs two mana of different types.
  • etc.

There are plenty of tutorials available for how to do things like play an animation, create a particle effect, create UI elements, or handle mouse input. You will have to learn these pieces and put them together to create your game. Consider creating a small learning project for each concept before combining them together.