스파르타_코딩클럽_2주차

RAMII·2022년 11월 19일
0
post-thumbnail

휴우 역시! 어려운걸 계속 끌고 가긴 쉽지 않다. 그래도 힘들어지고 아유,, 그만할까 생각이 들 때마다 '난 디자이너야! 개발자가 아니라고! 기본만 알자 기본만!' 이라고 마음을 다지며 다시한번 코드스니펫을 복사한다..! (나도 모르게 복잡한 코딩에 한숨나오고 너무 어렵다 생각들때마다 정말 마법의 주문마냥 마음이 싹 편해진다..)
2주차에는 풍선을 지키는 게임을 만들었다! 영상만 그대로 따라하는게 아니라 내마음대로 풍선모양도, 색깔도 바꿔가며 재밌게 따라했다! 흐흐.. 어휴 근데 아직!! 코딩은 너무 어려워!!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class square : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
float x = Random.Range(-3.0f, 3.0f);
float y = Random.Range(3.0f, 5.0f);

    transform.position = new Vector3(x, y, 0);

    float size = Random.Range(0.5f, 1.5f);
    transform.localScale = new Vector3(size, size, 1);
}

// Update is called once per frame
void Update()
{
    if (transform.position.y < -5.0f)
    {
        Destroy(gameObject);
    }
}

void OnCollisionEnter2D(Collision2D coll)
{
    if (coll.gameObject.tag == "balloon")
    {
        gameManager.I.gameOver();
    }
}

}

profile
사운드디자이너!

0개의 댓글