Skip to content

Commit

Permalink
feat!: Swap WASD for HJKL
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaamkiya committed Jan 6, 2025
1 parent 2f66d93 commit d11e8a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions internal/app/dodger/dodger.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg.String() {
case "ctrl+c", "q":
return m, tea.Quit
case "left", "a":
case "left", "h":
m.player.x--
if m.player.x < 0 {
m.player.x = m.size.x - 1
}
case "right", "d":
case "right", "l":
m.player.x++
if m.player.x >= m.size.x {
m.player.x = 0
Expand Down Expand Up @@ -98,7 +98,7 @@ func (m model) View() string {
s += "\n"
}

s += "wasd or arrows to move"
s += "hjkl or arrows to move"

return s
}
Expand Down
10 changes: 5 additions & 5 deletions internal/app/twenty48/twenty48.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg.String() {
case "ctrl+c", "q":
return m, tea.Quit
case "left", "a":
case "left", "h":
m.MergeTilesLeft()
/* NOTE: There is an edge case here. This code requires
* that every move the user makes must free up a tile.
Expand All @@ -72,7 +72,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if !m.AddTile() {
return m, tea.Quit
}
case "down", "s":
case "down", "j":
/* Instead of creating a seperate method to merge down,
* we rotate the grid. This is because the
* m.MergeTilesLeft() method is *much* more complex
Expand All @@ -85,14 +85,14 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if !m.AddTile() {
return m, tea.Quit
}
case "up", "w":
case "up", "k":
m.Rotate90(true)
m.MergeTilesLeft()
m.Rotate90(false)
if !m.AddTile() {
return m, tea.Quit
}
case "right", "d":
case "right", "l":
m.Rotate90(false)
m.Rotate90(false)
m.MergeTilesLeft()
Expand Down Expand Up @@ -150,7 +150,7 @@ func (m model) View() string {
s += "\n"
}

s += "\nwasd or arrows to move"
s += "\nhjkl or arrows to move"

return s
}
Expand Down

0 comments on commit d11e8a2

Please sign in to comment.