Create object by name and set animation with scripting

0 favourites
  • 2 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • Hi everyone,

    I'm making a game with some "anime" style characters with a text table showing the dialogues.

    Every time I create a character I have this problem and I have to do as in the image below.

    I create the character with the function through a string but since it was created like this I can't locate it to assign the animation I want. So I have to create another function and I have come up with this method.

    I'm wondering if there's an easier and more efficient way to do this. For example using a script, but I've done only a few and haven't learned enough in javascript yet.

    How to do this?

    How would you do? Do you have a better idea?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Firstly, you are using "Wait for previous action to complete" wrong. It's supposed to be used with asynchronous action, they have a little clock icon on the right. You don't have them in your code. If you want to wait to the end of the tick, use "Wait 0".

    When you are creating an object by name and then want to do something to it, the common method is using a family. Add all sprites to a family. After the "Create" action add a sub-event with this condition: "Pick last created Family". And in the sub-event you'll be able to change the animation.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)