Skip to content

Instantly share code, notes, and snippets.

@sdsykes
Last active September 17, 2015 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdsykes/0c441d4cd854e197c8ce to your computer and use it in GitHub Desktop.
Save sdsykes/0c441d4cd854e197c8ce to your computer and use it in GitHub Desktop.
Scripts to move each direction for TotalSpaces2
require 'totalspaces2'
current = TotalSpaces2.current_space
spaces = TotalSpaces2.number_of_spaces
columns = TotalSpaces2.grid_columns
new_space = current + columns
if new_space <= spaces
TotalSpaces2.move_to_space(new_space)
end
require 'totalspaces2'
wrap = true # set to false if you don't want wrap
current = TotalSpaces2.current_space
spaces = TotalSpaces2.number_of_spaces
columns = TotalSpaces2.grid_columns
new_space = current - 1
if new_space > 0
if wrap || current % columns != 1
TotalSpaces2.move_to_space(new_space)
end
end
require 'totalspaces2'
wrap = true # set to false if you don't want wrap
current = TotalSpaces2.current_space
spaces = TotalSpaces2.number_of_spaces
columns = TotalSpaces2.grid_columns
new_space = current + 1
if new_space <= spaces
if wrap || new_space % columns != 1
TotalSpaces2.move_to_space(new_space)
end
end
require 'totalspaces2'
current = TotalSpaces2.current_space
spaces = TotalSpaces2.number_of_spaces
columns = TotalSpaces2.grid_columns
new_space = current - columns
if new_space > 0
TotalSpaces2.move_to_space(new_space)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment