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 bwking · Feb 02, 2011 at 09:23 PM · scoremanager

Collecting and add points

Hello everyone, to get it out there I am a complete noob and I need help. I am in a video game design class and the biggest problem that I am having is the js.

Right now I am trying to make a level for class that has a ball that rolls through the level collecting objects. Once all of the objects are collected you are supposed to go to the "winScene" and if you don't do it in time you go to "loseScene".

Right now when I run the game I find the problem that the object I have set as a trigger falls through the floor and then the game comes directly to the "loseScene"

Here are my scripts that I am using right now. I realize they are probably not right but I really need to learn and want to learn.

Collect.js

var score = 0; var gameObject : Transform;

function OnTriggerEnter () { if (hit.gameObject.tag == "collectacube"){ CollectionManager.scoreText ++ ; Destroy(gameObject); } }



CollectionManager.js

static var CollectedCount : int;

var scoreText : GUIText; var completionTime : float = 55; var startTime : float;

function Start(){ startTime = Time.time; }

function Update () { var timeElapsed = Time.time - startTime;

if(timeElapsed > completionTime){ Application.LoadLevel("loseScene"); }

if(timeElapsed < completionTime && CollectedCount == 1){ Application.LoadLevel("winScene"); }

//Debug.Log("Collected" + Collected Count);

scoreText.text = ("Collected" + CollectedCount);

}

The collection manager script was written by the professor with the class as a group participation. From what I understood I needed the collect script to get the score and the manager was going to get the score or something from the collect script and do what it had to do.

What am I missing? Thanks for the help.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Myth · Feb 02, 2011 at 11:23 PM

the object I have set as a trigger falls through the floor

  • have you turned off affected by gravity under the rigid body component?
Comment
Add comment · Show 1 · 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 bwking · Feb 05, 2011 at 09:17 PM 0
Share

I can't remember what we did exactly I do remember the fact that my object was parented wrong and had a lot of rigid bodies. This issue has been resolved with my professor for now. Thanks for the help.

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

No one has followed this question yet.

Related Questions

Game Character manager 0 Answers

how to make a currency system 0 Answers

Help With Score Controller - Can You Only Have One? 1 Answer

How to make using a power-up affect score? 1 Answer

Update 3D text in realtime? (Countdown watch) 1 Answer


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