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 Alaro · Oct 09, 2011 at 10:29 PM · animation2dsprite

2D sprite character movement

Hey i'm currently making a 2D game based with sprites, I've got spritemanager 2 and the sprite sheets ready, could anyone try to explain how i make the character move and animate when i press the ¨right button¨. Like how to make the character movie and animate the right animation for which way i'm walking.

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 Salmjak · Feb 15, 2016 at 08:12 PM 0
Share

This tutorial should get you going. There isn't really any "short answer" that wouldn't lead to more questions.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Nasnas · Feb 16, 2016 at 12:57 PM

I think you are meaning this

 public Animator Anim;

 void Update()
 {
       transform.Translate(Input.GetAxisRaw("Vertical"), 0f, 0f, Space.World);

       if  (Input.GetAxisRaw("Vertical") == 1)
       {
             Anim.SetBool("YourLeftMovementAnimation", false);
             Anim.SetBool("YourRightMovementAnimation", true);
             Anim.SetBool("YourStandingAnimation", false);
             //You have to set bools to control the animations in the animation window so then you can play them when you want
       }
       else if (Input.GetAxisRaw("Vertical") == -1)
       {
             Anim.SetBool("YourLeftMovementAnimation", true);
             Anim.SetBool("YourRightMovementAnimation", false);
             Anim.SetBool("YourStandingAnimation", false);
       }
       else
       {
             Anim.SetBool("YourLeftMovementAnimation", false);
             Anim.SetBool("YourRightMovementAnimation", false);
             Anim.SetBool("YourStandingAnimation", true);
       }
 }

This only for left and right movement and the animation thing, but when it comes to jumping you have to do raycasting or use CharacterController

Comment
Add comment · 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
0

Answer by PheonyXtreme · Feb 16, 2016 at 12:59 PM

Hey there:) It seems you are new to this (no worries, I'm not expert either) so I advice you to check some good tutorials on youtube. There is a 2d platformer course made by Brackeys. He teaches you from character controling to camera adjustments, backgrounds, animations, sounds... That course is for Begginners/Intermediates. He teached me mostly all I know at the moment, so i'll be glad if he can help with your problems:)

Comment
Add comment · 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
0

Answer by Zoogyburger · Feb 15, 2016 at 08:14 PM

Take a look at this:

https://www.youtube.com/watch?v=TU6wflRqT5Q

https://www.youtube.com/watch?v=Oao-A7bkve0∈dex=3&list=PLiyfvmtjWC_X6e0EYLPczO9tNCkm2dzkm

Comment
Add comment · 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

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

6 People are following this question.

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

Related Questions

How can i start a 2D animation via script 1 Answer

How do I stop sprite animation on last frame? 2 Answers

Anima2d: How to use a single sprite for two paws? 0 Answers

Any reason to use Unity's GUI paradigm if I'm working with sprite sheets and don't need GUI button presses? 1 Answer

How to make not smooth animation? 0 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