📜 ⬆️ ⬇️

Poke your brain

This post participates in the competition " Smart phones for smart posts "

image What do we usually do while sitting in a bus / subway / queue? That's right - garbage. Usually this is either music or stupid mobile games like “Try to find the same ball as me, brute!”.

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

There is an idea, so it opens Qt Creator -> New project -> Qt Quick. Two evenings of uninterrupted coding for two hours, evening for localization into three languages ​​and filling the base of words, compilation for Symbian and a week of testing both independently and on mobile phones of her friend, friends / classmates and other mammals. Plus two days of waiting for the design of the application and its icons from a friend who is keen on.
')
Oh yeah ... There were still about three days to build and test for Android at one of its screen resolutions. Some kind of standard there, but significantly lower than Nokievsky ... 320x480 vs. 360x640. Yes, they are - the complexity of porting software to Qt. Already 20 minutes sometimes you need to spend.

Look what happened?

It all starts, as usual, with the menu:
imageimageimage

It is easy to guess in the application there is a rating system, and therefore user profiles. In addition, the list of languages ​​from below is not for anything - this is a complete localization of the entire application on the fly, without restarting it ... By the way, with QML there are some jambs in this regard, but I quickly corrected them using this cheat sheet. Ay-yay-ya Nokia, i-yay-yay =) Correct a jamb ...

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

Funny buttons become at an angle to a random radius when you press it with your finger, otherwise, I think, and so everything is intuitively simple ... After starting the game in two parts - informational and control. The information is written in the current letters, from which you need to make a word, then the ratio is guessed / skipped / total and, finally, the number of unsuccessful attempts to guess the word.

Then follows the input field, a word that looks strangely like a button, an “Ok” button that checks the entered word, a hint, due to the use of which points in the final rating will be taken away, the word will be skipped and the main menu will be returned.

image
Actually from what remains to show - perhaps the end of the level screen. And it looks just like everything else.

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

Separately, I would like to note all the simplicity and conciseness of the QML itself, without going into the details of porting and developing everything else. This is really awesome tool for both rapid prototyping and application development. Actually, a dozen programmers, designers, testers and other ideological inspirers and spin-eats can quickly set up a small office for riveting mobile toys with weekly iterations, when each programmer makes his own project. And in a couple of months to flood the market, though not with professional, but with enough quality toys and small applications. Suppressing the questions: yes, I wrote a little bit on Flash and in general a lot on what, but I can say for sure - there is no more convenient tool at the moment. It upsets only the size of the applications and the level of ports under Android and iOS (Yes, yes, the toy is fine and it will behave on it if it is assembled with the current Qt 4.8 port on uiKit). So ... What is there, I have already set up crazy clothes to streamline the picture? It seems yes =))

Now let's take a quick look at the program part.
image

The application contains just a drop of files - 14 QML-ek, three scripts and some pictures. There is nothing special there ... Although, as an example, I want to share an example of the implementation of sequential animation in a 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 this effect of switching between windows, when one application goes out, and the second begins to appear only after the first one is completely extinguished.

Further ... The level storage algorithm 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 interesting in the code anymore, everything is trivial ... Unless another word annoying function ... But it can also be seen in the source code.

By the way, until I forgot - an addition to Qt bugs. If to use a design
 FontLoader { id: applicationFont; source: "styles/default/fonts/Ceremonious Two.ttf" } 

Then everything will be n ... bad. At least, on s60, I firstly changed the font of the entire system, and secondly - after I quit the application, the mobile reset. Therefore, I did not use in the application an exotic stylized font as I originally wanted. So one more pebble in the direction of the developers ... Although, damn ... They still remain the most cool and professional dudes who write 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 look at the list of files to download. Unfortunately, when I try to commit to Google, it sends me far away, so the source code is only an archive on the download page. I will try to fix it later.

Something like that ... Thank you all, I hope it was not boring ... And if I have such a desire to write tomorrow (well, you don’t stumble ...), I’ll tell you about one more small but very interesting project ...

Source: https://habr.com/ru/post/133403/


All Articles