Edna's Age - Polish & Standalone


Standalone

You can download the game(~23.3MB) from my site. Tried uploading it here, it fails at 50%. :cry: Or checkout the WebGL version of it here or here. I noticed having the Exit (Application.Quit button) breaks the game on WebGL, so I replaced that version with an About button instead. Feedback is always appreciated.

Mobile Version

I had earlier designed a mobile look for the game, but later into the lectures I realized @Rick_Davidson wanted us to build a standalone. That version looked so awful :see_no_evil: on desktop but a bit neat viewed on mobile. :sunglasses:

Some tweaks.

I figured the game looked pointless on continuing to click Younger or Older buttons when the player was “lying” about their guess which was already guessed correctly. So I tweaked our Number Guessing script to generate random feedback text. See code below.


using TMPro;
using UnityEngine;

public class NumberGuess : MonoBehaviour {
    [SerializeField] private int minGuess;
    [SerializeField] private int maxGuess;
    [SerializeField] TextMeshProUGUI ageDisplay;
    [SerializeField] TextMeshProUGUI feedbackText; // Text to be randomised.

    int guess;
    int guessCount;

    void StartGame() {
        NextGuess();
    }

    void NextGuess() {
        if (maxGuess >= minGuess) {
            guess = Random.Range(minGuess, maxGuess + 1);
        } else {
            string[] msg = { "Alright", "Mheen", "Darling", "Well", "See!", "Woo", "Please" };
            string[] msgLong = { "Slow Down", "Serioulsy!!", "No way! Arrgg", "Realllllly", "Come on!", "Please be nice", "Never wrong! Am sure" };
            int msgSpawn = Random.Range(0, msg.Length);
            if (guessCount % 2 == 0) {
                feedbackText.text = ("Wo, Wooo, " + msgLong[msgSpawn] + "! \n It should be ...");
            } else {
                feedbackText.text = (msg[msgSpawn] + " told you already! \n You are thinking \n that's it!");
            }
            guessCount += 1;
        }

        ageDisplay.text = guess.ToString();
    }

    public void OnPressOlder() {
        minGuess = guess + 1;
        NextGuess();
    }

    public void OnPressYounger() {
        maxGuess = guess - 1;
        NextGuess();
    }

    void Start() {
        StartGame();
    }
}


#PS: I tested the Standalone Game Windows 8 x86 PC and it wasn’t working, but rocks on Windows 10 x64. Hoping to see such compatibility fixes along the course on publishing.

Thanks for reading through.
Be blessed.

2 Likes

Looks Amazing. I like how you customized your code. I’m struggling so far with C. I understand the concepts but still don’t know exactly how it all lines up. I think I just need someone to help walk me through it a few times. For example, your else statement and string arrays are very impressive. However I don’t entirely understand how the sequence works.

1 Like

Thank you @Timothy_Hood, and good evening/morning.

Did you mean struggling with C#(as Unity scripts are mostly coded in C Sharp). If you really meant C, man I really cannot throw any pointers.

Here is the thing though, am also a newbie to C#, but have some knowledge with other scripting languages like Javascript, which might be helping a bit. I don’t know about your strengths coming into the course but I think we are likely at the same stage into it.

I also struggle with the challenges, but make it a point to read the Unity docs(links always provided by Rick), Google, YouTube, rewatch the lessons and try to solve the challenges before I see the solution. Most times am totally off, or come up with a totally crude approach but it helps. By the time I get the to the solution, it’s as equally satisfying if I got to nail it as it is, seeing the other/correct approach.

I would be super glad to help. We could discuss these lessons on Slack or Discord, if you have are available on Wednesday mornings(+4GMT).

Hey Man,

Sorry it’s taken so long for me to respond. Life’s been crazy! Things have gotten much better on the C# end of things for me in Unity. I really dug in on the Block Breaker challenge, and after a lot of initial struggling on bringing my new concepts to life I feel like I’m finally getting the hang of it. I also took a scripting course in python to help improve my skills and I think the combination of the two has really helped. YouTube has also been a major asset for problem solving. My coding was conceptually not too bad but has taken me a while to get it all working together and properly tied in with the game objects. I can now look at your code and I have a much better grasp of what it accomplishes. I made a few new scripts in block breaker, one for high scores, one for user controls for example. Anyhow hope all is well in your game building journey!
Tim

1 Like

Hey Man!
Wow! Its good to hear from you and how much you have developed your skills between the time!
Been off here for a while too. Started this course during my vacation but ever since I fully got back into work, I feel I’ve deserted it for a while (was somewhere about completing the Laser Defender course, and it’s been almost 3 months :sob:). Planning on resuming it next month.

Is there any links I could play your block breaker game?

I hope you’re feeling your new found power. Keep building and breaking things.

Privacy & Terms