Wonsoox / HackesGM

게임메이커스
0 stars 0 forks source link

10/8 도전과제 #11

Open jeilee04 opened 1 week ago

jeilee04 commented 1 week ago

https://github.com/user-attachments/assets/1bde490e-7eb3-47d7-bbcf-205e0adae417

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

public class ggg : MonoBehaviour
{
    Vector3 startPosition;
    // Start is called before the first frame update
    void Start()
    {
        startPosition = transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        Vector3 nowPosition = transform.position;

        if(nowPosition.y != startPosition.y)
        {
            float dif = nowPosition.y - startPosition.y;
            float m;
            if(dif >= 0.1f)
            {
                m = 0.1f;
            }
            else
            {
                m = dif;
            }

            transform.position = new Vector3(nowPosition.x, nowPosition.y - m, nowPosition.z);
        }

    }
}
Wonsoox commented 1 week ago

띠요오오옹~ 칭찬점수 100점 드립니다 + 스타ㅡ벅스커피