Stick your brain

    This post participates in the competition “ Smart Phones for Smart Posts

    imageWhat do we usually do while sitting on a bus / subway / queue? That's right - bullshit. Usually it’s either music or silly games on a mobile phone like “Try to find the same ball as me, cattle!”.

    It’s clear with music, it’s the same everywhere, but something can be changed with toys ... For example, do something simple, but with a hint of intelligence and usefulness. The essence of the idea is simple, like two pennies - we take the word, interfere with the letters in it and offer the player to guess the initial word by random porridge. We attach a beautiful design and smooth transitions to it, fasten the levels and ratings - voila, the game is ready!

    There is an idea, which means it opens Qt Creator -> New Project -> Qt Quick. Two evenings of continuous coding for two hours, an evening for localization into three languages ​​and filling in the database of words, compilation for Symbian and a week of testing both independently and on the mobile phones of your girlfriend, friends / classmates and other mammals. Plus two days of waiting for the design of the application and its icons from a fond friend.

    Oh yes ... There were also about three days to build and test for Android on one of its screen resolutions. Some kind of standard there, but significantly lower than the Nokiev ... 320x480 versus 360x640. Yes, they are - the complexity of porting software to Qt. Already 20 minutes sometimes it is necessary to spend.

    Let's see what happened?

    Everything begins, as usual, with the menu:
    imageimageimage

    As you might guess, the application has a rating system, which means user profiles. In addition, the list of languages ​​below is not anyhow why - it is a full-fledged localization of the entire application on the fly, without restarting it ... By the way, there are some schools with QML in this regard, but I quickly corrected them using this cheat sheet. Ai-ay-ay Nokia, ay-ay-ay =) Correct the cant ...

    Next, we can start a new game, create or select an existing profile, select a level and start playing our own:
    imageimageimageimage

    Funny buttons become at an angle to the random radius while pressing with a finger, otherwise, I think everything is intuitively simple ... After the start of the game in two parts - information and control. The current letters are written in the information, from which it is necessary to make a word, then the relationship is guessed / missed / total and, finally, the number of unsuccessful attempts to guess the word.

    Then follows an input field for a word that looks strangely similar to a button, an “OK” button that checks the entered word, a hint, due to which points will be taken away in the final rating, skipping a word and returning to the main menu.

    image
    Actually from what remains to be shown - perhaps the screen of the end of the level. And it looks simple, like everything else.

    Hmm, that's right - guessed and missed words, used hints and overall result.

    Separately, I want to note all the simplicity and conciseness of QML itself, without going into the details of porting and developing everything else. This is really a funky tool for both rapid prototyping and application development. Actually, a dozen progarmarmists, designers, testers and other ideological inspirers and spin gnaws can quickly establish a small office for riveting mobile toys with weekly iterations, when each programmer makes his own project. And in a couple of months, flood the market, albeit not with professional, but high-quality toys and small applications. Suppressing the questions: yes, I wrote a little on Flash and generally a lot of things, but I can say for sure - there is no more convenient tool at the moment. Only the size of the applications and the level of ports for Android and iOS are upsetting (Yes, yes, the toy is fine and will behave on it if you assemble it with the current Qt 4.8 port on uiKit). So ... What is it, I already scribbled nonsense to streamline the picture? It seems yes =))

    Now let's briefly go over the software part.
    image

    The application contains quite a bit of files - 14 QML-ek, three scripts and a few pictures. There is nothing special there ... Although, as an example, I want to share an example of the implementation of sequential animation in transition:
    ...
            Transition {
                from: "Menu"
                to: "Rules"
                SequentialAnimation {
                    PropertyAnimation {
                        target: mainMenu
                        properties: "opacity"
                        duration: 250
                    }
                    PropertyAnimation {
                        target: rules
                        properties: "opacity"
                        duration: 250
                    }
                }
            }
    ...
    


    This is necessary to implement such an effect of switching between windows when one application goes blank, and the second starts to appear only after the first has completely died out.

    Further ... The algorithm for storing levels is also simple, these are multidimensional JS arrays with the words:
    ...
    levels["Russian"] = []
    levels["Russian"][1] = new Object();
    levels["Russian"][1].tryCount = 3 //попыток угадать одно слово
    levels["Russian"][1].levelWordsCount = 10 //количество слов которые необходимо попробовать угадать чтобы пройти уровень
    //levels["Russian"][1].skippedWordsCount = 10 //выборка слов для уровня из массива
    levels["Russian"][1].hintCount = 5 //сколько раз за уровень можно пользоваться подсказкой
    levels["Russian"][1].words = ["бег","боб","бог","бой","бок","бур","вой","газ"]
    ...
    

    Well and similarly for other levels and languages. There is almost nothing more interesting in the code, everything is trivial ... Except for the function of word splitting ... But you can also see it in the source.

    By the way, I have not forgotten yet - an addition to the Qt bugs. If you use a construct
    FontLoader { id: applicationFont; source: "styles/default/fonts/Ceremonious Two.ttf" }
    

    That everything will be n ... bad. At least on s60, I firstly changed the font of the entire system, and secondly, after exiting the application, the mobile phone rebooted. Therefore, I did not use the exotic stylized font in the application as I originally wanted. So one more pebble towards the developers ... Although, damn it ... They still remain the coolest and most professional dudes writing code about which I know.

    And the last ... How to play this miracle? The whole project lies on a page in Google Code. There you can see the list of files to download. Unfortunately, when trying to commit there, Google sends me far, so the source code is only archived on the download page. I will try to fix it a bit later.

    Here’s something like ... Thank you all, I hope it’s not boring ... And if I have such a desire to write tomorrow (well, you don’t stammer ...), I’ll tell you about another small but very interesting project ...

    Also popular now: