奥运测手速小游戏(傅女神)
![](http://img.manew.com/data/attachment/forum/201608/12/115159kshylptg3k21p63y.gif)
![](http://img.manew.com/data/attachment/forum/201608/12/115244ktqip1jegfyieigk.jpg.thumb.jpg)
1
2
3
4
5
6
7
|
public void IStart()
{
SceneManager.LoadScene( "Scene1" );
}
public void IExit()
{
Application.Quit();
}
|
![](http://img.manew.com/data/attachment/forum/201608/12/115244v3nn75k47bkg7bbs.jpg.thumb.jpg)
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
|
using UnityEngine;
using System.Collections;
public class followTarget : MonoBehaviour {
public float smoothing = 3;
private Transform player;
// Use this for initialization
void Start()
{
//player = GameObject.FindGameObjectWithTag(Tags.player).transform;
player = GameObject.Find( "swimmer" ).transform;
}
// Update is called once per frame
void FixedUpdate()
{
Vector3 targetPos = player.position + new Vector3(0, 0, -6);
transform.position = Vector3.Lerp(transform.position, targetPos, smoothing * Time.deltaTime);
}
}
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class Move : MonoBehaviour {
public float speed = 1;
float speed1 = 0;
float i = 0;
int m = 0; //时间
int n = 0; //点击次数
Vector2 ToPos = new Vector2(1,1);
GameObject player;
Text indexClick;
Text indexTime;
bool ifSave = true ;
//动画组件
private Animator mAnim;
// Use this for initialization
void Start () {
player = GameObject.Find( "swimmer" );
indexClick = GameObject.Find( "Canvas" ).transform.Find( "clickText" ).GetComponent<Text>();
indexTime = GameObject.Find( "Canvas" ).transform.Find( "timeText" ).GetComponent<Text>();
mAnim = GetComponent<Animator>();
mAnim.SetBool( "idle" , true );
mAnim.SetBool( "swim" , false );
}
// Update is called once per frame
void Update () {
if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.X))
{
speed1 += 0.9f;
n++;
indexClick.text = "点 击 次 数:" + n.ToString();
mAnim.SetBool( "swim" , true );
mAnim.SetBool( "restart" , true );
}
else if (speed1 > 0)
{
speed1 -= 0.09f;
mAnim.SetBool( "swim" , false );
mAnim.SetBool( "restart" , false );
}
else
{
speed1 = 0;
mAnim.SetBool( "stop" , true );
}
GetComponent<Rigidbody2D>().MovePosition(transform.position + new Vector3(1, 0, 1) * speed1 * Time.deltaTime);
//秒计时器
if (i >= 1.0f)
{
i = 0;
m++;
indexTime.text = "用时(秒):" + m.ToString();
//print(m);
}
i += Time.deltaTime;
//数据存储
if (player.transform.position.x > 8.4f && ifSave == true )
{
PlayerPrefs.SetInt( "indexClick" , n);
PlayerPrefs.SetInt( "indexTime" , m);
ifSave = false ;
SceneManager.LoadScene( "Scene2" );
}
}
}
|
![](http://img.manew.com/data/attachment/forum/201608/12/115244omntj8jer4z6mj0z.jpg.thumb.jpg)
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class showFinal : MonoBehaviour {
int indexTime;
int indexClick;
Text ClickText;
Text TimeText;
// Use this for initialization
void Start () {
indexClick = PlayerPrefs.GetInt( "indexClick" );
indexTime = PlayerPrefs.GetInt( "indexTime" );
ClickText = GameObject.Find( "Canvas" ).transform.Find( "clickText" ).GetComponent<Text>();
TimeText = GameObject.Find( "Canvas" ).transform.Find( "timeText" ).GetComponent<Text>();
ClickText.text = "点 击 次 数:" + indexClick.ToString();
TimeText.text = "用时(秒):" + indexTime.ToString();
}
// Update is called once per frame
void Update () {
}
public void Restart()
{
SceneManager.LoadScene( "Scene1" );
}
public void Exit()
{
Application.Quit();
}
}
|
奥运测手速小游戏(傅女神)相关推荐
- 【Python】利用tkinter开发测手速小游戏
一.简介 利用tkinter开发测手速的小游戏,大家10s内可以点击鼠标多少次呢?想测试一下吗?来试试测手速下游戏吧!仅供娱乐~ 试玩视频: 测手速小游戏 游戏截图: 二.代码分模块介绍 2.1 导入 ...
- JQuery测手速小游戏-遁地龙卷风
(-1)写在前面 我用的chrome49,jquery3.0,我得到过399分,信不信由你. (1)设计思路 两个p元素放在div里,每个p元素的高度和宽度都和div一样,当鼠标放在div上时,第一个 ...
- CocosCreator拼手速小游戏(教程 + 源码)TS实现小游戏
CocosCreator拼手速小游戏(教程 + 源码)TS实现小游戏 前言 游戏完成后的样子 玩法:在10秒内点击屏幕中间的按钮,最终记录一共点击了多少下 源码在Q群:1130122408 这个游戏比 ...
- Alex - 用python来写测手速游戏
# 测手速游戏 # 文字:按钮:0 次/s # 按钮 import time import tkinter # 1.初始化 mywindow = tkinter.Tk() # 3.设置标题 mywin ...
- Deqin- 升级版测手速游戏
import tkinter import time import cct = tkinter.Tk() t.geometry("500x500") t.title("反 ...
- succi -测手速游戏
import tkinter as tk import time window=tk.Tk() window.title('测手速游戏') window.geometry('600x500') # L ...
- 手机测试android程序下载,测手速下载_测手速手机版下载「安卓版」-太平洋下载中心...
这是一款用来做测试的综合测试类应用,可以测试你的各种能力. 在首页,你可以测试你的手速,首页的测手速共有5秒,10秒,20秒,30秒,60秒共五种模式可选.测试完成后你可以把测试结果分享到qq空间,q ...
- 计算机练手速的游戏,玩手速的游戏有哪些 手机上练手速的游戏推荐
玩手速的游戏有哪些,手速游戏顾名思义就是需要玩家有着敏捷快的反应和手速才能应对的游戏了,跑跑车为您带来手机上练手速的游戏推荐. 点杀泰坦2 作为剑圣来防卫世界的战斗还在持续,但是更多全新的更加危险的巨 ...
- ziheng - 测手速游戏
import tkinter as tk import timet1 = time.time()dian = 0 def zan():global dian # 全球的 变暖 把一个变量变成全局变量d ...
最新文章
- SQL Server调优系列基础篇(子查询运算总结)
- AcWing算法基础课 Level-2 第三讲 搜索与图论
- initial model for Agile Development Organization: Relationship Graph
- 万年历c语言编程代码_C语言高效编程与代码优化~
- excel几个表合成一张_快速将多个excel表合并成一个excel表
- java web sqlmapapi,深入了解SQLMAP API
- [蓝桥杯][历届试题]网络寻路(DFS)
- Android ndk之Check that/ndk/openssl/crypto/libsfk.so exists or that its path is corret
- 分析Spring容器启动流程 Spring初始化
- Spring Boot基础学习笔记23:用户自定义授权管理
- wordpress支持MySQL5.5_CentOS 5.5安装Nginx、PHP(FastCGI)、MySQL --搭建LNMP环境安装Wordpress...
- Navicat 解决方案之ORA-28547
- .NET程序中常用的28种代码
- 基于C#窗体的酒店管理系统
- window操作系统安装教程(PE辅助)
- 简练软考知识点整理-激励理论之赫兹伯格双因素理论
- 加密狗加密excel ,方法之 C#开发Excel自定义函数
- java业务场景-实现订单超时关闭等延时队列操作的几种方式
- 【路径规划】基于改进差分实现三维多无人机协同航迹规划matlab源码
- Amazon Alexa硬件方案选型
热门文章
- java万能盒子_Auslogics Disk Defrag Free最新版-Auslogics Disk Defrag Free下载v8.0.24.0 - 起点软件园...
- react项目部署到linux服务器
- Ubuntu16.04安装微信教程(亲测可用,不能用直接留言)
- 键盘和鼠标无法唤醒计算机,电脑休眠键鼠无法唤醒怎么办 键盘鼠标无法唤醒电脑解决方法...
- 好丽友春节活动H5:
- MongoDB 查询优化原则
- MySQL批量插入与更新
- 平民化的短视频和直播将加速世界融合
- 面向对象编程三⼤特性 --封装、继承、多态
- Android中探究抖音短视频的动态壁纸功能以及拓展功能使用