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 zach22 · Jan 26, 2014 at 07:35 AM · movementscoremoves

How do you make your game have moves count down to end the game?

I've been looking everywhere to find out how to make my bejeweled game have 40 moves total, every move would count down until you hit zero and the game would end with your total score. does anyone know how to do something like this?

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 robertbu · Jan 26, 2014 at 07:37 AM 0
Share

You haven't included enough information for an accurate answer. How are you moving your character? Where is the script? What constitutes a move? The actual code to do what you want is only a few lines, but it is highly dependent on the code you have to move your object.

avatar image zach22 · Jan 27, 2014 at 02:34 AM 0
Share

Im using a game$$anonymous$$anager script like this:


using UnityEngine; using System.Collections;

public class Game$$anonymous$$anager : $$anonymous$$onoBehaviour {
public static Game$$anonymous$$anager instance; public GameObject[] playingObjectPrefabs; public GameObject[] horizontalPrefabs; public GameObject[] verticalPrefabs; public GameObject universalPlayingObjectPrefab; public GameObject []jellyPrefab;

 internal int numberOfColumns;
 internal int numberOfRows;
 public float gapBetweenObjects = .7f;
 public float swappingTime = .8f;
 public float objectFallingDuration = .5f;
 internal float initialObjectFallingDuration;
 internal bool isBusy = false;
 public int totalNoOfJ$$anonymous$$s = 0;

 public iTween.EaseType objectfallingEase;

 internal Text$$anonymous$$esh scoreText;
 internal Text$$anonymous$$esh jellyText;
 int score;

 internal static int numberOfItemsPoppedInaRow = 0;
 

 void Awake()
 {
     instance = this;
 }

 void Start () 
 {
     scoreText = GameObject.Find("Score Text").GetComponent<Text$$anonymous$$esh>();
     jellyText = GameObject.Find("Jelly Text").GetComponent<Text$$anonymous$$esh>();
     initialObjectFallingDuration = objectFallingDuration;
     numberOfColumns = LevelStructure.instance.numberOfColumns;
     numberOfRows = LevelStructure.instance.numberOfRows;
     numberOfItemsPoppedInaRow = 0;
     scoreText.text = "Score : " + score.ToString();
     jellyText.text = "Jelly : " + totalNoOfJ$$anonymous$$s.ToString();
 
 }

 internal void AddScore()
 {
     int temp = 10 * numberOfItemsPoppedInaRow * (numberOfItemsPoppedInaRow / 5 + 1);
   //  print(temp);
     score += temp;
     scoreText.text = "Score : " + score.ToString();
 }



   

}


But I don't know how to have a move counter and end the game with a total score.

move counter

and end the game with a GUI score at the end.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by poncho · Jan 26, 2014 at 07:37 AM

Yes, the script where you manage the game, needs a turns count, you need to take one of those turn in each move you do, and after your turns count reaches 0 then change your game status to game over or something like that.

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

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

20 People are following this question.

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

Related Questions

Check Coordinate if its increasing by value over time 1 Answer

Making a bubble level (not a game but work tool) 1 Answer

How can i make score keep updating after bool condition has been met on looping objects? 1 Answer

Restricting axis of movement not working at all! 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 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