File tree 3 files changed +7
-7
lines changed
3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 110
110
"github_user" : "idom-team" ,
111
111
"github_repo" : "idom" ,
112
112
"github_version" : "main" ,
113
- "doc_path" : "docs" ,
113
+ "doc_path" : "docs/source " ,
114
114
}
115
115
116
116
# Add any paths that contain custom static files (such as style sheets) here,
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ Try typing in the text box and pressing 'Enter' 📋
33
33
The Game Snake
34
34
--------------
35
35
36
- Click to start playing and use the arrow keys to move 🎮
36
+ Click to start playing and use WASD to move 🎮
37
37
38
38
Slow internet may cause inconsistent frame pacing 😅
39
39
Original file line number Diff line number Diff line change @@ -34,16 +34,16 @@ def GameView():
34
34
35
35
36
36
class Direction (enum .Enum ):
37
- ArrowUp = (0 , - 1 )
38
- ArrowLeft = (- 1 , 0 )
39
- ArrowDown = (0 , 1 )
40
- ArrowRight = (1 , 0 )
37
+ w = (0 , - 1 )
38
+ a = (- 1 , 0 )
39
+ s = (0 , 1 )
40
+ d = (1 , 0 )
41
41
42
42
43
43
@idom .element
44
44
def GameLoop (grid_size , block_scale , set_game_state ):
45
45
# we `use_ref` here to capture the latest direction press without any delay
46
- direction = idom .hooks .use_ref (Direction .ArrowRight .value )
46
+ direction = idom .hooks .use_ref (Direction .d .value )
47
47
48
48
snake , set_snake = idom .hooks .use_state ([(grid_size // 2 - 1 , grid_size // 2 - 1 )])
49
49
food , set_food = use_snake_food (grid_size , snake )
You can’t perform that action at this time.
0 commit comments