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

使用免费网站制作软件宁波好的seo外包公司

使用免费网站制作软件,宁波好的seo外包公司,巩义网站网站建设,分析seo网站项目成果 项目网盘 导入资源包 放入Assets文件Assets资源文件 游戏流程分析 摄像机size调小,让图片占满屏幕 人跑本质,相对运动,图片无限向右滚动 图片720,缩小100倍第二个图片x为7.2每unit px100两张图片刚好挨着连贯 空对象Bg…

项目成果 项目网盘

导入资源包 放入Assets文件Assets资源文件

游戏流程分析

摄像机size调小,让图片占满屏幕
人跑本质,相对运动,图片无限向右滚动
图片720,缩小100倍第二个图片x为7.2每unit px100两张图片刚好挨着连贯

空对象BgControl,方便管理
reset
放两张图片
创脚本Bgcontrol,拖到该对象上
层级-10
脚本文件夹,c#脚本
地面对象
层级-5
碰撞组件box collider 2d,编辑碰撞器。
挂脚本
三个地面都拖成预设体
前两个地面固定,后一个随机
Prefabs预设体文件夹
ground拖进去
coin进去
切片
多张
sprite editor 
切片
应用
对象声音,挂脚本
单例
创建groundcontrol脚本
脚本挂到地面对象上
预设体相当于类和对象

背景 -10
地面  -5地面预设体给标签ground 碰撞器
声音 挂脚本
动画  窗口 跑 跳 死亡   过渡 设置参数
        无退出,过渡0,isjump true
主角  层级10  标签player 碰撞组件 刚体组件 冻结旋转 重力缩放2,只提供重力加速度,加脚本(跳跃,地面上才能跳跃,播放声音,动画切换),
button UI 原图像 原像素显示,过渡 精灵切换 高亮图像   点击 玩家的跳跃 导航none
金币 脚本 碰撞器 吃的触发
桌子 放1号地面上 碰撞器 标签地面 预设体  
     1地应用所有
死亡  空对象die 碰撞器 编辑触发器 标签die
   player脚本
敌人 圆形碰撞器 1地 标签enemy 1地应用所有 预设体 触发
层级
切片
 

脚本代码

PlayerControl

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class PlayerControl : MonoBehaviour
{//血量public static int Hp=1;//刚体组件private Rigidbody2D rbody;//动画组件private Animator ani;private bool isGround;void Start(){//获取刚体组件rbody = GetComponent<Rigidbody2D>();//获取动画组件ani = GetComponent<Animator>();}void Update(){//如果按了空格键if (Input.GetKeyDown(KeyCode.Space)){//跳跃Jump();}}//跳跃public void Jump(){if (isGround == true){//给刚体一个向上的力rbody.AddForce(Vector2.up * 400);//播放跳跃声音AudioManager.Instance.Play("跳");}}//发生碰撞private void OnCollisionEnter2D(Collision2D collision){//判断如果是地面if(collision.collider.tag=="Ground"){isGround = true;//结束跳跃ani.SetBool("IsJump", false);}//如果是死亡边界if(collision.collider.tag=="Die" && Hp > 0){//血量为0Hp = 0;////播放死亡声音AudioManager.Instance.Play("Boss死了");//播放死亡动画ani.SetBool("IsDie", true);}}//结束碰撞private void OnCollisionExit2D(Collision2D collision){//判断如果是地面if (collision.collider.tag == "Ground"){isGround = false;//开始跳跃ani.SetBool("IsJump", true);}}//如果碰到敌人private void OnTriggerEnter2D(Collider2D collision){if (collision.tag == "Enemy"){//血量为0Hp = 0;////播放死亡声音AudioManager.Instance.Play("Boss死了");//播放死亡动画ani.SetBool("IsDie", true);}}
}

CoinControl 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class CoinControl : MonoBehaviour
{// Start is called before the first frame updatevoid Start(){}// Update is called once per framevoid Update(){}//如果产生触发private void OnTriggerEnter2D(Collider2D collision){//播放吃金币的声音AudioManager.Instance.Play("金币");//销毁自己Destroy(gameObject);}
}

