When creating a game in Unity that is predominantly 2D we need to understand the common principles that will stay consistent in order for the project to function. To start off we need to define our plane of motion for all of the gameobjects. In order to prevent this game from being three dimensional, one of the dimensions must be restricted from motion. For my game, I’m going to choose the X-axis to correspond to horizontal movement and the Y-axis to correspond to vertical movement. The Z-axis will therefore correspond to movement to and from the observer (or camera), this will inhabit no character movement within it. In order to easily memorize the planes of motion, when I click upon a Gameobject within the Scene-view, the red, green and blue arrows represent the directions of X, Y and Z.
The second principle I'm going to be sticking to is the restriction of rotation. The only rotation that will be present within the game will be around the z-axis. This is due to the camera passing through this axis, which results in clockwise and anti-clockwise rotation. The only exception that will be used for this rotation is the Y-axis so he can turn from side to side in mid-air.
In order to help enforce these principles I'm going to use an object called "Level Attributes" that has a script with the same name attached to it. This script does a whole variety of environment setting features, these features do the following:
- Displays the level's dimensions within the scene-view by drawing a green bordered rectangle.
- Creates a physical collider that acts as a border to stop objects falling infinitely or users going beyond where they should be going.
- Allows the user to optimize the position where the physical colliders start and how wide/high they are away from the position.
- Gives the character room to fall without the camera following it until it hits the bottom collide.
No comments:
Post a Comment