
QML Sokoban
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
This is a Sokoban game entirely written in QML + Javascript. Therefore Qt 4.7 or higher is required. No code must be compiled, you only have to extract the source and run "qmlviewer qmlsokoban/qml/main.qml" (note that in some Linux distributions like Ubuntu qmlviewer must be installed separately).
The purpose of the game is to move the diamonds to the green spots by letting the warehouse keeper push against the diamonds. You move the warehouse keeper using the arrow keys or by clicking/touching the screen.
I have written this game because (1) I missed KSokoban from KDE 3 and (2) I wanted to learn QML. Although the levels and the graphics are copied from KSokoban, the implementation is mine.
9 years ago
version 0.7 (2011-12-16):
- add panel to select level collections (the list of collections is hardcoded)
9 years ago
version 0.7 (2011-12-16):
- add panel to select level collections (the list of collections is hardcoded)
bigous
10 years ago
Firstly, I'd like to congratulate you. You have done a very good job until now!
I've found a little bug in the level parser. When you have the itemMan over an goal point in the map (the '+' character) you put everything on the right place but the variable numOfGoals must be increased.
The behavior is, the last treasure block is not deleted when you recreate the level or go to another one.
Fix: Put ++numOfGoals; in the case '+'... (line 107 of game.js)
Very nice job!
Report
glad
10 years ago
Report
sac
10 years ago
It still complains that there is no such variable as runtime.orientation.
Also, the "Press a key.." text doesn't fit in the screen in Portrait (first and last letters).
By the way, the buttons on the bottom seem to mess up sometimes. They will stop working and if I click them too fast I seem to get a weird result that looks like two maps in one.
Report
glad
10 years ago
Report
sac
10 years ago
It is definitely not included in the default QMLViewer 'wrapper' for QML files in Qt-Creator.
Although, by adding QtMobility and a few lines of code I was able to replicate the 'runtime' variable. This is all outside of your QML project.
It should work fine then.
Report
sac
10 years ago
I just tested this game out on my phone.
In portrait mode everything appears fine but the map is small because screen is narrow.
If I rotate in to landscape mode, I can only see the top of the map (in bottom corner of the screen). So there is an issue with rotation.
However, if I start the game in landscape mode, everything looks BEAUTIFUL!
I have provided a picture:
http://img594.imageshack.us/img594/2563/imgp0512f.jpg
Of course my phone has no keyboard, so I can't control the man. This would be solved by using a N97 or E7. But everything else works fine.
Good work.
Thanks
Report
sac
10 years ago
before compile time in the QML viewer.
Report
glad
10 years ago
Report
sac
10 years ago
For this line:
"state: (runtime.orientation == Orientation.Landscape"
It complains 'Can't find variable: runtime'
I have compiled a SIS that locks Landscape orientation. Should work on all Symbian devices that support Qt (S60v3, S60v5 and Symbian^3). Tested on 5800 and N8.
http://www.wikiupload.com/Y5D429LRV8BPIVH
Report
glad
10 years ago
Report
hippydave
9 years ago
many thanks!
Report
sac
10 years ago
That works fine.
The rotating still has an issue. It doesn't animate and the text and map doesn't fit in to the screen (360 pixels wide).
I think it's best to just lockLandscape in the QML Viewer as the screen is quite narrow. That works fine.
By the way, I made a little modification to the start screen.
id: startInputHandler
I changed the Item to a MouseArea and then, to prevent issues while playing, I set visible: screen.state != "playing" (might need to change this for levelwon too) and onClicked: Game.startNewGame()
I changed the Text to "Touch screen to start" but of course that's just for phone.
Report