(This video is not from the Pixelnest Studio guys, but it’s based on their tutorial, thus the name.)
After finishing the Pixelnest-based videos I decided to tweak things a bit. One feature I wanted to add was random Poulpi — instead of placing them on the screen I wanted to randomize their position (and number).
Following is a video showing the way I came up with to do that:
Making Random Enemies (12:31)
Here’s the CreateRandomPoulpi script so you don’t have to copy it from the video:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
using UnityEngine; using System.Collections; public class CreateRandomPoulpi : MonoBehaviour { public GameObject enemyPrefab; public float numEnemies; public float xMin = 19F; public float xMax = 85F; public float yMin = 3.5F; public float yMax = -4.5F; void Start () { GameObject newParent = GameObject.Find("1 - Background Elements"); for (int i = 0; i < numEnemies; i++) { Vector3 newPos = new Vector3(Random.Range(xMin, xMax), Random.Range(yMin, yMax), 0); GameObject octo = Instantiate(enemyPrefab, newPos, Quaternion.identity) as GameObject; octo.transform.parent = newParent.transform; } } } |
[…] creating the tutorial to make random enemies for the Pixelnest-based videos I decided to keep going and add a way to finish the level instead […]
Great re-imagining of the original printed tut. Thanks for the effort and fine job. Nice to see you delving deeper into Unity stuff. Happy Holidays!
HI, your tutorials are really nice. I like to see video tutorials rather than written tutorials because they can they save you are lot of time. I have seen your extra tutorials for random enemies and level finish and they are really useful. Can you make another tutorial for using the touch input in the Unity Game while running it on mobile devices like Android or ios phone? Thanks.