|
Hey i'm currently trying to make a 2D platformer, and i've reached the stage where i want to make the enemies work out, so what i'm currently strangling with is to make a script that subtracts my 1 of my ¨hearths¨ ( I have made a GUI-texture and placed out some hearths, and i've also made a enemy that shoots towards my character) Here's my healthcontroll script so far : var health1 : Texture2D; //one life left var health2 : Texture2D; //two life left var health3 : Texture2D; //full heatlh static var LIVES = 3; function Update (){ } So i know i'll have to make script that will subtract my ¨LIVES¨, does anyone have a example of such a script? would love to get this scripting done :)
(comments are locked)
|
|
The script was just to illustrate how far i've gotten, and the bullets are physic-based ¨spheres¨.
(comments are locked)
|
|
you can call a function in this script to detect any collision by doing: or if you want to tag your Sphere to detect just when it hits the player you can attach a tag called "Sphere" in the sphere and make an if statement inside OnCollisionEnter function to check the tag of the collider, like:
(comments are locked)
|

Why have you shown us the part of the script that is working perfectly? It's kind of irrelevant. How do your bullets work? Do they follow a predetermined path, or are they physics based?