Create Enemy||doc136846

September 20, 2022

Create Enemy

Create a new enemyspawn script on the server and require it in the main script on the server.

require "script_server.enemySpawn"

Write the logic of continuously generating enemies in the enemyspawn script, generate parts at a certain distance around the defense tower at regular intervals, and give them a linear speed to the defense tower.

--Functions executed by timer

Start the game to see the effect.

3.gif


Add the logic of hitting the enemy and destroying after the logic of creating bullets in the main script of the server.

--Function executed after receiving the "shoot" protocol

Later, the rotation speed of the defense tower and the speed of the enemy can be adjusted as needed. This case is over, and no further attempt will be made.

API used:

Instance.Name
Instance name
Part.Shape
Shape of base part
Instance:Destroy()
Destroy instance