Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peki's new pull request #218

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ee3bf40
Add files via upload
akipeki May 2, 2023
e8e9f33
Update README.md
akipeki May 2, 2023
d488e15
Update README.md
akipeki May 2, 2023
5b088a4
Update README.md
akipeki May 2, 2023
8e6dd64
Update Gamepage.styled.js
akipeki May 2, 2023
14630b4
Loader fixed
akipeki May 3, 2023
b9d90c6
fixing the restart and loader
akipeki May 3, 2023
6a2566e
changes to min time
akipeki May 3, 2023
dbc3f60
loader min time changed
akipeki May 3, 2023
21fdf4e
loader
akipeki May 3, 2023
e7c4bc2
changes to oldeer version
akipeki May 3, 2023
482b946
changing back to function version
akipeki May 3, 2023
a91497b
still fixing that loader
akipeki May 4, 2023
e8bfb17
fixing the loader
akipeki May 5, 2023
e258aa9
still fixing the loader and added lot of commenting
akipeki May 5, 2023
fe2e0e4
added 1.6 seconds delay AFTER the loading is done
akipeki May 5, 2023
a31fb6a
added an apploader
akipeki May 5, 2023
3696f75
increased excxtra time in loader to 2.2 seconds
akipeki May 5, 2023
e617e4c
delay increased to 3.2 seconds in loader
akipeki May 5, 2023
99982ed
increasing loading time to 4 second
akipeki May 5, 2023
7324c1c
Update CoordsImageDisplay.js
akipeki May 7, 2023
e6ae5ec
Update Gamepage.js
akipeki May 7, 2023
aef2dc2
Update Loader.js
akipeki May 7, 2023
2747c6d
Update App.js
akipeki May 7, 2023
e5a875a
Update labyrinth.js
akipeki May 7, 2023
47cc54b
Update Loader.js Removed background image to make it work
akipeki May 7, 2023
4add30e
removed backggorund image from the loader to make it work
akipeki May 8, 2023
58311ae
changes
akipeki May 8, 2023
8bceee3
loader fixed
akipeki May 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 41 additions & 7 deletions code/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,47 @@
# Project Labyrinth
Project Labyrinth

Replace this readme with your own information about your project.
This week was pair programming. I worked with Andreas, and we made a Labyrinth with Redux. We did different styling to get the full benefit from the learning experience. The story was not so fantastic for me, so I created a wow effect by making these images. I'm happy with them and how odd the vibes they are giving.

Start by briefly describing the assignment in a sentence or two. Keep it short and to the point.
The problem

## The problem
We have talked A LOT with Andreas to make everything more understandable for each other. And at least my polite Swedish friend has told me that even he has learned a lot by doing this. ;-)

Describe how you approached to problem, and what tools and techniques you used to solve it. How did you plan? What technologies did you use? If you had more time, what would be next?
I feel tired but happy, and all this crosslinking between React files makes more sense now.

## View it live
Despite the project, we have also discussed what ideal work would be for us, etc. –Good week.

Every project should be deployed somewhere. Be sure to include the link to the deployed project so that the viewer can click around and see what it's all about.
View it live

https://road-labyrinth.netlify.app/

Description about the logic behind these files:

React application built using Redux for state management. The game consists of several components and is centered around navigating a labyrinth. Let's go through the important parts of the code, focusing on the flow of information and the interactions between components.

App.js: This is the entry point of your application. It sets up the Redux store, combining the reducers, and provides the store to the rest of the application using the Provider component. It also renders the Firstscreen component.

Firstscreen.js: This component decides whether to show the Startpage or the Gamepage based on whether the user has entered a name or not. It uses the userName value from the Redux store to make this decision.

Startpage.js: This component displays a form where the user can enter their name and start the game. When the form is submitted, it dispatches the setUserName and startGame actions to update the Redux store with the entered username and initiate the game.

Gamepage.js: This component is responsible for the main game logic. It gets the game's current state (description, moves, loading, name, history, and coordinates) from the Redux store. When the Loader component signals that the content is loaded, it shows the game's content, such as the description, moves, and buttons to navigate the labyrinth. It also handles restarting the game and moving to the next step.

Loader.js: This component is responsible for loading the background images and showing a "Loading.." text while the images are being loaded. It receives an onContentLoaded callback as a prop, which it calls when the content (image) has been loaded. The Loader component uses the

CoordsImageDisplay component to handle the actual image display and loading process.

CoordsImageDisplay.js: This component displays the background image based on the current coordinates of the labyrinth. It uses the onImageLoad and onContentLoaded callbacks to signal when the image has been loaded. It achieves this by having a hidden img element (the HiddenImage component) with an onLoad event handler that calls the provided callbacks.

The flow of information and interactions between the components can be summarized as follows:

App.js initializes the Redux store and renders the Firstscreen component.
Firstscreen decides whether to show the Startpage or the Gamepage.

If the Startpage is shown, the user enters their name and starts the game, which updates the Redux store and triggers a switch to the Gamepage.

The Gamepage handles the game logic, and uses the Loader component to load the background images.
The Loader component uses the CoordsImageDisplay component to handle the actual image display and loading process.

When the background image is loaded, the CoordsImageDisplay component calls the onImageLoad and onContentLoaded callbacks, which signal the Loader and Gamepage components that the content has been loaded.

The Loader component is working in conjunction with the CoordsImageDisplay component to load the images and show the "Loading.." text. It sets the state variables, such as imageLoaded and displayLoadingText, based on the loading status of the images. The Loader component also manages the event listeners for game restarts and handles the minimum display time for the loading text.
2 changes: 1 addition & 1 deletion code/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"compilerOptions": {
"baseUrl": "./src"
}
}
}
Loading