Building a JavaScript Action-Puzzle Game (React JS)
JavaScript is an incredibly versatile programming language that can be used to create a wide range of applications, including action-puzzle games. In this article, we’ll discuss how to build a simple action-puzzle game using React JS, a popular JavaScript library for building user interfaces.
Getting Started
Before we can start building our action-puzzle game, we’ll need to set up a new React project. This can be done using the Create React App tool, which provides a quick and easy way to create a new React application with all the necessary dependencies already installed.
To create a new React project, open a terminal window and run the following command:
npx create-react-app action-puzzle-game
This will create a new directory called action-puzzle-game containing all the files and folders needed to start building our game. Once the project has been created, navigate to the new directory and start the development server by running the following command:
cd action-puzzle-game
npm start
Creating the Game Board
Now that our React project is set up, we can start building the game itself. The first step is to create the game board, which will be a grid of squares that the player can interact with. We can do this by creating a new component called GameBoard and rendering it within our main App component.
// GameBoard.js
import React from 'react';
function GameBoard() {
return (
);
}
export default GameBoard;
Once the GameBoard component has been created, we can render it within our App component as follows:
// App.js
import React from 'react';
import GameBoard from './GameBoard';
function App() {
return (
Thanks ❤
do you recommend me to use canvas api with react to build games
did u really made all of this with react, I can't believe 😳 as a junior react devoloper this is just insane !
These are fluid animations for just using CSS transforms. Do you think its just as good as canvas in terms of performance and lag?
How come this is not super slow? React is not the fastest library
Oh great, you're back ! Honestly I thought you quited youtube or were dead 🙁 (yeah, am little bit hardcore)
Glad you are back! Love the game, gives me Mad, Bomberman vibes. Happy coding! 🥼
Could you please make the whole series like RPG using reactjs and typescript?
I just commented on the latest video about it kindly check:
Thank you so much
So how long did this end up taking, after scope creep kicked in? 😂Awesome project. Great work!
Tom
Awesome game! Love everything about it. It's well thought out and fun. The music is an added bonus, as it makes me want to play even more – it's so addictive
Are the 45 videos teaching how to create the game, the builder or just showing the process of how you created it? I didn't understand if it would be a tutorial to create exactly this game step by step and complete
Very excited for this course! I'm relatively new to Dev. It would be great if you made a 'learn to code in react by making a game' type series. Maybe a space shooter would be fun.
Did you make your sounds? I really love the retro feel, would love to know more about your music and sounds <3
Ciabatta looks pretty tough, gonna have to take him down
Glad to see you're back! I've been trying to get into game development using React and almost thought it was not the right tool for games, this video gave me hope.
Game object approach seems really smart, do you use Zustand or similar library for game states? I'm trying to build a simple clicker game like Clicker Heroes where you click on enemies to deal damage and move to next stage etc.. But I ended up in useEffect hell that reacts to state changes with bunch of setTimeouts that messes up CSS sprite animations.
It somehow works but I don't think its scalable, would you recommend using something like requestAnimationFrame to act as a "game loop" for a simple clicker game? I'm very new to game dev concepts as a web dev and your videos helped a lot, thanks
happy to see you posting again
Wow, you're very welcome back!
Exelent
Hi! Do you plan working with Vue 3 and TypeScript?
Wish you all the best
wow!! where have you been lately! waited so long