Hello, has anyone had any success creating a multiplayer chess board using thunkable? Or even simply a chess board? Are there any templates? Had a look and the latest topics I found say there weren’t any but wondering if this has changed since?
I think this is totatly possible, in my “mind project” i can able to do this with MySQL and an API for example:
A first screen where the players choose their colors (black and white, whatever), the choice is saved in a variable and in a database, when the player try to chose a color, send a GET to API to check if the color is able to be chosen, after this the last one chose his color, the app send to board screen, where a timer to prepare start for both. And all the “multiplayer actions” is
are regulated by a synchronized timer that automatically passes the turn to the other player if the first one has made a move.
This is just a 10 minutes thiking idea, you can do better!
You’ll have to forgive me, I am a simple man just trying to create things to experiment and learn a new skill - what is an api please?
I understand it is something that allows 2 applications to talk to each other. A google search told me this. But how exactly does it work? How much control over this other application do I have?
you should start reading up on one of the best features in thunkable - any component block - or what i started calling as “indexable buttons” (or components).
please read this tutorial to give you an idea of this process. (i guarantee you that this can build a chessboard and you can address each cell programatically!)
following the technique aboive, the steps to make a chessboard are the following;
in the design phase, create a prototype row, inside it, create a protoype button (no rounded corners), with a width about 1/9 of the width of the screen)
in the blocks section do the following at start.
- clone the prototype BUTTON 8 times , then delete the prototype button.
2, then clone the prototype ROW 8 times , then delete the prototype row.
- voila - 8x8 board! each button can be addressable by number from 1 to 64.
- you can use a loop to alternately color each button (cell)
I haven’t even tried it yet but will mark this reply as “Solution” for being such a thorough explanation. I’m confident I can have a go now thanks to that. Thankyou very much.
In this case, the API will work as a messenger for your application. You will make a request through your application, and the API will be responsible for checking the information in your database and returning to you what it found.
An API (Application Programming Interface) is a set of rules and protocols that enable different software applications to communicate with each other. APIs are used to access and exchange data between different applications, platforms, and devices. APIs make it easier for developers to integrate different functionalities and services into their applications without having to build them from scratch. APIs are commonly used for building web and mobile applications, integrating with social media platforms, and accessing data from third-party services.
These are my blocks so far for the chess board. I followed the example you showed regarding the any component blocks. It works and looks kind of successful. However, I am still hitting a few snags I can’t seem to resolve. First of all the red circle in the picture above. I have swapped the “random integer” to some kind of a counter, I want it to be from 1 to 64 but it appears I don’t know how to do it. The blocks I have put in are counting every block as number 1. I thought this code would cause it to add 1 consecutively to the number but apparently not. Is anyone able to shed light on this please?
Also, the blue circle. This has worked in that it alternates black and white from left to right. But as it is a chess board I also need this to alternate up and down. Do I need to clone different buttons for this to happen or can I still clone the one button?
you’ll need a nested loop : i from 1 to 8, j from 1 to 8 where i deteremines the initial color of the row - use remainder after dividing by 2, to determine what color to use - remainder 0, use white, remainder 1, use black - play with it.before you enter the nested loop set k to 1, this will be the index to all the buttons. simply increment k after every cell in the innermost loop. you could also compute k from i and j if you want.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.