Skip to content

Commit ef48223

Browse files
committed
fix manual control
1 parent 27ede23 commit ef48223

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

pufferlib/ocean/boss_fight/boss_fight.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,29 @@ void c_step(BossFight *env) {
163163
env->terminals[0] = 0;
164164

165165
int action = env->actions[0];
166+
if (IsKeyDown(KEY_LEFT_SHIFT)) {
167+
if (IsKeyDown(KEY_W))
168+
action = 1;
169+
else if (IsKeyDown(KEY_S))
170+
action = 2;
171+
else if (IsKeyDown(KEY_A))
172+
action = 3;
173+
else if (IsKeyDown(KEY_D))
174+
action = 4;
175+
else if (IsKeyDown(KEY_SPACE))
176+
action = 5;
177+
else if (IsKeyDown(KEY_J))
178+
action = 6;
179+
else
180+
action = 0;
181+
}
166182
float dx = 0;
167183
float dy = 0;
168184

169185
if (action == 1) {
170-
dy = PLAYER_SPEED_PER_TICK;
171-
} else if (action == 2) {
172186
dy = -PLAYER_SPEED_PER_TICK;
187+
} else if (action == 2) {
188+
dy = PLAYER_SPEED_PER_TICK;
173189
} else if (action == 3) {
174190
dx = -PLAYER_SPEED_PER_TICK;
175191
} else if (action == 4) {

0 commit comments

Comments
 (0)