Announcement

Collapse
No announcement yet.

Enemy Spawning

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Enemy Spawning

    Hello all! I am now to the point where I need to setup the spawning of enemies for my game. There will only be one enemy at a time, and they will be spawned near the player, but out of the player's view (left, right, behind). The game will randomly pick an enemy and spawn it. Should this be done in the Game Mode blueprint?

    EDIT: Also, how should I keep track of the amount of objectives completed? In the Game Mode or what?
    Last edited by KoldKam; 08-10-2014, 07:41 PM.

    #2
    Never mind! I figured out how I wanted it.

    Comment


      #3
      There you go then! However, that would be perfect to see your solution here so that we can discuss if it is the proper way of doing this or not. We would also be able to find a better way maybe.
      Last edited by ErayT; 08-11-2014, 10:31 AM.

      Comment


        #4
        Hey! I started by creating a array of ABGameplayTask (I have the base setup in C++) in the game mode blueprint. I created a function which is called when the game starts (BeginPlay) that gets all the tasks in the world, fills the array with them, and chooses a random one to start. In tick, I have a function called HandleTasks which loops through the Tasks array, gets the amount completed, and outputs it to an integer called TasksCompleted. I then created another integer called TasksNeededForLevel. In the for loop, after I check if a task is completed, I check to see if TasksCompleted is greater than or equal to TasksForNeededLevel (default: 10) multiplied by CurrentLevel (default: 1), and if so, I call a method called HandleLeveling. I created an array of objects in which I hold the types of enemies. In HandleLeveling, I increase CurrentLevel by one and spawn a random enemy out of the player's view. Then finally once the for loop is completed, I reset TasksCompleted to 0.
        Last edited by KoldKam; 08-11-2014, 01:23 PM.

        Comment

        Working...
        X