Hello! friends welcome to my blog, today I will show you how to make an infinite loop type game with sketchware. I hope you have heard about this game. This is a puzzle type game on which you have to light the bulbs by making correct connection. So, let's start.

Friends first of all we have to understand the concept behind this game, how this game works and how it declares the win. So, the main concept of this game is based on the rotation of a button or image. We will make a puzzle and solution of that puzzle. For your better understanding we will make an easy level with only nine buttons.

Paper work.

Step.1- First of all make a solution for the puzzle on a paper, means first you design the level. For example: see the image below.


Step.2- Then split the images as you want. After splitting the images, note down the angle of each image by rotating which it makes the solution. For example: suppose the current angle of a button is 0° and to make the solution of the puzzle we have to rotate it by 90°. [NOTE: angles should be counted in clockwise direction.

Paper work end.

Step.3- Open sketchware and add a horizontal column, then add three horizontal columns in which the images will be added in the form of buttons. Now add the image of the buttons with their corresponding's. Remind it that first you have to make the problem, which will be shown to the player. And solution will be coded only.

Step.4- Now we have done on look, now we have to code. So first we have to rotate each button on each click and to do this we have to code like this (in the figure below).

When button(n) clicked (n denotes number of button) button(n) get rotation by x+90 (here x denotes the previous rotation) you have to add number variable for each button. Means there will be 9 different variable for 9 buttons.

And also you have to set a period after which it becomes 0°. I hope you are understanding, if not don't worry try to understand with this image.


Step.5- Add another variable which stores solution angle of each button. Add 9 variable for 9 different buttons. With this variable we will identify that, whether the angle is right or not. If it is right then variable will be equal to 1 or if it is not right then variable will be 0. By doing this step our task becomes more easy. Try to understand with this image.

We have done all on looks and functioning now we have to make code for winning. As we had made solution of the level and also noted down in the paper with doing step.2 so our task becomes easy. Now we only have to make a code which contain answer (solution angle) of all buttons. See the image below to understand it in proper way. After making the code, copy it in each button function so it will run with each click.

Well, I've shown you how can you create puzzle games by using this rotation logic. If you have still any question, please ask. Now its your turn to show your creativity.

Thanks for coming. This site is for tech lovers, if you love to play with tech then don't forget to bookmark this site.

1 Comments

Post a Comment

Previous Post Next Post