当前位置: 首页 > news >正文

unity 2d 入门 飞翔小鸟 飞翔脚本(五)

新建c#脚本

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Fly : MonoBehaviour
{//获取小鸟(刚体)private Rigidbody2D bird;//速度public float speed;// Start is called before the first frame updatevoid Start(){bird = GetComponent<Rigidbody2D>();}// Update is called once per framevoid Update(){bird.velocity = new Vector2(speed, bird.velocity.y);}
}

将脚本拉动至小鸟图层里面

在这里插入图片描述

http://www.lryc.cn/news/254368.html

相关文章:

  • Linux系统调试课:I2C tools调试工具
  • uniapp中解决swiper高度自适应内容高度
  • Contrast and Generation Make BART a Good Dialogue Emotion Recognizer
  • 图的深度优先搜索(数据结构实训)
  • VUEX使用总结
  • 指定分隔符对字符串进行分割 numpy.char.split()
  • Android12蓝牙框架
  • python文件docx转pdf
  • 9.基于SpringBoot3+I18N实现国际化
  • 27. 深度学习进阶 - 为什么RNN
  • 谈一谈柔性数组
  • <Linux>(极简关键、省时省力)《Linux操作系统原理分析之Linux文件管理(1)》(25)
  • 算能PCIe开发环境搭建-一些记录
  • 使用C#和HtmlAgilityPack打造强大的Snapchat视频爬虫
  • c/c++的字符和字符串输入输出
  • 学习设计模式的网站
  • Hadoop学习笔记(HDP)-Part.08 部署Ambari集群
  • IDEA加载阿里Java规范插件
  • 【CSP】202305-1_重复局面Python实现
  • html5各行各业官网模板源码下载(1)
  • 6 Redis缓存设计与性能优化
  • SpringCloud常见问题
  • 实战演练 | 在 Navicat 中格式化日期和时间
  • mysql面试题分享带答案
  • 利用 Python进行数据分析实验(一)
  • Jupyter Notebook工具
  • c语言上机小练(有点难)
  • <JavaEE> 什么是线程安全?产生线程不安全的原因和处理方式
  • Kotlin 中的 also 和 run:选择正确的作用域函数
  • ZKP Understanding Nova (1): MinRoot Example