Next, I worked on implementing a checkpoint for the start of the red enemy layer. One thing to note is the player position had to be substracted (transform.position) to nullify things because the formula in the attack script adds the player position.įigure 3: Teleporter Shooting in the Green Teleporter.Įven though the red teleporter forces you to use the mechanic, the green teleporter is actually a better demonstration because it has more space around it. The code prior to this was just transform.position = teleporterLocation so it was a case of surrounding this statement with this alternative, and triggering the fire method in the AttackScript. Since I had the teleport set to pressing down T, I just added the extra condition like so: if (Input.GetKey(Ke圜ode.Space))ĪttackScript.Fire("Player", nSpeed * 5, playerScript.activeColor, teleporterLocation - transform.position, Quaternion.identity, 0.3f, 1) Logically, you’d probably be pressing them simultaneously, but that’d make the code a bit more awkward to detect the correct response. Then it’s a case of holding down spacebar and firing with T. The idea is the enemy will move toward the player and cover the teleport zone. I wanted to introduce an interesting mechanic, the ability to teleport shooting. During Week 11, I completed the red enemy layer of the level as well as introduced a screen overlay.įigure 1: End (Teleport Area) of Red Enemy Layer in my Project in Unity.įirst, off I worked on the far right side of the red enemy layer, past the three big green enemies.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |