Zoom sprite to 100%

Get help using Construct 2

Post » Tue Dec 24, 2013 4:11 pm

I could use some guidance on what would be a good method to make a zooming effect. I don't want it to seem like the camera is moving in, but to scale up the size of the sprite. What I'm trying to do is take a sprite resized down to like 2x2 and then on an event have it incrementally scale up to 100% of its original size, and at that point stop scaling.
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986

Post » Tue Dec 24, 2013 4:41 pm

I guess here's a way..
Give your sprite 2 variables- initwidth and initheight to store the size you want it to scale up to.
Then make something like
On conditions met ->
-sprite.width < sprite.initwidth -> add 1 to sprite.width
-same for sprite.height

There should be a better way, but this is first that comes to my head:P
Hope it helps:)JJList2013-12-24 16:41:38
B
18
S
5
G
1
Posts: 74
Reputation: 2,672

Post » Tue Dec 24, 2013 6:11 pm

That works well enough for me. I can't believe I didn't think of that. Thank you @JJList
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986

Post » Tue Dec 24, 2013 6:50 pm

Anytime!
Glad I could help ^_^
B
18
S
5
G
1
Posts: 74
Reputation: 2,672

Post » Tue Dec 24, 2013 7:29 pm

How about objects that aren't square? When I use this method it doesn't scale proportionately so the sprite is distorted until it reaches full size. I'm able to counteract the distortion somewhat by playing around with the rate that the x and y scale but my math isn't good enough to make it look completely smooth. Any ideas?
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986

Post » Tue Dec 24, 2013 7:58 pm

Hmm, that's odd.. It was meant to work for non-sqaure sprites..
Make sure your initwidth != initheight
Well, I'm probably wrong:P Mind posting your capx?:)JJList2013-12-24 19:59:14
B
18
S
5
G
1
Posts: 74
Reputation: 2,672

Post » Tue Dec 24, 2013 8:14 pm

http://www.dennisburch.info/example.capx
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986

Post » Tue Dec 24, 2013 9:24 pm

My bad, sorry:) Fixed! link
B
18
S
5
G
1
Posts: 74
Reputation: 2,672

Post » Tue Dec 24, 2013 9:34 pm

@JJList Thank you once again, that did the trick :)
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986

Post » Mon Jan 13, 2014 2:29 am

@burvey re: your capx, if the sprite is not square it will distort. The aspect ratio of width and height cannot increment at the same rate.

my sprite was 100x60 and grew distorted (flat looking) and then when it approached full size it finally stretched out to normal, but the transition is not what the OP is talking about.

I'm still looking for the best way to do this.. probably scale? If I find out I will post it here.
B
97
S
32
G
15
Posts: 1,198
Reputation: 16,178

Next

Return to How do I....?

Who is online

Users browsing this forum: lukewasthefish, Nicolas951, tarek2 and 6 guests