MaxBittker / sandspiel

Creative cellular automata browser game
https://sandspiel.club
MIT License
2.97k stars 199 forks source link

Small suggestion: Key controls for sandspiel #248

Open EdHerrera123 opened 1 year ago

EdHerrera123 commented 1 year ago

ii

Update:

Selecting elements

labbo-lab commented 1 year ago

heres a script for this that you can paste into chrome's console

document.addEventListener('keydown', function(event) {
  if(event.key === '1') {
    document.querySelector("#ui > .sizes > button:nth-child(1)").click();
  }
});

document.addEventListener('keydown', function(event) {
  if(event.key === '2') {
    document.querySelector("#ui > .sizes > button:nth-child(2)").click();
  }
});

document.addEventListener('keydown', function(event) {
  if(event.key === '3') {
    document.querySelector("#ui > .sizes > button:nth-child(3)").click();
  }
});

document.addEventListener('keydown', function(event) {
  if(event.key === '4') {
    document.querySelector("#ui > .sizes > button:nth-child(4)").click();
  }
});

document.addEventListener('keydown', function(event) {
  if(event.key === '5') {
    document.querySelector("#ui > .sizes > button:nth-child(5)").click();
  }
});
EdHerrera123 commented 1 year ago

thx

labbo-lab commented 1 year ago

thx

https://pastebin.com/xtL5TW55 heres an updated script that checks to see if a menu is open before doing the action

EdHerrera123 commented 1 year ago

Was thinking about key shortcuts for selecting elements and have two alt ideas:

labbo-lab commented 1 year ago

B sounds a lot more controllable, although A would be quicker if gotten used to, I might try to make a script to test these out when I get a chance

On Thu, Jan 5, 2023 at 3:59 PM EdHerrera123 @.***> wrote:

Was thinking about key shortcuts for selecting elements and have two alt ideas:

  • A: Mouse Scroll: Select elements that is at behind/front of the selected elements. If scrolling while not selecting elements (Wind to Rocket), Selects wind. When selected element back to wind or next to rocket will make a loop.
  • B: Wasd/Arrow keys: Select elements that is next to selected element by pressing right arrow or D, etc...

— Reply to this email directly, view it on GitHub https://github.com/MaxBittker/sandspiel/issues/248#issuecomment-1372832298, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO4YSA5I62XYRFF2AH7WOFDWQ475RANCNFSM6AAAAAATLXDDXI . You are receiving this because you commented.Message ID: @.***>