Skip to content

Instantly share code, notes, and snippets.

@Henry-E
Last active August 29, 2015 14:22
Show Gist options
  • Save Henry-E/ce1e806b094b4a5254eb to your computer and use it in GitHub Desktop.
Save Henry-E/ce1e806b094b4a5254eb to your computer and use it in GitHub Desktop.
// this needs to go into the asteroid's update function.
// It might be prudent to store the gameHeight and gameWidth variables
// in the GameManager script and assign them to variables in this
// script on awake.
// I'm neglecting to add any initialisation here but I'm sure you know what to do
aWidth = GameManager.instance.gameWidth
aHeight = GameManager.instance.gameHeight
// inside the update function
transform.position = Vector3( Mathf.Repeat(myTransform.position.x, aWidth), Mathf.Repeat(myTransform.position.y, aHeight), 0) ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment