September 2010
Beginner
384 pages
8h 49m
English
Enough prattle. It's bomb time!
function Update()
{
transform.position.y -= 50 * Time.deltaTime;
if(transform.position.y < 0)
{
transform.position.y = 50;
transform.position.x = Random.Range(0,60);
transform.position.z = -16;
}
}
We've seen these keywords before, so there should be no surprises here. On every update cycle, move the bomb down in the Y-axis by 50 units per second:
transform.position.y -= 50 * Time.deltaTime;
If the bomb has fallen through the floor,
if(transform.position.y < 0) {
pop the bomb back up to the top of the apartment building:
transform.position.y ...
Read now
Unlock full access