This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials
Create point and click adventures without coding. The free version covers up to 25 scenes per project. For more scenes or to earn money with your game, you need a license.
See the Indie Bundle Try it for freec_res=game:getPoint(VGameWindowResolution)
sc_current={x=0,y=0}
sc_cur=0
function dist(x,y)
return math.sqrt(math.pow(x.x-y.x,2)+math.pow(x.y-y.y,2))
end
function center_char()
local c_position=game:getLink(VGameCurrentCharacter):getPoint(VCharacterPosition)
local c_scroll=game:getPoint(VGameScrollPosition)
local scene_changed=sc_cur~=game:getLink(VGameCurrentScene):getId().id
c_position.x=c_position.x
c_position.y=c_position.y
c_position.x=c_position.x-(c_res.x/2)
c_position.y=c_position.y-(c_res.y/1.5)
c_position.x = math.max(0,c_position.x)
c_position.y = math.max(0,c_position.y)
if dist(c_position,sc_current)>300 or scene_changed then
sc_current=c_position
local delay=3000
if(scene_changed)then
delay=0
end
startObjectTween(game, VGameScrollPosition, c_scroll, c_position, delay, easeQuadInOut)
sc_cur=game:getLink(VGameCurrentScene):getId().id
end
end
registerEventHandler("mainLoop", "center_char")