AudioMnager

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class AudioManager : MonoBehaviour
{//单例public static AudioManager Instance;//播放组件private AudioSource player;void Start(){//单例Instance = this;//获取播放组件player = GetComponent<AudioSource>();}//播放音效public void Play(string name){//通过名称获取音频片段AudioClip clip = Resources.Load<AudioClip>(name);//播放player.PlayOneShot(clip);}
}

BgControl

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class BgControl : MonoBehaviour
{//速度 每帧移动0.2像素public float Speed = 0.2f;// Start is called before the first frame updatevoid Start(){}// Update is called once per framevoid Update()   //update是每一帧会调用一次{//如果玩家血量为0if(PlayerControl.Hp==0){return;}//遍历背景,背景就是子物体foreach (Transform tran in transform){//获取子物体的位置Vector3 pos = tran.position;//按照速度向左侧移动pos.x -= Speed * Time.deltaTime;  //每秒向左侧移动0.2//判断是否出了屏幕if (pos.x < -7.2f){//把图片移动到右边pos.x += 7.2f * 2;}//位置赋给子物体tran.position = pos;}}
}

GroundControl

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class GroundControl : MonoBehaviour
{//速度public float Speed = 2f;//要随机的地面数组public GameObject[] GroundPrefabs;// Start is called before the first frame updatevoid Start(){}// Update is called once per framevoid Update()   //update是每一帧会调用一次{//如果玩家血量为0if (PlayerControl.Hp == 0){return;}//遍历背景,背景就是子物体foreach (Transform tran in transform){//获取子物体的位置Vector3 pos = tran.position;//按照速度向左侧移动pos.x -= Speed * Time.deltaTime;  //每秒向左侧移动0.2//判断是否出了屏幕if (pos.x < -7.2f){//创建新的地面Transform newTrans = Instantiate(GroundPrefabs[Random.Range(0, GroundPrefabs.Length)], transform).transform;
// ,后transform确定父子关系   .后transform拿到新地面的transform组件//获取新地面的位置Vector2 newPos = newTrans.position;//设置新地面的位置newPos.x = pos.x + 7.2f * 2;//位置设置回去newTrans.position = newPos;//销毁旧的地面(出了屏幕的地面)Destroy(tran.gameObject);}//位置赋给子物体tran.position = pos;}}
}

http://www.hkea.cn/news/624861/

相关文章:

  • 全国新型疫情最新情况长沙网站搭建优化
  • 郑州网站建设规划seo建站教程
  • 购物网站 购物车界面如何做百度搜索网
  • 推广网站的图片怎么做外贸平台
  • 新手如何给自己的网站做优化bt种子磁力搜索
  • 成都学校网站制作遵义网站seo
  • d?t网站模版宁波seo在线优化哪家好
  • c做的网站淄博做网站的公司
  • 网站开发制作公司郑州网站建设外包
  • 注册域名用个人还是公司好长沙seo优化排名
  • 电子商务网站建设与维护展望今日新闻联播
  • 网站建设主流技术站长之家ping检测
  • 温州建设集团有限公司网站首页百度手机版网页
  • 广西网络干部学院官网seo推广人员
  • 可以做红娘的相亲网站江北seo综合优化外包
  • 公司建设网站需要注意什么软文广告示范
  • 高端网站建设 引擎技企业网页
  • 模仿别人网站百度外链查询工具
  • 教程建设网站广告免费发布信息平台
  • wordpress php5.4支持宁波seo排名优化
  • 宁波制作网站哪个好百度怎么发自己的小广告
  • 新浪网站用什么语言做的百度软件下载
  • wordpress如何做网站重庆seo俱乐部联系方式
  • 教育局两学一做网站深圳全网推广平台
  • 淘宝做详情页代码网站免费大数据查询平台
  • 苹果做安卓游戏下载网站好新媒体营销案例ppt
  • 网络营销实务关键词优化seo优化排名
  • 网站推广优化教程游戏代理加盟平台
  • 网站提升权重全国疫情高峰感染进度
  • 营销型网站怎么做智能建站abc