Find Jobs
Hire Freelancers

Enemy projectiles shoot hit playership object and destory it(?) need someone with Microsoft Visual Studio #c inclined

$10-30 USD

I përfunduar
Postuar almost 5 years ago

$10-30 USD

Paguhet në dorëzim
Hi, I created a Unity game but I like to get the enemy projectiles to shoot and destroy player ship object. Finally, I want the health bar to increase when player ship objects shoots and hits or any enemy ship object or decrease when the enemy ship hits the player ship object. [login to view URL] using [login to view URL]; using [login to view URL]; using UnityEngine; public class Projectiles : MonoBehaviour { public Transform playerShip; public float range = 20.0f; public float enemyGunImpulse = 10.0f; bool onRange = false; public Rigidbody projectile; Rigidbody2D rigidbody2d; void Start() { float rand = [login to view URL](1.0f, 2.0f); InvokeRepeating("Shoot", 2, rand); } void Shoot() { if (onRange) { Rigidbody enemyGun = (Rigidbody)Instantiate(projectile, [login to view URL] + [login to view URL], [login to view URL]); [login to view URL]([login to view URL] * enemyGunImpulse, [login to view URL]); } [login to view URL](GetInstanceID() + ": Shoot() called."); [login to view URL]("Shoot Player!"); } void Update() { onRange = [login to view URL]([login to view URL], [login to view URL]) < range; if (onRange) [login to view URL](playerShip); } } [login to view URL] using UnityEngine; using [login to view URL]; using [login to view URL]; using System; public class PlayerHealth : MonoBehaviour { [SerializeField] GameObject deathFX; [SerializeField] Transform parent; public Image Bar; public Text Text; public float max_health = 100f; public float cur_health = 0f; //Use this for initialization void Start() { // Initialize the health that is given cur_health = max_health; InvokeRepeating("decreaseHealth", 0f, 2f); } void OnCollisionEnter(Collision collision) { if ([login to view URL]<Projectiles>()) { max_health -= cur_health; //if the collision object has a homing script, minus player health by damageToPlayer } } void decreaseHealth() { //Subtract the health at the following rate //Check if the health is 0 before we do any damage if (cur_health < 0) { cur_health = 0; } //make a new variable and divide the current health my the maximum health //this is because the fill value goes from 0 to 1 float calc_health = cur_health / max_health; // 70 / 100 = 0.7 SetHealth(calc_health); //Change the color of the health bar
ID e Projektit: 19779511

Rreth projektit

3 propozime
Projekt në distancë
Aktive 5 yrs ago

Po kërkoni të fitoni para?

Përfitimet e ofertës për Freelancer

Vendosni buxhetin dhe afatin tuaj
Paguhuni për punën tuaj
Përshkruani propozimin tuaj
Është falas të regjistrohesh dhe të bësh oferta për punë
I dhënë për:
Avatari i Përdoruesit
Hello! My name is Adam, I'm from WV, USA where I've been working in Unity full time for the last 3 years, with a good bit of time as a tutor. I can certainly help you rewrite your Projectile script and give you some more tips, but I'd greatly prefer using Unity Collaborate. I need to see how your entire project is setup, especially the hierarchy of the game scene, to give better advice. Basically, we will use Tags to tell what gets shot and subtract HP that way. Look forward to helping on your path to indie development, Adam
$15 USD në 1 ditë
4,8 (13 përshtypje)
4,3
4,3
3 freelancers are bidding on average $18 USD for this job
Avatari i Përdoruesit
Hello, I am a Full Stack Game Designer & Developer, I understand your requirements, and I can do the task in a reasonable amount of time. As you can see from my profile, I have done various projects, and all deliveries on time, and I will do the same for you. I I have an extensive portfolio as well, I can share it with you, And we can discuss your requirements in more depth. Let us talk more about the project in the inbox, and I can begin to work right away. Regards,
$20 USD në 7 ditë
5,0 (18 përshtypje)
4,8
4,8
Avatari i Përdoruesit
Hi my name is Mario. im a game developer. I work with Unity and C#. I can help you to fix and implement your script in the game, Im ready to work now then talk to me in private to discuss more about your game God bless you. Have a good day or night.
$20 USD në 1 ditë
5,0 (29 përshtypje)
4,9
4,9

Rreth klientit

Flamuri i UNITED STATES
New York, United States
5,0
6
Mënyra e pagesës u verifikua
Anëtar që nga tet 12, 2018

Verifikimi i klientit

Faleminderit! Ne ju kemi dërguar me email një lidhje për të kërkuar kredinë tuaj falas.
Ndodhi një gabim gjatë dërgimit të email-it tuaj. Ju lutemi provoni përsëri.
Përdorues të regjistruar Punë të postuara
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Po ngarkohet shikimi paraprak
Leja u dha për Geolocation.
Seanca e hyrjes ka skaduar dhe ke dalë. Hyr sërish.