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 Barrier75 · Apr 30, 2012 at 05:51 PM · collisionscorevaluepointsincrement

Help scoring Points In a Jousting game

So I'm having trouble getting point scoring working in my jousting game. I need it where when then lance hits the gridded gran guard that it will score you a point. Iv tried looking up previous answers and using it on this but with no success. I have a GUI Text layer so you can see the score. If anyone can be any help it would be much appreciated.

Comment
Add comment · Show 3
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 Seth-Bergman · Apr 30, 2012 at 06:15 PM 0
Share

Need more info. Try posting the script.

avatar image Barrier75 · Apr 30, 2012 at 06:29 PM 0
Share

I know little of scripting and at the moment Im inbetween scripts. Been looking up what ppl have posted on similar things. I can tell you what I want the game to do tho, maybe that will help. The two players are co$$anonymous$$g at eachother on a set path. The player is holding the Lance and can move it with the mouse, I want when the lance makes contact with the Gridded gran guard on the other player when passing to score a point.

avatar image Lo0NuhtiK · Apr 30, 2012 at 07:23 PM 0
Share

Doesn't really matter what kind of game it is anyone is making, be it about picking flowers and catching butterflies or about turning zombies into rotten hamburger with a chainsaw ; scoring points is scoring points.
You need a number, you need to increment it, and you need a condition that deter$$anonymous$$es when it gets incremented and by how much. (your condition here being the collision between the lance and the guard)
Collision, Score, Increment, Value, Points--> [SearchBar]

1 Reply

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

Answer by Woutervd · Apr 30, 2012 at 07:16 PM

This is quite similar to something I'm trying. It's not a complete solution but maybe it helps.

First place a script in your game to track the score, such as this (with filename PointSystem.js):

 static var score = 0;
 var scoreDisplay: GUIText;
 
 function Update(){
     scoreDisplay.text = "Score: "+score.ToString();
     }

Then give the 'griddled gran gaurd' a script to actually change the score when the lance collides with it. For instance this:

 function OnCollisionEnter(collision:Collision) 
 { if( collision.gameObject.tag == "Lance" )
  {
  PointSystem.score = PointSystem.score+1;
  } 
 }

That should work at least a bit. It might require some modification though.

Comment
Add comment · Show 7 · 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 Barrier75 · Apr 30, 2012 at 07:40 PM 0
Share

I just did this and I have no errors but its not updating the score when my lance touches it, I have the Pointsystem script on the GUI Text layer and the 2nt on the gridded gran guard.

avatar image Woutervd · Apr 30, 2012 at 08:33 PM 0
Share

$$anonymous$$ake sure you have applied the tag 'Lance' to your lance. Or else exchange "Lance" in the bottom script for Player and on your lance apply the player tag from the presets in the dropdown list at the top of the inspector.

avatar image Barrier75 · May 01, 2012 at 05:35 PM 0
Share

Have done both with same result of nothing, idk whats wrong >.>. does it matter what kind of collider is on the guard or lance? I have a box collider on the guard and have is trigger selected.

avatar image Lo0NuhtiK · May 01, 2012 at 06:03 PM 0
Share

Turn off the trigger. OnCollision won't fire if it's a trigger collider.

avatar image Barrier75 · May 01, 2012 at 06:10 PM 0
Share

Ugh, done that same result. I dont know what else to do to get it to work.

Show more comments

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Collision and score 1 Answer

Is there another way of counting Scores (points) instead of Colliding (destroying) 1 Answer

How can I make my score counter increase incrementally and not jump from 0 to 100? 2 Answers

Scoring (i'm stuck) 3 Answers

Question about Point adding / Destroying after collision. 0 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