Make the Player Shoot!!! PEW PEW PEW

Objectives:

  • Create a Weapon Class
  • Handling the shoot with player’s input

Weapon Class

A long and scary class, uh? But don’t worry, I’ll explain it.

We are just basically creating a Shoot() method that will trigger the weapon. This class is modular, so it can be implemented with any object that can shoots(Not only the player).

ChangeBullet method and ChangingBullet Coroutine.

In the same class we have both methods, one public and another private. ChangeBullet can be called from other classes to make the character shoot different bullets, the time parameter is to specify for how many time this bust will be on this weapon.

Hadling the shoot from Player’s Ability Class

And the player’s ability class should look like this to handle the shoot.

And the player goes PEW PEW!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response