Zoom in effect

Post about the Flash World Construction Kit and the Alchemy port of Box2D.
jinisner
Posts: 146
Joined: Tue Apr 17, 2012 12:08 am

Zoom in effect

Postby jinisner » Wed Nov 20, 2013 6:45 am

Hi guys,

I was just playing this game - http://www.myfootballgames.co.uk/game/4 ... occer.html , now in this game as the ball gets near the post there is a zoom in effect which is very unique , how can we achieve such effect , currently i adjust the scale properties to zoom in but its not very smooth , also how can i pan across my world , is there any inbuilt class that i can use to pan the world from one end to other end ....

Thanks in advance ...

Regards
Jin

IstvanOrosi
Posts: 172
Joined: Thu Mar 01, 2012 9:31 am

Re: Zoom in effect

Postby IstvanOrosi » Thu Nov 21, 2013 3:52 pm

Currently, in World.as, you can set the focus property to have the screen/camera move with that object. Other than that, as far I can tell, you have to write your own code.

The zoom in effect seems fairly simple because it just zooms in to a certain point and then out to the original. To achieve that type of zoom, you can move the world (i.e. the object that is or extends wck.world). You can override the updateScroll function in your "world" object. You can use the same approach to pan from one end of the world to the other.

What do you mean by "currently i adjust the scale properties to zoom in but its not very smooth"? The zoom in/out rate seems constant in the soccer game you mentioned so you just have to set the start and end points and the rate of scale change.

jinisner
Posts: 146
Joined: Tue Apr 17, 2012 12:08 am

Re: Zoom in effect

Postby jinisner » Fri Nov 22, 2013 2:37 am

@Istvan - thanks a lot once again for you time and reply, this is what i do right now , i wait for some event to happen and then i scale the world by a value positive or negative for a certain period of time ...

level1World.scaleX += .01;
level1World.scaleY += .01;

for zoom in and a negative value for zoom out ....

But just as the event happens , the scale effect is not in a slow way but happens immediately , how do i give the effect that it is zooming in or out slowly, do i need to increase the time for which the zoom happens or reduce or increase the value of scaling or do both

Also what value will i need to pan across the world ....

Thanks in advance ...

Regards
Jin

IstvanOrosi
Posts: 172
Joined: Thu Mar 01, 2012 9:31 am

Re: Zoom in effect

Postby IstvanOrosi » Fri Dec 27, 2013 4:59 pm

Sorry, was going to reply but kinda forgot... :D

If you haven't solved the problem, my first check would be:
Are you applying all the scale change on one frame or little by little each frame? e.g. Flash has the "On Enter Frame" function. WCK has a similar function (StepEvent.STEP ~ world_stepEventHandler).

jinisner
Posts: 146
Joined: Tue Apr 17, 2012 12:08 am

Re: Zoom in effect

Postby jinisner » Mon Dec 30, 2013 9:50 pm

Hi Istvan ,

Thanks again and a very happy new year ...

Regards


Return to “WCK”



Who is online

Users browsing this forum: No registered users and 3 guests