File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,13 @@ int main() {
2222
2323 // Main game loop
2424 int frame = 0 ;
25+ int action = -1 ;
2526 while (!WindowShouldClose ()) {
2627 c_render (& env );
2728 frame ++ ;
28-
29- int action = -1 ;
29+
3030 if (IsKeyDown (KEY_LEFT_SHIFT )) {
31+ action = -1 ;
3132 if (IsKeyDown (KEY_W ) || IsKeyDown (KEY_UP )) action = UP ;
3233 else if (IsKeyDown (KEY_S ) || IsKeyDown (KEY_DOWN )) action = DOWN ;
3334 else if (IsKeyDown (KEY_A ) || IsKeyDown (KEY_LEFT )) action = LEFT ;
@@ -43,14 +44,15 @@ int main() {
4344 forward_linearlstm (net , net -> obs , env .actions );
4445 }
4546
46- if (action >= 0 ) {
47+ if (action > 0 ) {
4748 c_step (& env );
4849 }
4950
50- if (IsKeyDown (KEY_LEFT_SHIFT ) && action >= 0 ) {
51- WaitTime (0.01 );
51+ if (IsKeyDown (KEY_LEFT_SHIFT ) && action > 0 ) {
52+ WaitTime (0.05 );
5253 }
5354
55+
5456 }
5557
5658 free_linearlstm (net );
You can’t perform that action at this time.
0 commit comments