Licence od 75 € Přihlásit se
DE EN FR ES IT CZ

Smooth scrolling / panning

Toto téma je několik let staré. Některé údaje se mohou týkat starší verze Visionaire Studia. Aktuální návody

  1. · 13 years ago
    When the character starts moving to edge of the scene, scenes are panning/scrolling. But how we could do that sliding smoothly. Camera start up with a speed and then slow down towards the end?
  2. Pracujete na hře?

    Bezplatná verze umožňuje až 25 scén na projekt. Pro více scén a pro prodej hry potřebujete licenci.

    Zobrazit licence Vyzkoušet zdarma
  3. · 13 years ago
    It might be possible via LUA but I am not sure. Would love to see an option for that!!! Signed!!
  4. · 13 years ago
    Yea mate, an option would be great! Lee told me that there are some tween parameters but they could only be accessed via LUA as you wrote.
  5. · 13 years ago
    You can try my test script, I'm not completely happy with the result, but it's enough for some games:
    c_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")
    
  6. · 13 years ago
    Thats cool mate, thank you so much!. I'll give a try on it. But how I gonna execute it? In what action, should I write it of execute script? I'm a very beginner level in Vs.
  7. · 13 years ago
    Go to scripts, create a script (you can name it what you want), paste it, the script should be marked as definition script, what's the default case.
  8. · 13 years ago
    Thanks SimonS... gonna try it out and get back to you! smile
  9. · 13 years ago
    I played around with the "delay" and the "if dist"... somehow it work and it looks a lot smoother but sometimes it just won't scroll even though my character is leaving the screen border and there is still a little part of the background off screen.
  10. · 13 years ago
    I was looking for this kind of script, thanks a lot SimonS ! wink
  11. · 13 years ago
    @SDMono: it's just a test script, needs a lot of tweaking for every game. Problem is, when distance is too high it won't scroll to some parts at the edge, too low and it will restart the scrolling to often, I tried it with the big scene in Whispered World, that worked nicely with these values. But I can't use magnetism to the edge of the scene because we can't get size of the background image yet...
  12. · 13 years ago
    Would there be a way of changing the scrollspeed via LUA "game:setValue(VGameScrollSpeed, 200)" and increase it while the scrolling is going on?

Toto téma je uzavřené, protože tu přes rok nikdo neodpověděl. Svůj dotaz můžete položit v novém tématu.

Nové téma

Opravdu smazat tento příspěvek?