0 Favourites

only a sprite ?!

This forum is currently in read-only mode.
  • i want to create a software for animation. I can import images with a edit box. we write the address in the edit box and we click in "ok" to import the image.

    the "program" is:

    On click in the button --> Create a object (sprite)

    --> sprite load the frame file from (edit box text)

    but when i have an other sprite, the older have the frame from the new address writed in the edit box !!!

    i tested different "programs" with a global/private variable, loop, repeat, for each object, ...

    but i have always this problem !!!

    *sorry for expressions, i'm french !*

    i just want actions for only a image, but with the same sprite !!!

  • It's probably because they are duplicates of the same sprite object. Changing the picture in a frame will change every instance of the sprite.

    I couldn't find how to add a frame to a sprite at runtime, but if you add them in the editor, you can then do something like this :

    + CommonDialog: File dialog: OK
        -> System: Add 1 to global variable 'ids'
        -> System: Create object Sprite on layer "BG" at 0,0
        -> Sprite: Set 'ID' to global('ids')
        -> Sprite: Set animation frame to Sprite.Value('ID')
        -> Sprite: Load frame from CommonDialog.FirstSelectedFile[/code:a6py8u1x]
    
    Of course that means you'll have to define a max number of frames to your sprite.
    
    But now i have to ask this question : is it possible to add an animation frame at runtime?
  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • thanks !

    but i have find a other solution:

    -create sprite

    -create canvas

    -paste the sprite in the canvas

    -delete the sprite !

  • prawnsushi

    "But now i have to ask this question : is it possible to add an animation frame at runtime?"

    You could have a look at the events in this app i made (sprite sheet splitter). I had to find an easy way to import images and add them to a sprites frames at runtime.

    http://dl.dropbox.com/u/22173473/Sprite%20splitter.rar

    contains cap file and images.

    Hope this helps.

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