#pragma strict
var objectName : GameObject;
//var player : GameObject;
function Start()
{
}
function Update()
{
if(Input.GetKeyDown(KeyCode.X)) {
var pos = Vector2(15,1.5);
var rot : Quaternion = Quaternion.identity;
Instantiate(objectName,pos,rot);
}
}
I'm creating a 2D infinite runner. This script will create a block at (15,1.5), but what I'd like to do is have this block appear at this location relative to the player,since they will always be running forward. I've been at this for awhile and just can't figure it out, since I'm pretty new to all of this. Any help is greatly appreciated!
↧