- Home /
Need Help making Pong AI beatable
Alright so I just edited this post because I was able to figure out how to make the enemy paddle follow the ball. I am looking for help on how to make the computer actually able to miss the ball from time to time.
Any ideas?
I'm thinking about maybe tweaking things so that the ball's speed is affected by possibly drag, player paddle, enemy paddle, bouncing off the walls? Anybody know how to make it so the does not always bounce in a predictable direction either?
Here's my code - Thanks in advance! :)
using UnityEngine;
using System.Collections;
public class EnemyAI : MonoBehaviour
{
Transform Enemy;
void Start ()
{
Enemy = GameObject.Find ("Ball").transform;
}
void Update ()
{
transform.position = new Vector3
(8.0f,
Enemy.position.y,
transform.position.z);
}
}
Answer by getyour411 · Mar 13, 2014 at 06:58 AM
You will have to rewrite your Update() code to use a method that involves speed. Try
http://docs.unity3d.com/Documentation/ScriptReference/Vector3.MoveTowards.html
Your answer
Follow this Question
Related Questions
AI raycasting problem 0 Answers
Collider Vision AI question. Solved! 0 Answers
Having AI Accelerate Up & Down 0 Answers
[C#] Raycast based AI 2 Answers
For each Raycast? 1 Answer