Resize handles [example]

Get help using Construct 2

Post » Sun Jul 01, 2012 9:36 pm

Here is an example of drag and drop with re-size handles:
http://dl.dropbox.com/u/5426011/examples12/resize.capx
made with r97
B
79
S
24
G
55
Posts: 4,755
Reputation: 41,273

Post » Sun Jul 01, 2012 10:31 pm

That's cool example! :D
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,646

Post » Sun Jul 01, 2012 10:34 pm

Very nice example, added to the how do I FAQ. Thanks @R0j0hound.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,805

Post » Sun Jul 01, 2012 11:16 pm

i really like it ^^ keep the good work :)
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Sun Jul 01, 2012 11:20 pm

Thank you , very great exemple !!!
B
21
S
5
G
5
Posts: 163
Reputation: 5,028

Post » Sat Jan 05, 2013 3:22 am

I've been playing with this, added keyboard nudge, right clicking handles to rotate with snap to 45 degrees if shift is held. But I'm stuck on getting the handles to size right when rotated with the sprite.

I've tried couple times, but it gets bloated, and never really works. It's nicer using it with the handles floating over the rotated sprite in a global fashion. So that's what I will use unless someone can figure out how to work the floating X & Ys.

Here's R0J0's code with the nudge and rotate if someone wants to add some more resize/rotate features:
https://dl.dropbox.com/u/85412219/forumposts/resizerotate.capx

Thanks R0J0!
B
201
S
52
G
30
Posts: 897
Reputation: 36,621

Post » Sun Jan 06, 2013 8:40 pm

@Paradox
Here's an updated example that positions the handles correctly when rotated.
http://dl.dropbox.com/u/5426011/examples16/resize2.capx

You can right click anywhere to do rotation and I eliminated the need of an array.
B
79
S
24
G
55
Posts: 4,755
Reputation: 41,273

Post » Sat Jan 12, 2013 6:30 pm

Wow you really topped the first version. This one is so compact I can't see how it's working. How does that adding and subtracting the handle's positions work, so I can try and add limits? (max size or snapping)

Thanks, my level editor is already much better with this alone.
Any ideas on multiple selections? (I may not do that, it'snot that important.)
B
201
S
52
G
30
Posts: 897
Reputation: 36,621

Post » Sat Jan 12, 2013 8:30 pm

Max size is doable by using clamp() on the action in event 4 to set the sprite size. Snapping to sizes in increments of say 32 is also doable with round(width/32)*32. Snapping handles to arbitrary positions would be a lot more complex mathematically.
B
79
S
24
G
55
Posts: 4,755
Reputation: 41,273

Post » Wed Jan 16, 2013 9:01 pm

I had tried something like that with MIN, but clamp does work better as it can stop in the negative direction as well.
| clamp(self.Width+handle.hor*dw,-Sprite.Max,Sprite.Max)
| clamp(self.Height+handle.ver*dh,-Sprite.Max,Sprite.Max)

But it has a quirk when you drag past the clamped size where it jumps around and flickers positive to negative sizes. Which led me to believe I must not know what's going on.
B
201
S
52
G
30
Posts: 897
Reputation: 36,621

Next

Return to How do I....?

Who is online

Users browsing this forum: ETgirl79 and 12 guests