create an animation directly in game

0 favourites
  • 14 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • Hello.

    my goal is to be able to add new animations to my sprite directly in game.

    how could i do?

    I already know the method to create a new sprite using the selectfile.

    out there I would just like to be able to create new animations in the sprite directly in game.

  • According to me it depends if all the possible sprites are already predefined in the game.

    If so, you might just build an interface to save a sequence of sprites in an array.

    For example: you make 1 sprite with 10 possible frames. You create an array and populate with numbers 0 to 9 at runtime, and you make a routine to loop through the array and set the correct frame.

    If, on the other hand you want to upload your own custom sprites at runtime, I don't really know...

    You can find plenty of examples of looping through arrays on my youtube channel, for example in the bubble shooter

    youtu.be/Skc7JJOYSOI

    changing animation frames at runtime is easy, for example found in solitair when flipping cards around :

    youtu.be/E1zqEGLeCyI

    I hope to have helped you

  • You can load images into a sprite in runtime, but you will need to create this sprite and add a bunch of empty frames into it in the editor.

    Then in runtime you load a new image into every animation frame, set animation speed and you get yourself an animation.

  • with that piece of code can I come and add my image in the animation?

  • Sprite Set animation frame

    then Sprite Load Image from URL

  • Hello I can't load the image into a sprite in a frame.

    I try to make a set frame my it asks me for a number.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This will load an image into frame 5. If you need to load images for all frames, run this is in a loop.

    .

  • Hello then I managed to replace the already existing frames with my images.

    Except if I create 2 different instance the 2 instance changes despite my condition to have the same uid.

    here is an example on a C3 project that I created for the rental.

    https://www.mediafire.com/file/ykl5coiyhrbvlnr/Exemple.rar/file

  • Pick object by UID=object.UID makes no sense, it will pick all objects.

    Can you explain what exactly you are trying to do?

  • that allows to spawn 1 single instance on the object.

    because if I remove this condition the object will spawn on all my instances.

    the problem is not here.

    the problem is that if I create 2 instances and I want to modify only one specific instance they will change all the instances.

    off I tell him the condition well.

    ObjectElement = Object.UID

    outside this instruction does not seem to be taken into account.

  • I still don't understand why you need UIDs, especially since you don't have a single sprite instance on the layout. Try this version:

    dropbox.com/s/u6brv0shg2u7cu5/Frame.c3p

  • the concern is that if I create an instance of this object and modify it all the objects will also change their image

  • Yes, when you load an image, it will be loaded into all instances, even on other layouts.

  • well that's precisely the problem.

    a person on discord advised me to use several animations for my different instances.

    I will try.

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