only a sprite ?!

For questions about using Classic.

Post » Tue Feb 22, 2011 8:25 am

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 !!!
B
2
G
2
Posts: 12
Reputation: 674

Post » Tue Feb 22, 2011 12:12 pm

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 :

[code:a6py8u1x]+ 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?
B
4
S
1
G
2
Posts: 91
Reputation: 1,057

Post » Sun Apr 10, 2011 7:37 am

thanks !

but i have find a other solution:
-create sprite
-create canvas
-paste the sprite in the canvas
-delete the sprite !
B
2
G
2
Posts: 12
Reputation: 674

Post » Sun Apr 10, 2011 12:58 pm

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.

[url:wr16ofdn]http://dl.dropbox.com/u/22173473/Sprite%20splitter.rar[/url:wr16ofdn]

contains cap file and images.

Hope this helps.
B
19
S
6
G
7
Posts: 1,206
Reputation: 7,300


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests