gameObject
public class BirdScript : MonoBehavior
{
// Start is called before the first frame update
void Start()
{
[Link],isStatic,layer,tag = "Bird Fly";
}
// Update is called once per frame
void Update()
{
}
}
Rigidbody2D
public class BirdScript : MonoBehavior
{
public Rigidbody2D myRigidbody;
public float flapStrength;
// Start is called before the first frame update
void Start()
{
[Link],isStatic,layer,tag = "Bird Fly";
}
// Update is called once per frame
void Update()
{
if ([Link]([Link]) == true)
{
[Link] = [Link] * 10;
[Link] = [Link] * flapStrength;
}
}
}
PipeMoveScript
public class PipeMoveScript : MonoBehaviour
{
public float moveSpeed = 5;
// Start is called before the first frame update
void Start()
{
// Update is called once per frame
void Update()
{
[Link] = [Link] + ([Link] * moveSpeed) *
[Link];
}
}
prefabricated Game object (prefab)
PipeSpawnerScript
public class PipeSpawnScript : MonoBehaviour
{
public GameObject Pipe;
// Start is called before the first frame update
void Start()
{
// Update is called once per frame
void Update()
{
{
Instantiate(Pipe, [Link], [Link]);
}
}
}
public class PipeSpawnScript : MonoBehaviour
{
public GameObject Pipe;
public float spawnRate = 2;
private float timer = 0;
// Start is called before the first frame update
void Start()
{
// Update is called once per frame
void Update()
{
if (timer < spawnRate)
{
timer = timer + [Link];
}
else
{
Instantiate(Pipe, [Link], [Link]);
timer = 0;
}
}
}
public class PipeSpawnScript : MonoBehaviour
{
public GameObject Pipe;
public float spawnRate = 2;
private float timer = 0;
// Start is called before the first frame update
void Start()
{
spawnPipe();
}
// Update is called once per frame
void Update()
{
if (timer < spawnRate)
{
timer = timer + [Link];
}
else
{
spawnPipe();
timer = 0;
}
}
void spawnPipe()
{
Instantiate(Pipe, [Link], [Link]);
}
}
public class PipeSpawnScript : MonoBehaviour
{
public GameObject Pipe;
public float spawnRate = 2;
private float timer = 0;
public float heightoffset = 10;
// Start is called before the first frame update
void Start()
{
spawnPipe();
}
// Update is called once per frame
void Update()
{
if (timer < spawnRate)
{
timer = timer + [Link];
}
else
{
spawnPipe();
timer = 0;
}
}
void spawnPipe()
{
float lowestPoint = [Link].y - heightoffset;
float highestPoint = [Link].y + heightoffset;
Instantiate(Pipe, new Vector3([Link].x,
[Link](lowestPoint,highestPoint),0), [Link]);
}
}
PipeMoveScript
public class PipeMoveScript : MonoBehaviour
{
public float moveSpeed = 5;
public float deadzone = -45;
// Start is called before the first frame update
void Start()
{
// Update is called once per frame
void Update()
{
[Link] = [Link] + ([Link] * moveSpeed) *
[Link];
if ([Link].x < deadzone)
{
[Link]("Pipe Deleted");
Destroy(gameObject);
}
}
}