Score & Coins & Lives

Help, support and information for our Game Framework Unity Asset.
If posting about the assets in the extras bundle then please use the appropriate forum.
Post Reply
ez2ciamaprincess
Posts: 9
Joined: Sun Jul 07, 2019 1:05 am

Score & Coins & Lives

Post by ez2ciamaprincess » Tue Sep 03, 2019 6:23 am

Hello!

Is it possible to Add & Take By Button Click?

I would like to Perform All The Actions after clicking a UI Button.

Give & Take Score
Give & Take Coins
Give & Take Health
Give & Take Lives

Is this already possible?

I'm making a clicker game and It would be important to add and take these values away.
I tried using a conditional action already.

mahewitt
Site Admin
Posts: 273
Joined: Thu May 05, 2016 8:06 pm

Re: Score & Coins & Lives

Post by mahewitt » Sat Sep 07, 2019 7:07 am

Hi ez2ciamaprincess

There is nothing that does this currently, although it is only a small component that would be needed:

using GameFramework.GameStructure;
using UnityEngine;

public class AddTakeScore : MonoBehaviour {

public int Points;

// Hook this up to the Button event
public void ButtonOnClickCallback() {
GameManager.Instance.Player.AddPoints(Points);
}
}


How would this work though so that the user can't click it multiple times?

ez2ciamaprincess
Posts: 9
Joined: Sun Jul 07, 2019 1:05 am

Re: Score & Coins & Lives

Post by ez2ciamaprincess » Sat Sep 07, 2019 9:24 am

Thank You!

I used your script to make the coins work too, Does the lives work the same way? It gives me errors.
I either need a way to subtract lives with button click, Which triggers the games over after lives reach 0 ... Or a button click function that triggers game over and game won.


"How would this work though so that the user can't click it multiple times?"
After the button is clicked it gets destroyed.

ez2ciamaprincess
Posts: 9
Joined: Sun Jul 07, 2019 1:05 am

Re: Score & Coins & Lives

Post by ez2ciamaprincess » Sat Sep 07, 2019 1:06 pm

Nevermind I figured it out. Would we use these same values to report score to Google Play Leader boards?

mahewitt
Site Admin
Posts: 273
Joined: Thu May 05, 2016 8:06 pm

Re: Score & Coins & Lives

Post by mahewitt » Sun Sep 08, 2019 7:11 am

Yes - it would be the same values.

ez2ciamaprincess
Posts: 9
Joined: Sun Jul 07, 2019 1:05 am

Re: Score & Coins & Lives

Post by ez2ciamaprincess » Sat Sep 14, 2019 5:54 pm

Hi,

Do you have plans to integrate leaderboards and achievements from Google play games?

Im having trouble saving my score to the leaderboard. I followed this tutorial here:

Video:
https://www.youtube.com/watch?v=5Ae8GeRmdH0

Code:
https://resocoder.com/2017/02/24/gpg-tu ... ards-code/

Everything Works fine except the score will only report if I use the add score function from the tutorial.

Is there any way to make the game framework
recognize this way of reporting the score?

mahewitt
Site Admin
Posts: 273
Joined: Thu May 05, 2016 8:06 pm

Re: Score & Coins & Lives

Post by mahewitt » Mon Sep 16, 2019 6:15 pm

Hi,

This is on my backlog, but unfortunately not a priority at the moment as there are some other bits that I am working on first.

It shouldn't be too difficult to add in support for individual games, but you will need to do a bit of coding. Somewhere like the GameOver class or other periodic saving might be an option.

Mark

Post Reply