Skip to content

Conversation

@bytewife
Copy link
Member

Fixes #20

@bytewife bytewife requested a review from kkysen August 19, 2022 21:16
@bytewife bytewife mentioned this pull request Aug 20, 2022
src/GameLoop.tsx Outdated
!playerPhysics.isInRBounds(cell.r) ||
board[cell.r][cell.c].char !== EMPTY
) {
overlappingI = i;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a better way to do this than filter.

});
if (keyCode === 37) {
// Left
if ("ArrowLeft" == code) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much clearer than before!

console.log(this.adjustedCells);
const mid = Math.floor(this.layout.length / 2);
return cells.map(({ r, c, char, uid }) => {
return cells.map(({ r, c, uid, char }) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why reverse these? Keep them in the same order everywhere and where you construct them. Matters for performance a lot.

let isPlayerMovementEnabled = false;
let didInstantDrop = false;

let leaveGroundPenalty = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No global mutable state.

let didInstantDrop = false;

let leaveGroundPenalty = 0;
const leaveGroundRate = 250;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should be fine if it's a constant.

@@ -1,5 +1,4 @@
import * as React from "react";
import { useState } from "react";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit this change directly to main; it's separate.

root.render(
<StrictMode>
<GameLoop/>,
<GameLoop />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit this change directly to main; it's separate.


function updatePlayerPos(
{ keyCode, repeat }: { keyCode: number; repeat: boolean },
{ code }: { code: string },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this function called?

bytewife and others added 2 commits August 20, 2022 17:59
Co-authored-by: Khyber Sen <[email protected]>
Co-authored-by: Khyber Sen <[email protected]>
@bytewife bytewife merged commit 97ab0a1 into main Aug 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Infinite stall bug

3 participants