Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by RevoX · Feb 11, 2014 at 01:51 PM · enemyjumpplatformer

2D Platformer AI Jump?

Hello,

I have a problem with creating a 2D platformer game (in C#). The platformer game is a game where you have to jump from platforms up to another platform to get higher and higher.

Now I need an AI that follows the quickest way to the player, and also jumps from one platform to another repeatedly to get higher.

How do I let the AI know when it can jump? (If he can also make the jump to a higher platform). How do I let him jump to the right position to the right platform at the right time?

I can't seem to find anything related to this anywhere, I have looked everywhere.

Any kind of help is appreciated.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Klarax · Feb 11, 2014 at 02:03 PM

i would probably go with putting triggers on each side of the platform, and then on enter trigger -> jump sctipt kicks in

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image RevoX · Feb 11, 2014 at 02:10 PM 0
Share

I have tried this before. But my AI is checking where the player is (on which side of him on the x axis), and he will move to that direction. Also, the AI doesn't always make the jump. It will also bug when landing and when you have to jump right away again.

Here's my script so you see what I did: http://pastebin.com/CBeFN5T3 or http://pastebin.com/raw.php?i=CBeFN5T3

avatar image Klarax · Feb 11, 2014 at 02:13 PM 0
Share

im not sure how to do this as im still learning myself. but i would suggest needing to implement a ray cast down in front of the AI. if no ground detected, then jump.

That should fix both issues. as the AI will wait til very near the edge so will make the jump, and on landing there will be ground again and no second jump

avatar image
0

Answer by Ankit Priyarup · Feb 11, 2014 at 02:56 PM

You can use unity 4.3 2D features. Then you need to download Unity standard asset beta from here

Import the character into a fresh scene and create script for main camera to move vertically in y position.Place a gameobject (cube) on the bottom (out of main camera) and create a script to show gameover when player get collide with that gameobject. In main camera make an empty gameobject and place a script called spawner you can get the script and other related help from here. http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/infinite-runner

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Ankit Priyarup · Feb 11, 2014 at 02:44 PM 0
Share

Here's the link for sample asset beta https://www.assetstore.unity3d.com/#/content/14474

avatar image RevoX · Feb 12, 2014 at 09:07 AM 0
Share

I know how to do all that, and how to make a 2D platformer. But the problem is the AI. The AI needs to jump on the right time. It needs to follow the player and also jump on the platforms so he can make it and get higher in the level. The links you gave look very useful but not for this problem. Thanks for the links because they seem useful in the future.

avatar image gimoj · Mar 20, 2014 at 01:03 PM 0
Share

I dunno if this will work but have you tried putting a frontcheck of sorts that will hit a collider at the end of the platform that will cause it to jump?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

My character can't jump while already moving 2 Answers

Hold to jump higher 0 Answers

Enemy follows the only player in rotation 2 Answers

2,5D game jump script with multiple linecasts to check if grounded 1 Answer

Jump on Enemy heads to destroy enemy? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges