Differential D7231 Diff 18803 src/activities/penalty/0001-penalty-kick-Randomized-ball-position.patch
Changeset View
Changeset View
Standalone View
Standalone View
src/activities/penalty/0001-penalty-kick-Randomized-ball-position.patch
- This file was added.
1 | From e657000524b9321b1ec4d8ea98b21258d70c9fc6 Mon Sep 17 00:00:00 2001 | ||||
---|---|---|---|---|---|
2 | From: Rohit Das <rohit.das950@gmail.com> | ||||
3 | Date: Thu, 10 Aug 2017 00:27:04 +0530 | ||||
4 | Subject: [PATCH 1/3] penalty kick: Randomized ball position | ||||
5 | | ||||
6 | Changed the position of the ball after kicking. Used | ||||
7 | random() to generate random values to get x and y | ||||
8 | values. The ball now gets positioned at a random | ||||
9 | position after every kick inside the goal. | ||||
10 | | ||||
11 | Signed-off-by: Rohit Das <rohit.das950@gmail.com> | ||||
12 | --- | ||||
13 | src/activities/penalty/Penalty.qml | 8 ++++---- | ||||
14 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||||
15 | | ||||
16 | diff --git a/src/activities/penalty/Penalty.qml b/src/activities/penalty/Penalty.qml | ||||
17 | index 8535564..b9ab4de 100644 | ||||
18 | --- a/src/activities/penalty/Penalty.qml | ||||
19 | +++ b/src/activities/penalty/Penalty.qml | ||||
20 | @@ -283,8 +283,8 @@ ActivityBase { | ||||
21 | PropertyChanges { | ||||
22 | target: ball; | ||||
23 | sourceSize.width: 75 * ApplicationInfo.ratio | ||||
24 | - x: background.width * 0.8; | ||||
25 | - y: background.height * 0.3 | ||||
26 | + x: background.width * (Math.random() * (0.8 - 0.6) + 0.6); | ||||
27 | + y: background.height * (Math.random() * (0.4 - 0.1) + 0.1) | ||||
28 | } | ||||
29 | }, | ||||
30 | State { | ||||
31 | @@ -292,8 +292,8 @@ ActivityBase { | ||||
32 | PropertyChanges { | ||||
33 | target: ball; | ||||
34 | sourceSize.width: 75 * ApplicationInfo.ratio | ||||
35 | - x: background.width * 0.2; | ||||
36 | - y: background.height * 0.3 | ||||
37 | + x: background.width * (Math.random() * (0.4 - 0.1) + 0.1); | ||||
38 | + y: background.height * (Math.random() * (0.4 - 0.1) + 0.1) | ||||
39 | } | ||||
40 | }, | ||||
41 | State { | ||||
42 | -- | ||||
43 | 2.7.4 | ||||
44 | |