bankshaa.blogg.se

How to play screen snake
How to play screen snake










how to play screen snake

If (snakeCoordinates.Contains(newCoordinate))

how to play screen snake

Int newCoordinate = snakeCoordinates + (snakeDirection = Direction.Left ? -areaResolution : areaResolution) If (timeTmp = (gameBlocks.Length - areaResolution)) GameBlocks].transform.localEulerAngles = new Vector3(90, 90, 0) SnakeCoordinates.Add(firstlock - (areaResolution * 2))

how to play screen snake

SnakeCoordinates.Add(firstlock - areaResolution) Int firstlock = Random.Range(0, areaResolution - 1) + (areaResolution * 3) MainStyle.alignment = TextAnchor.MiddleCenter MainCamera.orthographicSize = / 2 * differenceInSize MainCamera.orthographicSize = / 2 įloat differenceInSize = targetRatio / screenRatio = new Vector3(90, 0, 0) įloat screenRatio = (float)Screen.width / (float)Screen.height įloat targetRatio = / Scale the MainCamera to fit the game blocks TargetBounds.Encapsulate(gameBlocks.bounds) GameBlocks = quadPrimitive.GetComponent() Start is called before the first frame update Game area resolution, the higher number means more blocksĮnum Direction ĭirection snakeDirection = Direction.Right Public class SC_SnakeGameGenerator : MonoBehaviour SC_SnakeGameGenerator.cs //You are free to use this script in Free or Commercial projects Unity version used in this tutorial: Unity 2018.3.0f2 (64-bit) Step 1: Create the Scriptīeing a "One Script Game" this tutorial only requires 1 script: In this post, I will be showing how to create a classic Snake Game in Unity 3D.












How to play screen snake