Giter Club home page Giter Club logo

16-project-labyrinth's Introduction

Project Labyrinth

This weeks project was to build a text-based labyrinth game in React Redux using an API. The Labyrinth API provides a description of the users current location and then presents two direction options. Based on the users choice the game data state is updated and a new description and actions are displayed. Another theme this week was thunks and how these can be used to aid with asynchronous code. This was a mob programming project between Andrea Osmar, Jamie Cook and Ylva Nilsson.

The problem

We started by exploring the API and drawing a physical map to give us an understanding of the game experience and how we wanted to present it to the user. We decided early on that we wanted to display a map with some kind of user icon that updated as the player moved throughout the game. But the first task was to create two fetch's using thunks which we used to dispatch our game data and save it in our Redux global store.

The game starts by prompting the user to enter a username before starting the game. This saves the username in our Store and triggers our first POST request with the help of useEffect, this also fetch's the first game description from the backend and the Labyrinth game begins. The second POST takes place once the user has made their first move.

Once we had the game working, we also decided to display the users previous move and location which we recorded in our store. Next we created our map by using a CSS grid, and mapped over an array of coordinates which we created in our Store. Here we use some logic to style the square coordinates if that square has been visited.

Tech

  • React
  • Redux
  • Styled Components
  • JSX
  • JavaScript

View it live

Have you got what it takes to complete: The Labyrinth

16-project-labyrinth's People

Contributors

the-j-curl avatar puj avatar faten848 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.