Skip to content

Commit

Permalink
Updated Comments and Player Colours
Browse files Browse the repository at this point in the history
  • Loading branch information
2557606 committed May 20, 2024
1 parent 4e5a04c commit 9d18ef8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions client/src/Components/BoardInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default function BoardInfo( props ) {
}
}

// Function to handle the logic of changing a player
const handlePlayerChange = (newPlayerNum) => {
const state = { ...props.gameState, playerTurn: newPlayerNum };
props.setGameState(state);
Expand Down
5 changes: 3 additions & 2 deletions client/src/Components/Moves.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import dropdown from '../Icons/dropdown.png'
import { colours } from '../Models/PlayerColours'

export default function Moves( props ) {

// useState hook to manage the state of which player's moves to show
const [showPlayerMoves, setShowPlayerMoves] = useState(-1);


// Function to handle clicks on player headers, setting the state to show/hide the moves list
const handleClick = (playerNum) => {
setShowPlayerMoves(playerNum-1);
}
Expand Down
15 changes: 13 additions & 2 deletions client/src/Models/Tile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class Tile {
constructor(tile_number, row, col, type, animal_territory = null, playing_piece = null) {
// Constructor to initialize properties of a tile object
this._tile_number = tile_number;
this._row = row;
this._col = col;
Expand All @@ -8,42 +9,52 @@ class Tile {
this._playing_piece = playing_piece;
}

// Method to generate the filename for the tile's image
get_tile_image() {
return `${this._tile_number}_${this._row}_${this._col}.png`;
}


// Setter method for setting the playing piece on the tile
set playing_piece(piece) {
this._playing_piece = piece;
}


// Setter method for setting the animal territory associated with the tile
set animal_territory(territory) {
this._animal_territory = territory;
}

// Getter method to access the tile number
get tile_number() {
return this._tile_number;
}

// Getter method to access the row position of the tile
get row() {
return this._row;
}

// Getter method to access the column position of the tile
get col() {
return this._col;
}

// Getter method to access the type of the tile
get type() {
return this._type;
}

// Getter method to access the playing piece on the tile
get playing_piece() {
return this._playing_piece;
}

// Getter method to access the animal territory associated with the tile
get animal_territory() {
return this._animal_territory;
}

// Public method to get the tile image filename
get tile_image() {
return this.get_tile_image();
}
Expand Down
3 changes: 3 additions & 0 deletions client/src/Pages/Tutorial.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ import '../Styles/Tutorial.css'
import { useNavigate } from 'react-router-dom';
import PlantButton from '../Components/PlantButton';

// Functional component for the Tutorial page
export default function Tutorial() {
const navigate = useNavigate();

// Return the JSX elements for the Tutorial component
return (
<div className='tutorial-root'>
<div className="tutorial-image-container">
Expand Down

0 comments on commit 9d18ef8

Please sign in to comment.