Resize handles [example]

Get help using Construct 2

Post » Thu Jan 17, 2013 12:55 am

R0j0 Strikes back ! Well done , man !
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Mon Feb 18, 2013 7:59 am

This is awesome. I was trying to find out how to do this. Thanks for posting.ViiVoices2013-02-18 08:02:30
B
11
S
3
G
3
Posts: 19
Reputation: 2,942

Post » Tue Sep 17, 2013 10:35 pm

Thx for sharing! Works perfect!
B
6
Posts: 9
Reputation: 456

Post » Mon Nov 11, 2013 5:08 am

Thanks! This totally saved me a good chunk of time!!!
B
37
S
9
G
7
Posts: 143
Reputation: 6,017

Post » Sun Mar 02, 2014 11:11 pm

This is really amazing way to resize and rotate a sprite!
Is there a Behaviour or Plugin for the same task?
I'm a beginner C2 user, such tool is very impressive and useful.

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

Post » Wed May 20, 2015 9:42 pm

I just came across this - an amazing piece of work. Thank you for sharing!
B
23
S
7
G
1
Posts: 186
Reputation: 2,691

Post » Sat Nov 28, 2015 8:05 am

@R0J0hound Hey Bud,

I started to try and work on a multi touch version of this -which I still think may be useful- but it morphed into a gesture to scale problem.

I was thinking the first two touches -semi-regardless of location- would act as if you were holding two corner handles. Then you could scale the height and width with your touches. I guess it would work like Google maps, but instead of pinch to zoom it would be pinch to scale; without rotation.

I made a really good attempt at it modifying the zooming example but it got pretty messed up. Curious on your thoughts. THANK!
B
37
S
9
G
7
Posts: 143
Reputation: 6,017

Post » Sat Nov 28, 2015 6:09 pm

@basspenguin
I don't have a multi-touch device but you could try this. Put it before the event that positions the handles. The only conflict you may run into is dragging a handle while doing this.
Code: Select all
global number touchWidth_new=0
global number touchWidth_old=0
global number touchHeight_new=0
global number touchHeight_old=0

touch: on touch 1 start
> set touchwidth_old to (touch.xat(1)-touch.xat(0))*cos(sprite.angle) + (touch.yat(1)-touch.yat(0))*sin(sprite.angle)
> set touchheight_old to (touch.xat(1)-touch.xat(0))*cos(sprite.angle+90) + (touch.yat(1)-touch.yat(0))*sin(sprite.angle+90)

touch: has touch 1
sprite: pick instance with uid picked
> set touchwidth_new to (touch.xat(1)-touch.xat(0))*cos(sprite.angle) + (touch.yat(1)-touch.yat(0))*sin(sprite.angle)
> set touchheight_new to (touch.xat(1)-touch.xat(0))*cos(sprite.angle+90) + (touch.yat(1)-touch.yat(0))*sin(sprite.angle+90)
> sprite: set width to self.width+touchwidth_new-touchwidth_old
> sprite: set height to self.height+touchheight_new-touchheight_old
> set touchwidth_old to touchwidth_new
> set touchheight_old to touchheight_new
B
79
S
24
G
54
Posts: 4,754
Reputation: 40,771

Post » Tue Dec 01, 2015 7:00 am

Awesome! I'll work on this and report back. Thanks!
B
37
S
9
G
7
Posts: 143
Reputation: 6,017

Post » Mon Dec 07, 2015 11:55 pm

Another Example
Here is a another example/experiment that implements the custom rotation points per sprite and the beginnings of some simple object hierarchy (only one level for now).
https://dl.dropboxusercontent.com/u/542 ... tspot.capx
B
79
S
24
G
54
Posts: 4,754
Reputation: 40,771

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Lof, YoHoho and 21 guests