blob: d9e72db75c43ca3e9f18a53ff1b0b306b43275af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//Import the declarative plugins
import QtQuick
//Import the javascript functions for this game
import "lib.js" as Lib
//Implementation of the Labyrinth square control.
Rectangle {
id: sq
x: 0
y: 0
width: Lib.cellDimension
height: Lib.cellDimension
color: "white"
property int val: 0
property AnimatedImage picture: img
//Dependent of its position and the labyrinth value a square can be the start, cheese, empty or a wall
AnimatedImage {
id: img
anchors.fill: parent
source: ""
}
function updateImage()
{
if (sq.val == -1)
sq.picture.source = "content/start.png";
else if (sq.val == 3)
sq.picture.source = "content/cheese.png";
else if (sq.val == 4){
sq.picture.source = "content/cheeseeating.gif";
sq.picture.playing = true;
}
else if (sq.val == 1)
sq.picture.source = "content/01.png";
else
sq.picture.source = "content/00.png";
}
}
|