actionscript 3 - Flash AS3 | Creation of a Camera / Moving Viewport / Zoom -


i looking extend on question asked earlier here:

flash as3 | pan / zoom mouse input

the basis solution working, looking improve process more achieve higher quality result.

what asking here if me find way make 'viewport' (what displayed on screen) tied or follows object around. pointing scope of sniper rifle example, see image through hud, , see different parts of image hud moves around.

alongside this, there way me implement zoom feature? guess enlarge actual displayed image itself, on great!

thanks once again guys!

i think 1 way achieve effect you're looking take content want have on screen , put inside movieclip. then, when have name movieclip, can adjust it's positioned it's focused around 1 object, this:

holder.x = screenwidth/2 - holder.object.x; holder.y = screenheight/2 - holder.object.y; 

this little bit of math takes object's position relative holder movieclip , adjusts whole movieclip moved, putting spot in center.

once have there, can zoom adjusting scalex , scaley of holder movieclip, 1 default value both 200% zoom 2 , on. however, movieclip zoom anchor point, not center of screen, may have move movieclip anytime want scale it.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -