2017년 7월 30일 일요일

Sliding Puzzle App help


I am making an "Sliding Puzzle" app. But I don't know how to code it. I made 9 buttons and put image on them. (pic Below)

Can any one tell me some basics, or give me link where I can learn the required stuff. I found one Tutorial online but it was too hard to understand.
I will be very thankful. Please.

--
Is this the tutorial you saw     

Slide Nine – a sliding block puzzle game tutorial for App Inventor ?  This tutorial is an Advanced tutorial.  A sliding block puzzle is complex and requires knowledge of some the advanced features of App Inventor 2.  The complete Project aia is included in the tutorial.  The code should be adaptable to your images.  Looking at you screen post, you already have some of the many parts of the Project.  In fact, you should be able to exchange the images of 'Magic' for those in your cartoon if you resize your 9 images to the same size as the blocks that compose Magic's image and the puzzle should work Faraz.

We want you to have fun with App Inventor so here are some resources to help you learn to use the AI2 tools  A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here:  http://www.appinventor.org/bookFiles  

How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/howDoYou/eventHandling  .

To code the sliding blocks puzzle, you need to learn the AI2 blocks and coding techniques.   The tutorial does not describe the basic things required to successfully code and adapt this Project to your needs.

Ask specific questions here and someone will try to help.  After taking the programming course mentioned above and reading the book about programming, you should be able to adapt Slide 9 to your needs.  Just try.  I do not think there is any simpler code available anywhere for a puzzle like this using AI2  Perhaps someone else might provide a different reference.if one exists.

--
@SteveJG,  I don't see any links for the tutorials or .aia files at your Wordpress site cited above, just the descriptions.
I am using Chrome, with no blockers.

Did something happen to your site?

--
The pdf's on App Inventor for Fun are copyrighted.  Posting and distributing those pdf's on other than the App Inventor for Fun web pages and/or distributing / sharing them with others is prohibited.  All the materials on that web site are copyrighted material (this includes the aia files) and the material is NOT freeware.  The distribution of these files other than from the App Inventor for Fun pages is strictly prohibited.  Posting  and redistributing any of those files on this forum or other Web pages is a violation of the law.  Please honor my copyright.

--
Sorry about that I didn't know.

--
Here's an alternate shuffle technique for sliding puzzles that should always give you a solvable puzzle.
If all pieces of the sliding puzzle are the same rectangular shape and size, then you only get a choice of up to 4 possible choices for each move: up, down, left, right (U,D,L,R).  

So a random shuffle could be done by starting from the end position and applying some large number of randomly chosen moves (U,D,L,R).  How many moves?  Twice the number of pieces should probably be plenty.

Note that some moves may end up with no net difference in block positions, for example asking for four right moves in a row in a 3 by 3 puzzle.  When you code to process a move request, check if it's legal and ignore it if it's illegal.

How do we know for sure that the end result of the random sequence f moves will be solvable?
Just apply the reverse of the sequence of moves that created it from the starting position.

--
PUZZLE2.aia



--


댓글 1개: