NPC support types


A critical part of my game are two supporting entities that follow the player and shoot with the player (Kinda what makes my game unique i guess) 1 shoots bullets like the player and enemy and the other shoots 3sec time bombs. and i thought and had a conversation with myself @zachwlewis and contemplated how it would work but i don’t know how to make them follow the player nor do i know how to make bombs.(Btw the reason i am asking so much like in my last 2 topics including this one is because i’m trying to finish this game as fast as possible and i’m trying to get as many solutions and feedback as possible so i can finish faster)

(Bora Kasap) #2

i think it doesn’t have any fast solutions. it looks you have to design it step by step.

Steps in my mind: (I always begin from the most sub part)

  • Modify your bullet as a global usable entity if it is not. Or copy and modify your bullet for your 1st support instead of the player entity.
  • Design the bomb class. (Start from the last, so, start from the explosion effect then add it into the bomb class that you gonna design)
  • Design a movement & action controller class that records player’s movement changes & actions then orders any other entities by the records (just make them move like the player and shoot like the player in the beginning, that’s gonna be an easy start)
  • Design 1st support and connect with the bullet class and add a function that takes movement orders and another function that takes fire orders.
  • Complete the 1st support .Then go to your movement & action controller and connect the 1st support and add some “delay” for “movement” but “firing”.
  • Then duplicate the 1st support as 2nd support. Deconnect the bullet class and connect the bomb class.
  • Complete the 2nd support. And connect with movement & action controller class.

(Zachary Lewis) #3

Here’s my thought on making a bomb.

  • What is a bomb? It blows up after some time and hurts anyone around it.
  • What else hurts people? Bullets hurt people! So, I guess you could say that a bomb is a bullet that doesn’t’ move and doesn’t hurt people until it explodes. So, that’s not really like a bullet, is it? But, they’re both things that hurt people and can be fired by a player.
  • How will the bomb deal damage? Since it doesn’t move or hurt when touched, it needs another way to hurt people. It should explode after a few seconds, which can be done with a timer.
  • What is an explosion? It destroys the bomb and hurts anyone in the bomb’s radius when the bomb explodes. That’s just a single collision check for anyone in a radius!

So, Bomb can subclass Bullet to simplify the shooting process! When a Bomb is created, it starts a timer that lasts for a few seconds then explodes by performing a radius collision check and calling takeDamage() on all the Enemy entities that are hit.