In this section of this blog, I am actually going to re-evaluate and re-explain the scripting process in project 1 and explain how it works and why does it work the way it is, by actually re-making the script from scratch and apply some new changes to the script in order to fix some of the issues in the game itself.
How it Works and Why use that Script?
Shoot Script -> Releasing the Roar script actually does a very simple script which checks if the prefab matches with the enemy. When it checks with an enemy and it is true, the game object is destroyed along with the prefab of the roar effect. Otherwise, after a starting period, the gameobject is destroyed within 10 seconds. It is a simple script but it works the way it is because the script is functioned within the boundaries with limited issues.
Movement Script -> The basic movement script is iterated and changed from the previous script which has some issues in regards to how the mouse is moving the character in the game. This is created by applying private variables as Vector3. And by applying OnMouseDown, you change the movement based on the mouse position and the offset of the gameObject’s transform position to limit the movement to just the screen provided. Applying this to OnMouseDrag, when the mouse drags the object, it attracts based on the cursor point or the cursor position. Reflecting it using the script:
transform.position = cursorPosition;
This new script is an attempt to make its changes based on the old script which is more focused on the Shooting script, which is to change the roar effect in order to reflect the intention of the game. However, when implemented with the scale script which is a simple re-size script based on rays, it does not move the way it wants to. And it should be much simpler, but this script ends up being scrapped because of the complexity and the script itself not working within the limitations of what is needed, so it ended up being removed.
Other scripts include a health script which was made by a simplified damage count and a more simplified variables which is changed by calling this script into other scripts. This is made in order to have a variable which makes the health of the enemies deplete into 0, which allows them to destroy the object when in use. This is slightly re-iterated but uses the same concepts as the previous iteration, making this script the same as before.
That is all for the current scripts that are made for the first game re-explained for more details on how it was made and why it was made the way it is. There will be more scripts explained in this project and the Vendorbus project, which I will contribute making some scripts on the how’s and the why’s in the similar structure to this one.