Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Day 11 or something

A topic by yekko created Jul 13, 2022 Views: 197 Replies: 8
Viewing posts 1 to 5
Submitted(+1)

Hello! I've made some progress since last time. I've been stuck on making UI for almost 3 days now though. I also decided to scrap the healing theme from the game. It felt forced and it didn't fit into my idea. I would have liked to use the theme, but alas, the game is better without it.

I still like the idea of a rolly ball object, so I've turned it into a boulder.


If you're wondering what the blue error in the corner is, that is my mana. The system is functioning (you can only place 3 objects per level), but the UI is completely broken. Trying to access a variable from another script has been oddly difficult.

Submitted(+1)

(SMall UPdATE)

I was finally able to get the mana variable from the UI script!! Now I just have to speedrun making the rest of the game in a day...

Submitted

Added new sandbox mode and more UI elements.


The only things left to do in the scope of this jam is adding character animation and a simple tutorial (maybe just a screen overlay that disappears when clicked). I have animations for the flag and the character, I just need to implement them. I also would have liked to add sound, but I don't know how I would go about getting sound effects and I want to leave time to work out uploading the project anyway.

hey yekko What engine you are using

Submitted

Unity!

Submitted(+1)

"Trying to access a variable from another script has been oddly difficult."

Yeah, I searched for a LONG time until I finally found a tutorial...

So if anybody's interested, here's how u do it (c#)

SCRIPT 1

public class Script1 : MonoBehaviour // this thing is here by default
{
    public float CoolVariable = 1; // u need to put a "public" before the var type so that it can be accessed by other scripts
}

SCRIPT 2

public Script1 Script1;  // after the "public" you need to write the name of the other script (that you can find in the "public class ___ : MonoBehaviour")  thing and after you do that you write how you want to address to the script, but I recommend just calling it by its name (so that's why I wrote script1 twice)
//then go to unity and assign the object that has the script containing the variable that you want to access, or, if it is in the same object as script 2, just directly assign the script.
Debug.Log(Script1.CoolVariable)
//and boom, you got the variable from  another script.
Submitted

The way I did it was much more confusing. Good tutorial. Here's my code if you were wondering.

Debug.Log(GameObject.Find("GAME OBJECT WITH TARGET SCRIPT").GetComponent<Script1>().CoolVariable);

Submitted(+1)

ooh ok

Submitted(+1)

Also, If you just want the code without the comments, here it is

SCRIPT 1

public class Script1 : MonoBehaviour
{
    public float CoolVariable = 1;
}

SCRIPT 2

public Script1 Script1;
Debug.Log(Script1.CoolVariable)