Videos

#4 Make an Air Hockey Game in Unity – ARTIFICIAL INTELLIGENCE (AI) – Tutorial for Beginners



Reso Coder

What makes a perfect game? I think that challenging gameplay certainly plays the main role!

Up until now, we’ve made a pretty functional game, but one core aspect is still missing – opponent. Someone to play against… Making another human-controlled player in our air hockey game would be pretty simple, but that’s not what this particular tutorial is about.

In this tutorial, we are going to make a fully functional, awesome artificial intelligence for our game. This is some exciting stuff, so let’s do it together!

Get all of the code written in this tutorial: http://wp.me/p8jOJP-39

Go to my website for more information, code examples and articles:
http://resocoder.com

Follow me on social media:
https://www.facebook.com/resocoder
https://twitter.com/resocoder

Source

Similar Posts

18 thoughts on “#4 Make an Air Hockey Game in Unity – ARTIFICIAL INTELLIGENCE (AI) – Tutorial for Beginners
  1. My AI does not hit the ball hard enough to cross the middle….it moves sideways and not back and forward….help me please….thank you
    Edit: the ai is trying to return to its original starting position if i move it from the scene view. I even copied your code but i couldnt fix

  2. Its said NullReferenceException: object reference not set to an instance of an object
    AiScript.FixedUpdate() (at Assets/Script/Aiscript.cs:65)

    NullReferenceException: Object reference not set to an instance of an object

    My code in line 65 is the
    rb = MovePosition ( Vector2. Movetowards………

  3. UnassignedReferenceException: The variable Puck of AiScript has not been assigned.
    You probably need to assign the Puck variable of the AiScript script in the inspector.
    UnityEngine.Rigidbody2D.get_position () (at C:/buildslave/unity/build/artifacts/generated/common/modules/Physics2D/Physics2DBindings.gen.cs:2136)
    AiScript.FixedUpdate () (at Assets/Sprite/AiScript.cs:46)
    what does it means

  4. This is really starting to annoy me the AI script worked before and now it's not even hitting the puck back at me. Last night I followed this tutorial and it worked great I made a menu when I hit play everything dissapeared. I restarted just now and the AI isn't doing anything

  5. How would I modify the AI Script to hit the puck at a different angle? Right now it is just hitting it straight back and I would like it to try to bounce off the walls and actually try to make it into the goal. Would I modify the target inside the AI?

  6. Transform child out of bounce. I spent an hour looking for any mistakes in the code and still can't find the problem. Could anyone help me pls?

  7. Hey there! So my AI isn't working properly for some reason. I copied the code from your webpage but the opponent just follows the puck along the X axis and doesn't actually return it to the bottom part of the field. Any ideas on how to fix this? Pleaaaase help, if I can't fix this I'm gonna fail my class 🙁

  8. Following this tutorial as i'd like to get started with unity. I've followed your tutorial and i have an issue where the AI player doesn't hit back or move on the Y axis at all. I've pasted your code from the link provided just to make sure i didn't make an error and i still have this problem. How could i solve it?

  9. Hi… I followed your steps but when I want to start play it keeps says, "Should not be capturing when there is a hotcontrol UnityEngine.GUIUtility" Please help me… Thank you…

Comments are closed.

WP2Social Auto Publish Powered By : XYZScripts.com