Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by JeevanjotSingh · Nov 13, 2014 at 09:34 PM · rigidbodyplayerenemyballhealth

Need Help About Health,Damage

Hi I need some simple help as a newbie . I am developing my first game and i need help that My player is a ball(like roll-a-ball tutorial player) and i want to assign that ball health . and i also have enemy who always follow my player and i want when i touch to my player something like a ... boom ... particles and my player decrease some health (Is there any link of assets store particles that help me with this)

I need in c# please help me guys .

and one more thing ... i will make my game commercial if it will complete so is there any issue if i use assets store free assets .(Please answer this question in brief yes/no because it's not a big deal for me , the bigger problem is player health system Please help me there)

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Kiwasi · Nov 14, 2014 at 11:16 AM 0
Share

On the commercialisation front you are free to use any assets you purchase from the asset store in a game. Even if they are free. Its laid out pretty clear in the EULA.

avatar image JeevanjotSingh · Nov 16, 2014 at 06:50 PM 0
Share

Thanks Bored$$anonymous$$ormon for telling this to me in brief words (that's much easy to understand ins$$anonymous$$d unclear big answer )

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by IEMatrixGuy · Nov 14, 2014 at 04:04 AM

Hi,

What you want is the OnCollisionEnter() function. This checks when you collide with something, and then you can tag the enemy as an enemy in the inspector and check the tag ith collider.compareTag("enemy");

http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnCollisionEnter.html

If it is the enemy, just remove some amount of health from your player health variable.

As far as particle effects go, you could use a particle system and just enable and disable it again. The system itself can be configured in the inspector.

As to publishing your game, I would personally only make it commercial, if all the assets are yours, and the game idea is yours (i.e not a tutorial) just to make sure there are no copyright problems. But a ball shouldn't be too hard to model and texture yourself. :)

Good Luck,

Hope that helps :)

IEMatrixGuy

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image JeevanjotSingh · Nov 14, 2014 at 10:28 AM 0
Share

Hi, Can you please tell me how can i decrease player health in enemy script . Like first i add my script **public int health = 100;** now how can i access health to decrease in my another enemy script in c# .

avatar image DryTear · Nov 16, 2014 at 07:00 PM 0
Share
 public int damage = 5;
 void OnCollisionEnter(Collision col){
 if(col.transform.tag == "Player"){
 col.transform.GetComponent().health -= damage;
 }
 }


avatar image JeevanjotSingh · Nov 16, 2014 at 07:30 PM 0
Share

Thanks for comment and really helpful but it will Giving me error for getting component from another script (i mean i am a newbie so i will add that line and check it ouy if it will work ) Thanks again for help .

I got error that health is not existing in the component after http://unity3d.com/learn/tutorials/modules/beginner/scripting/getcomponent using this tutorial and the script . Any Idea?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

I use this script, but the enemy lose health if i don´t target him. 1 Answer

Damage script is screwed up...? what to do? 1 Answer

Player Health 3 Answers

how to make a player die on collision 2 Answers

the code work bat is not push the ball but with speed of the character ? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges