Skip to content

Commit

Permalink
[opponents-hand] minor quality changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tryferos committed Dec 15, 2024
1 parent a9cef37 commit ce52bdb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions resources/js/Game/Board/OpponentsPiece/OpponentPiece.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const geometry = new THREE.BoxGeometry(0.5,0.5,0.5);
export const OpponentPiece = memo(
({block_positions,destination,opponent}: Props) => {

const INITIAL_POSITION = new THREE.Vector3(0, 2, -5);
const ORIGIN_POSITION = new THREE.Vector3(0, 2, -5);

const blockSize = useGameDimensions(state => state.blockSize);
const addBoardPiece = useBoardState(state => state.addBoardPiece);
Expand Down Expand Up @@ -58,7 +58,7 @@ export const OpponentPiece = memo(
gsap.to(ref.current.position, {
z: destinationPosition.z,
x: destinationPosition.x,
duration: calculateDuration(INITIAL_POSITION),
duration: calculateDuration(ORIGIN_POSITION),
onComplete: onComplete.current,
});
}
Expand All @@ -67,7 +67,7 @@ export const OpponentPiece = memo(

return (
<>
<group ref={ref} position={INITIAL_POSITION}>
<group ref={ref} position={ORIGIN_POSITION}>
{
block_positions.map((position, index) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Game/Board/OpponentsPiece/OpponentsHand.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const OpponentsHand = () => {
const randomX = Math.round((((Math.random() - 0.5) * 10)) / blockSize) * blockSize;
const randomY = Math.round((((Math.random() - 0.5) * 10)) / blockSize) * blockSize;
const opponentMovePayload: OpponentMovePayload = {
block_positions: PiecePositions[Math.floor(Math.random() * 20) as PieceCode],
block_positions: PiecePositions[occupations.length as PieceCode],
destination: {x: randomX, y: randomY},
opponent: 'green',
}
Expand Down
2 changes: 1 addition & 1 deletion resources/js/types/piece.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export type GameState = {
}

export type OpponentMovePayload = {
block_positions: Vector2[];
block_positions: Vector2[]
destination: Vector2;
opponent: PlayerIdentifier;
}
Expand Down

0 comments on commit ce52bdb

Please sign in to comment.