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

Get help using Construct 2

Post » Tue Mar 04, 2014 8:54 pm

First of all, Thank you for helping, I appreciate it!

It's cloning the frame + position, GREAT!
The only thing I try to understand is how to make also the angle... I'm trying to mess with it but still kind of lost.
I've edited the 'Create object" line you made, and did this:

Sprite.X +Sprite.Angle
Sprite.Y +Sprite.Angle

But it's not working... well I'm still new to this all thing.
B
10
S
1
G
1
Posts: 40
Reputation: 755

Post » Tue Mar 04, 2014 9:05 pm

Same trick. Angle is a separate field, like Frame. Make another local variable (Can't call it Angle, so SAngle), store the clicked sprite's Angle. Set the new sprite's Angle = SAngle.
ImageImageImage
B
71
S
21
G
220
Posts: 3,648
Reputation: 123,725

Post » Tue Mar 04, 2014 9:50 pm

Trying to follow your instructions but I'm not sure what I'm doing wrong...
I hope that I'm on the right direction. :?
You do not have the required permissions to view the files attached to this post.
B
10
S
1
G
1
Posts: 40
Reputation: 755

Post » Tue Mar 04, 2014 10:36 pm

Don't separate them! Move the SAngle directly under Frame, and Set SAngle under Set Frame, and Sprite.Set angle under Set animation.

What you are doing is storing the data from the original Sprite. Once stored, then you create a new Sprite. All instructions after the new Sprite affect the new Sprite. As soon as you pop out to a new event line, you are back at the original Sprite.
ImageImageImage
B
71
S
21
G
220
Posts: 3,648
Reputation: 123,725

Post » Tue Mar 04, 2014 10:51 pm

Thanks! it works like a charm! :)

I have the very basic understanding of: " If this happened, than do that.. " that's how I've managed to make the very basic thing real fast.
But when it comes to the variables and expressions... I still have so much more to learn and practice, I'm far away from having a brain of a programmer but this specific experience (thanks to your help of course) was a great way to start understand how it works. I appreciate it a lot.
B
10
S
1
G
1
Posts: 40
Reputation: 755

Post » Tue Mar 04, 2014 10:57 pm

BTW - Do you think there is a way to make the rotate part (with the wheel) if there are few shapes over each other, so it will ONLY rotate the one that is clicked last?

Not sure how to explain it because of my bad English but I wonder about it, right now it's rotating all the shapes under the mouse.
B
10
S
1
G
1
Posts: 40
Reputation: 755

Post » Wed Mar 05, 2014 12:14 am

Add an instance variable to the selection sprite (Sprite2), and store the UID of the main Sprite on Click. Then add Sprite2.CurrentUID = Sprite.UID to the wheel up, and then wheel down event. This will limit it in the way you want.

I've done it here, but give it a try yourself.
ImageImageImage
B
71
S
21
G
220
Posts: 3,648
Reputation: 123,725

Post » Wed Mar 05, 2014 5:30 pm

Unfortunately, I have no idea how to work with UID yet, so it was hard for me to follow your instructions.
So, I took a look on the manual but it didn't help me to understand exactly what I'm doing. :?

I did create an instance variable called: 'Selection' by clicking on the Sprite2 (the animated selection sprite) on the layout. but from that point you'll see what a mess I did because I need to understand it better, the manual didn't help me much because I better see see this in action to understand the logic behind it of store and restore variables and such.

Lets say I don't have Sprite2 at all, (I just made it for fun anyway), is it still possible to do? or it will be easier with this extra sprite?
Can please you try to instruct me more specific, step-by-step. I hope that I'll get more confidence in C2 by the day, I'm already messing with it a few days now and discover and learning new things every day!

Here is a screenshot of what I did (marked the lines).
You do not have the required permissions to view the files attached to this post.
B
10
S
1
G
1
Posts: 40
Reputation: 755

Post » Wed Mar 05, 2014 6:03 pm

Select the SpriteSelection in the Layout to see that it has a new instance variable: SelectedUID. In event 2, add SelectedUID = SpriteUID. In 7 and 8 test for SelectedUID = Sprinte.UID. In 12, reset the SelectedUID, when you deselect.

You can do the same with a Global variable and without the selection, but then it isn't obvious which one is selected, and which needs the cursor over it to do the rotation. Your call.
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
71
S
21
G
220
Posts: 3,648
Reputation: 123,725

Post » Wed Mar 05, 2014 6:09 pm

I just had to look on your file, and read your instructions to follow. but it's not working (your file).
I can still rotate everything under the shape I clicked.
B
10
S
1
G
1
Posts: 40
Reputation: 755

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], Malhog and 12 guests