1.
鼠标点击函数制作:
首先我们需要建立好背景图,调整摄像机为正交模式,进入二维状态,调整背景图分辨率为适当大小。
制作鼠标点击脚本思路为先点击然后销毁对象以下为函数
为此函数销毁被鼠标点击的对象Destroy(gameObject);
然后制作一个预制体,是地鼠被打的图片,在地鼠被鼠标点击后存在0.5s左右的时间显示地鼠被打的图片,代码整体为:
using
System.Collections;
using
System.Collections.Generic;
using
UnityEngine;
public class S3 : MonoBehaviour
{
// Start is called before the first frame
update
void Start()
{
Destroy(gameObject, 0.5f);
}
// Update is called once per frame
void
Update()
{
}
}
挂在被打地鼠状态身上即可
using
System.Collections;
using
System.Collections.Generic;
using
UnityEngine;</