Better Follow Camera and Movement

  • #1, by xemencoMonday, 16. June 2014, 20:32 6 years ago
    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

    Newbie

    6 Posts


  • #2, by afrlmeMonday, 16. June 2014, 21:05 6 years ago
    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
    1
    2

    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
    1
    2
    3

    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]") )
    1
    2
    3
    4
    5
    6
    7
    8

    Quick note: in example 2 the characters name is case sensitive, as are all table names.

    Imperator

    6842 Posts

  • #3, by SDMonoMonday, 16. June 2014, 22:01 6 years ago
    Cool I was looking the something like that. (Distance from the edge of the screen!!!) Thanks AFRLme!!!

    Forum Fan

    148 Posts

  • #4, by xemencoTuesday, 17. June 2014, 00:18 6 years ago
    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
    1
    2
    3
    4
    5


    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]") )
    1
    2
    3
    4
    5
    6
    7
    8


    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

    Newbie

    6 Posts

  • #5, by afrlmeTuesday, 17. June 2014, 01:25 6 years ago
    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.

    Imperator

    6842 Posts

  • #6, by xemencoTuesday, 17. June 2014, 09:57 6 years ago
    well thanks again ARFLme smile
    I will test it soon.

    Newbie

    6 Posts

Write post