-
Notifications
You must be signed in to change notification settings - Fork 0
Engine Setup
We will be using the Unity game engine for this game. These are initial proposals about how things will work in Unity. These were chosen after some experimentation but are not necessarily final.
2D game objects will be represented using Unity sprites.
The order in which sprites are rendered is determined by the sprites' sorting layer and sorting order within the layer.
In order from back to front, the following layers will be used:
-
Background: images always behind the player
-
Character: images that can be in front of or behind the character and the character itself
-
Foreground: images always in front of the player
Additional foreground or background layers can be added as needed. There will only be one character layer.
We may want the character to be able to walk in front of and behind the same sprite. For example, the character should render on top of a building when he is in front of it and behind it when he is behind. This can be accomplished with a script that dynamically changes the non-character sprite's sorting order within the Character layer.
The player character will always have a sorting order of 1000. Other objects can have orders 0–999. A script adds or subtracts 1000 to the other sprites' sorting orders based on their position in the y-axis relative to the player.
The camera will be oriented along the Z axis. An isometric.
Singleton objects should be used for global objects (game state, inventory, player info, etc). The call DontDestroyOnLoad(Instance) is necessary, otherwise the object will be deleted between calls.
This is one way to create a singleton:
using UnityEngine;
using System.Collections;
public class GameState : MonoBehaviour {
private GameState() {}
private static GameState instance = null;
public int objCount;
public static GameState Instance {
get {
if (instance == null) {
instance = new GameObject("GameState").AddComponent<GameState>();
DontDestroyOnLoad(instance);
}
return instance;
}
}
public void gotObject() {
objCount++;
print(objCount);
}
}Home | Design | The Team | Team Deliverables