Entries this day: got-basic-pong-ai-working
日本語を勉強しました
got basic pong ai working
1:29 Friday 08 May 2015 JST
Now my AIMoveRacket script looks something like this:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class AIMoveRacket : MonoBehaviour {
public float speed = 30;
public float speedIncreaseMax = 50;
private GameObject myTarget;
private Transform ball;
private SliderJoint2D mySlider;
// Use this for initialization
void Start () {
// this slider will keep the paddles moving in precise lines
mySlider = gameObject.AddComponent<SliderJoint2D>();
mySlider.connectedAnchor = gameObject.transform.position;
mySlider.enableCollision = true;
mySlider.angle = 90; // needs to be 0 if we have paddles on top or bottom
}
// Update is called once per frame
void FixedUpdate () {
if (!ball) {
myTarget = BallSpawner.instance.theBall ();
ball = myTarget.transform;
} else {
return;
}
}
Vector2 myPostion = gameObject.GetComponent<Rigidbody2D> ().position;
if (ball.position.x > -9999) {
myPostion.y = Mathf.Lerp (myPostion.y, ball.position.y, 10 * Time.deltaTime);
}
myPostion.y = Mathf.Clamp (myPostion.y, -14, 14);
gameObject.GetComponent<Rigidbody2D> ().position = myPostion;
}
}
permalink
日本語を勉強しました
11:17 Friday 08 May 2015 JST
There are probably errors in the Japanese notes below!
- 不換紙幣 ふかんしへい fiat currency
- 著作 ちょさく writing (book)
- 潰す つぶす squish
- 抽象的 ちゅうしょうてき abstract
- かみなり lightning
- 大津市 おおつし 大津市はびわ湖の西ところ。
- 福井県 ふくいけん 福井県は滋賀県の北にいます。
- 岡山県 おかやまけん 岡山県は鳥取県の南の県。
- 島根県 しまねけん 島根県は鳥取県の西の県。
- 静岡県 しずおかけん 静岡県は神奈川県の南の県。
- 大分県 おおいたけん
- 新潟県 にいがたけん 新潟県の漢字が変な発音と思う。
- ちち dad
- はは mom
- 等しい ひとしい equal
- 欲しい ほしい WANT
permalink
|