[Log#4] What I learned this week...

Eir·2023년 1월 21일
0

SpartaCodingClub Logs

목록 보기
4/5
post-thumbnail

For SpartaCodingClub's Game Development Week #4 class, I learned how to create a memory matching game! This lesson also featured some more cute resources of their mascot character and a ticking timer that counts up instead of down this time.
One notable thing I learned from this week's lesson would definitely be how to spawn cards; not by placing them onto their own unique location one by one manually but instead coding it so the engine would do all the work for you.

This was the layout needed for the game.

And this was the result of using this code.

void Start()
{
		int[] rtans = { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 };

    for (int i = 0; i < 16; i++)
    {
        GameObject newCard = Instantiate(card);
        newCard.transform.parent = GameObject.Find("cards").transform;

        float x = (i / 4) * 1.4f - 2.1f;
        float y = (i % 4) * 1.4f - 3.0f;
        newCard.transform.position = new Vector3(x, y, 0);
    }
}

The lesson provided all that was needed in order to create a simple memory matching game which resulted in something like this.

Happy with the result. Onto the last class!

profile
Hello.

1개의 댓글

comment-user-thumbnail
2024년 2월 2일

I manage a local ski resort, and snow conditions directly impact our operations. This website provides precise snow forecasts and weather conditions, allowing us to prepare the slopes, ensure guest safety, and communicate updates effectively. For those in winter sports and resort management, this resource is invaluable: https://365weather.uk . It's been pivotal in providing guests with the best possible experience, no matter the weather.

답글 달기