DE EN FR ES IT CZ
Back Back to top

Better Follow Camera and Movement

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  • #1, by xemenco 13 years ago Quote
    Hi there smile

    I have 2 question about camera movement :

    1- is it possible to have parallax scrolling ?
    http://www.eyeflow.com/wp-content/uploads/2014/05/Parallax-scroll-example-2.png

    2-in long-horizontal scenes, camera follows the character when it reaches near the edges , but I want it to follow as soon as character moves to left and right.
    btw is there any way for camera to move better , smoother and feel better.

    Thank you very much smile
  • New to Visionaire Studio?

    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 free
  • #2, by afrlme 13 years ago Quote
    There may be some new camera options in the work for an upcoming version of Visionaire Studio. I have no confirmation on if, or when.

    Yes it is possible to have parallax scrolling. Create a scene object, add an image/animation & then go to the Effects tab & adjust the Scroll factor X & Scroll factor Y values to make the objects scroll slower or faster than the background.

    You can adjust the scroll speed in the main game tab or via lua script...
    game:setValue(VGameScrollSpeed, 300) -- scroll by 300 pixels a second
    

    It is also possible to adjust the distance (in pixels) from the edge of the screen (vertical & horizontal) before scene scroll will be triggered.
    game:setValue(VGameHorizontalScrollDistance, 50) -- scroll on X axis when character is 50 pixels or less from scene edge
    game:setValue(VGameVerticalScrollDistance, 50) -- scroll on Y axis when character is 50 pixels or less from scene edge
    

    Final tip: it is also possible to center scene scroll to current character or a specified character...
    game:setValue(VGameScrollCenterCharacter, true) -- center scene based on character position
    
    -- example 1: current character
    game:setValue( VGameScrollCharacter, getObject("Game.GameCurrentCharacter") )
    
    -- example 2: a specified character
    game:setValue( VGameScrollCharacter, getObject("Characters[protagonist]") )
    

    Quick note: in example 2 the characters name is case sensitive, as are all table names.
  • #3, by SDMono 13 years ago Quote
    Cool I was looking the something like that. (Distance from the edge of the screen!!!) Thanks AFRLme!!!
  • #4, by xemenco 13 years ago Quote
    Thank you alot AFRLme !!!

    Parallax scrolling is done smile

    About adjusting the distance from the edge of the screen, I could use these codes :
    game:setValue(VGameScrollSpeed, 300) -- scroll by 300 pixels a second
    
    game:setValue(VGameHorizontalScrollDistance, 50) -- scroll on X axis when character is 50 pixels or less from scene edge
    game:setValue(VGameVerticalScrollDistance, 50) -- scroll on Y axis when character is 50 pixels or less from scene edge
    


    And it sort of solved my problem but still need work on numbers to adjust well.

    I couldn't use these, :
    game:setValue(VGameScrollCenterCharacter, true) -- center scene based on character position
    
    -- example 1: current character
    game:setValue( VGameScrollCharacter, getObject("Game.GameCurrentCharacter") )
    
    -- example 2: a specified character
    game:setValue( VGameScrollCharacter, getObject("Characters[protagonist]") )
    


    I placed them at my scene , in Actions tab : Execution Type : " at the beginning of the scene " and then "Execute a script" in Action part then paste the codes in there.

    Did I miss something ?

    btw, thanks again for your great support wink
  • #5, by afrlme 13 years ago Quote
    hmm the second block you have to use example 1 or example 2.

    example 1 is the currently active character (character the player is controlling) & example 2 is a specified character of your choice... you would replace "protagonist" with the name of one of your characters.

    I've not used/tested GameScrollCenterCharacter or GameScrollCharacter in a script before, so they were a guess on my part based on the data structure. It said I had to link to a character, hence why I used getObject.

    P.S: just to clarify.. you do not need to include any of the -- jhsjhkh, as they are just comments.
  • #6, by xemenco 13 years ago Quote
    well thanks again ARFLme smile
    I will test it soon.