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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by fenderog · Nov 15, 2014 at 06:55 AM · animation2dnpc

"Scripted" animations in 2d game

Hello,

I'm working on a 2d adventure game ( as in the old school point and click games) and I am wondering what is the best way to approach scripted animated events in the game.

For example, when a scene starts, during the 'cinematic' part, I want to have 2 npc characters enter the scene, have a chat and leave. And later during the game , when you trigger an event (by picking up an item) , I want them to walk into the room again .

What is the best way to handle these scripted events ? For example, I guess I can store hardcode the animation in a datafile , like : move to a, play sprite animation aa, move to b etc. and then play them as needed. But what I'm not sure with that method is how to overlap different scripted actions.

So is there a better method ? Sorry this is a bit of a broad question

thanks!

Comment
Add comment · Show 2
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 MD_Reptile · Nov 15, 2014 at 07:59 AM 0
Share

I don't know for sure what you mean by hard code the animation in a data file. I'd script movement first, methods for walking from point a to point b. Then do the dialog, show chat bubble, display text, move through paragraphs. Once you get those working, consider a director script that handles the story/progression of the game, with series of events, like your saying, character a walk to b from a, dialog 1 plays, character b dialog 1 responds... So on and so forth. As far as animation itself, use an animation controller I think it's called, create a state machine for any possible animations, call at the appropriate time from the controller you script. There's my thoughts. Good luck!

avatar image fenderog · Nov 15, 2014 at 08:30 PM 0
Share

yeah that's what I was trying to say with hardcoded, store the animation data somewhere and play it just like you described. Thank you , this does help!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Tanshaydar · Nov 15, 2014 at 09:30 PM

It really depends on what you exactly want to do. Scripted events and cutscenes are different things. If you want to do a scripted event, OnTriggerEnter2D is your friend, script your code and call it from there.

If you want to create a cutscene in the game (not a video), I suggest you to use Unity's own animation tool. Create a gameobject, attach it a script, and open animation tool. Choose the timeline and add Animation Event there, just to call your function at that specific point.

My game is a 3D horror game, and all cutscenes are in game. I use animation tool with a script to call functions to create effect the way I want with a timeline instead of events, delegates and enumerators.

Hope that helps.

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

28 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

2D Animation does not start 1 Answer

How to make an animation play after releasing key? 1 Answer

Animation not at correct position W/Video 0 Answers

Animated Overlay Armor Sprite 1 Answer

Animator State Freezing 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