Sliding Interface MKIII (CMS)

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 23:29, 14 August 2022 by AFRLme (talk | contribs)
Name Type By
Sliding Interface MKIII Definition AFRLme

This script allows you to slide interfaces in/out on mouse over/out, via mouse wheel, via key input, or via an interface button. Visionaire Studio 5+ is required to run this script.


Version One (tables)

This version uses Lua tables/arrays for storing the positional, easing, & duration data for each interface you want to slide out. This version is easier to use overall as you don't need to manually specify all of the data each time into the function.

Instructions

1a. Add this script into the script section of the Visionaire Studio editor & set as a defintion type script...
local tInt = {

["int_example"] = { In = {x = 390, y = 710}, Out = {x = 390, y = 530}, duration = 1000, eIn = easeQuintOut, eOut = easeBounceOut }

}

function slideInt(int, dir)
  
  if dir and (Interfaces[int].Offset.x == tInt[int].In.x and Interfaces[int].Offset.y == tInt[int].In.y) then -- slide out
    Interfaces[int]:to(tInt[int].duration, { Offset = {x = tInt[int].Out.x, y = tInt[int].Out.y} }, tInt[int].eOut)
  elseif not dir and (Interfaces[int].Offset.x == tInt[int].Out.x and Interfaces[int].Offset.y == tInt[int].Out.y) then -- slide in
    Interfaces[int]:to(tInt[int].duration, { Offset = {x = tInt[int].In.x, y = tInt[int].In.y} }, tInt[int].eIn)
  end
  
end

2a. You need to edit the script above & insert the names of any interfaces you want to be able to slide in & out. You will also need to define the default position of the interfaces [In] & the target position of the interfaces [Out]. Don't forget to include the duration it should take the interface to slide in or out, or the easing you want to use.


Quick note: Visionaire Studio supports most of the easing options listed on this page here, however in Visionaire Studio easings are written like this easeQuintInOut instead of like this easeInOutQuint.


Resources

Name Description
sliding_interface_vs4.zip A working example of the script in action. Visionaire Studio 4.0.1+ required to run the included .ved file.