Zooming in in viewport
Posted: Tue Oct 28, 2014 5:55 pm
Hi, I have this problem I just can't seem to solve.
I want to show a map in a viewport. When it appears, it starts zoomed out to be entirely visible. Then, after a short delay, it should zoom in to the player's location on the map.
The problem here is that I have no idea how to do all the zooming and waiting outside of the image declaration.
I have this:
Which works *almost* fine, except that it starts the image's last line "ease 1.0 crop" from (0, 0, 0, 0) instead from what is shown at the moment.
Then there's the problem that I don't really want a cropped image, I want the full image inside the viewport for scrolling. So I was thinking of cheating by exchanging the cropped image with the full image scrolled to the right position after the zooming is done, but it feels overly complicated and I'm sure there is a better way to do this.
Also, I would be grateful if someone could explain to me how to move the variables a and b to the screen and out of the general script.
I want to show a map in a viewport. When it appears, it starts zoomed out to be entirely visible. Then, after a short delay, it should zoom in to the player's location on the map.
The problem here is that I have no idea how to do all the zooming and waiting outside of the image declaration.
I have this:
Code: Select all
init python:
mapxsize = 5000
mapysize = 4406
mapfactor = float(config.screen_height)/ mapysize
dummypos = (2100, 1700)
image mapsheet:
"map.jpg"
zoom mapfactor
pause 3.0
ease 1.0 crop (a, b, config.screen_width, config.screen_height)
screen mapscreen:
viewport id "worldmap":
draggable True
edgescroll (50, 500)
add "mapsheet" at truecenter
label start:
"Let's start!"
$ a = max(0, min(dummypos[0]-(config.screen_width/2), mapxsize-config.screen_width))
$ b = max(0, min(dummypos[1]-(config.screen_height/2), mapysize-config.screen_height))
call screen mapscreen
return
Then there's the problem that I don't really want a cropped image, I want the full image inside the viewport for scrolling. So I was thinking of cheating by exchanging the cropped image with the full image scrolled to the right position after the zooming is done, but it feels overly complicated and I'm sure there is a better way to do this.
Also, I would be grateful if someone could explain to me how to move the variables a and b to the screen and out of the general script.