File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -26,12 +26,12 @@ int main() {
2626 c_render (& env );
2727 frame ++ ;
2828
29- int action = 0 ;
29+ int action = -1 ;
3030 if (IsKeyDown (KEY_LEFT_SHIFT )) {
31- if (IsKeyPressed (KEY_W ) || IsKeyPressed (KEY_UP )) action = UP ;
32- else if (IsKeyPressed (KEY_S ) || IsKeyPressed (KEY_DOWN )) action = DOWN ;
33- else if (IsKeyPressed (KEY_A ) || IsKeyPressed (KEY_LEFT )) action = LEFT ;
34- else if (IsKeyPressed (KEY_D ) || IsKeyPressed (KEY_RIGHT )) action = RIGHT ;
31+ if (IsKeyDown (KEY_W ) || IsKeyDown (KEY_UP )) action = UP ;
32+ else if (IsKeyDown (KEY_S ) || IsKeyDown (KEY_DOWN )) action = DOWN ;
33+ else if (IsKeyDown (KEY_A ) || IsKeyDown (KEY_LEFT )) action = LEFT ;
34+ else if (IsKeyDown (KEY_D ) || IsKeyDown (KEY_RIGHT )) action = RIGHT ;
3535 env .actions [0 ] = action - 1 ;
3636 } else if (frame % 10 != 0 ) {
3737 continue ;
@@ -43,9 +43,14 @@ int main() {
4343 forward_linearlstm (net , net -> obs , env .actions );
4444 }
4545
46- if (action ! = 0 ) {
46+ if (action > = 0 ) {
4747 c_step (& env );
4848 }
49+
50+ if (IsKeyDown (KEY_LEFT_SHIFT ) && action >= 0 ) {
51+ WaitTime (0.01 );
52+ }
53+
4954 }
5055
5156 free_linearlstm (net );
You can’t perform that action at this time.
0 commit comments