Scale an object smoothly

For questions about using Classic.

Post » Wed Nov 10, 2010 9:21 am

Hi,

I'm trying to think of a way to scale an object smoothly so that it appears as if it is getting closer to the screen.

I need it to appear as if its rushing toward the player. Any ideas? Point me to the tutorial for that kinda thing?

Thanks for the help!
B
3
G
3
Posts: 13
Reputation: 1,201

Post » Wed Nov 10, 2010 3:46 pm

have you tried set z elevation to current z elevation +1 every tick?
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

Post » Wed Nov 10, 2010 6:22 pm

Another thing you can do If you want to control zoom is use TimeDelta. Right at this moment as I type, I'm working on something using it for zooming objects in and out.

The code looks like this:

Event _____________________Action
Key Up arrow is down >>>>>>>System: Set Zoom to (ZoomX + 1000 * TimeDelta, ZoomY + 1000 * TimeDelta)

Event _____________________Action
Key Down arrow is down >>>>>System: Set Zoom to (ZoomX - 5000 * TimeDelta, ZoomY - 5000 * TimeDelta)

It moves very smoothly.
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Wed Nov 10, 2010 6:44 pm

Ok, I tried zoom, but it scales the WHOLE SCREEN, I just need 1 sprite to appear to rush as the player. So unless I'm wrong about how to use it, it wont work, but ZElevation...

AWESOME!

That appears that it would work.

Can you give me a pointer on how to go about adding 1 to the variable vrs setting it to a specific number. As of right now I only know how to set to a specific setting to a specific integer. Any idea how to go about adding to it.

Thanks.

P.S. I might be posting a lot of newb questions on here in the next couple weeks, I am totally drowning over my head here but I'm determined to figure this out.
B
3
G
3
Posts: 13
Reputation: 1,201

Post » Wed Nov 10, 2010 6:53 pm

These will do by dimensions:
Sine behavior
Scale behavior

Or
The expression lerp
lerp(sprite.z,sprite.z+ target, someting*timedelta)

Oh Davo,
Wanna put a z on sine?
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Post » Wed Nov 10, 2010 7:09 pm

I totally appreciate the help but I don't see a "scale" behavior.

I've thought to use the Sine Behavior, but it seems like overkill when all I need to do is "scroll" the scale from small to large.

I figured there would be a simple line to do that.

Also, I'm afraid I dont understand where I should be using the "lerp" expression. should I be applying that to the ZElevation Event or?

Again, seriously thanks everybody. Keep it coming.
B
3
G
3
Posts: 13
Reputation: 1,201

Post » Wed Nov 10, 2010 7:12 pm

B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Wed Nov 10, 2010 7:19 pm

[quote="PixelRebirth":1a1fr201][size=150:1a1fr201]SCALE BEHAVIOR[/size:1a1fr201]

:D[/quote:1a1fr201]

PERFECT! Exactly what I need.
B
3
G
3
Posts: 13
Reputation: 1,201


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests