How do I create the same sprite + current frame? (duplicate)

Get help using Construct 2

Post » Mon Mar 03, 2014 2:15 pm

Hey Guys!
I have a sprite that have a few frames (animation).
The animation is on speed 0, and I can change the frames with the Right/Left arrows.

:?: What I'm trying to do is:
When I'll click on this sprite with the middle click button, it will create a new sprite with the same position, angle, size, and.... the main problem: with the exact same frame that the sprite was BEFORE I click over.

Basically, I want to make some kind of "clone" or "duplicate" of the exact same status of the latest sprite.

Any help will be appreciated, Thanks ahead!

* Sorry about my bad English
B
10
S
1
G
1
Posts: 40
Reputation: 755

Post » Mon Mar 03, 2014 2:20 pm

Store the original frame number in a local variable, and then after the new sprite is created, set it's frame to the stored value.
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994

Post » Mon Mar 03, 2014 2:24 pm

Thanks for the fast reply blackhornet,
The thing is that I start the layout clean. I have a button that create the sprites.
Each sprite created on the layout start with a random frame.

Do I need to make this 'store action' on every time I create a new sprite?
Will this eat the memory/performances if I'll create lots of sprites on the screen?
B
10
S
1
G
1
Posts: 40
Reputation: 755

Post » Mon Mar 03, 2014 2:58 pm

You only store the value for the time between clicking the button, and setting on the new sprite. This action won't affect performance.
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994

Post » Mon Mar 03, 2014 7:32 pm

I'm still trying to mess around with the all thing but I got lost, I guess it's too complicated for me because I'm still a beginner...
An example .capx file will be appreciate if anyone interested to help.

Thanks ahead!
B
10
S
1
G
1
Posts: 40
Reputation: 755

Post » Mon Mar 03, 2014 8:42 pm

It would be simpler for you to post the file, since you have one already.
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994

Post » Mon Mar 03, 2014 8:56 pm

I Agree, but unfortunately I can't post links at all since I'm still a noob at the forums.
I also had the same problem with other threads...
B
10
S
1
G
1
Posts: 40
Reputation: 755

Post » Mon Mar 03, 2014 11:15 pm

You can use Dropbox and just munge the address a bit so the auto-detect doesn't block it.
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994

Post » Tue Mar 04, 2014 8:27 pm

Message: Alon can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Thanks blackhornet, I didn't know it's possible.

Here is the file, I tried to keep it clean... please notice, the frame-change (Left Right arrows) works only on the very first shape you create for some reason...

Here is the file:
https://dl.dropboxusercontent.com/u/29224993/Construct2%20Examples/How_to_Clone---001a.capx

Hope you or anybody else can help me solve this Clone / Duplicate issue. :)
B
10
S
1
G
1
Posts: 40
Reputation: 755

Post » Tue Mar 04, 2014 8:36 pm

Spawn doesn't work, but Create does.
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994

Next

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, ST314, tarek2 and 32 guests