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 bubi3ee · Dec 26, 2012 at 02:26 PM · controlrunner

Running Chicken Controls

![alt text][1]My group and I are developing a game for a class project and we would like to know how to control the chicken. We want the chicken to run using the left + right arrow key, if I press left arrow key, the left foot moves forward. And if I press the right arrow key, the right foot moves forward, so that the chicken can run by pressing the left + right arrow keys alternately.

our game is going to be a 3D chicken racing game [1]: /storage/temp/6098-chic.png

chic.png (68.2 kB)
Comment
Add comment · Show 1
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 Fattie · Dec 26, 2012 at 02:26 PM 2
Share

You'd have to explain your project, and include an image. For example, is it 2d, 3d, do you use CharacterControllers, or what?

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by MaGuSware™ · Dec 27, 2012 at 06:55 AM

Out of your update loop declare a new int variable.

 C# - int lastStep = 0; //0 = no step, 1 = left step, 2 = right step
 JS - private var lastStep : int = 0;

And in the update:

 if(Input.GetKeyDown(KeyCode.LeftArrow) && lastStep != 1)
 {
     DoLeftStep();
     lastStep = 1;
 }
 else if (Input.GetKeyDown(KeyCode.RightArrow) && lastStep != 2)
 {
     DoRightStep();
     lastStep = 2;
  }

This will give you the alternative pressing. You will just need to make the functions to step.

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 bubi3ee · Dec 27, 2012 at 10:37 AM 0
Share

tnx a lot. :)

avatar image Fattie · Dec 27, 2012 at 10:39 AM 0
Share

@bub - if that's the answer you want pls press the TIC$$anonymous$$ button, to close the question.

You get points for doing so, also. And only you can do it to keep the board tidy

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

11 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

Related Questions

How to make camera position relative to a specific target. 1 Answer

There has to be a more efficient way than this! (Simple running man game) 0 Answers

If statement being ignored (Apparently) 2 Answers

Hey everyone. I need some help please. Does any of you know a Bike controller/physics tutorial? ,does anyone know any tutorials on bike movement and Physics? 2 Answers

Continuous instantiation of a moving prefab 2 Answers


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