Hi! I have implemented the idea from [this][1] question of mine which suggested me to make the speed of the Enemy to a Random number generated every time the Ball touches the Paddle . I got it working and it looks quite human now. I set the speed of the Enemy at a Random Range (9 and 3 - can be controlled) which changes when the Ball touches the Enemy Paddle.
My previous problem is solved in which, either the User or Enemy lost.
However, I have one issue - The speed 3 is a little too low for the enemy which could be generated by the computer randomly. Now, it remains too slow for the Enemy to hit the ball again after he already lost the previous point. Therefore, I had an idea of putting an invisible Trigger at the end of the screen which resets the speed of the Enemy to possibly a greater number through which the Enemy can at least return the next ball. I tried several times but I couldn't figure out how to use the function 'OnTriggerEnter' properly. It would be great if someone could help me with the code or give me a reference to a video which describes this solely. Sorry for being so helpless. Help will be GREAT! Thanks.
[1]: http://answers.unity3d.com/questions/1152768/how-to-make-my-single-player-pong-games-winloss-be.html
↧