Skip to content

Commit

Permalink
Merge branch 'pr/1512' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Laské committed Feb 1, 2024
2 parents 95f3427 + 3d3c200 commit fa24135
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Style for Planet Info in Planet Activity is Hard to See #1448
- Misaligned button in Speak activity #1504
- Added pause functionality to Blockrain activity #1501
- Fraction Bounce Activity, trick to cheat the score #1511

## [1.7.0] - 2023-03-28
### Added
Expand Down
28 changes: 27 additions & 1 deletion activities/FractionBounce.activity/js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ let app = new Vue({
onSlope: true,
SugarL10n: null,

isFirstPauseClick: true,
frameInterval: 20,
launchDelay: 1000,
height: 100,
Expand Down Expand Up @@ -110,6 +111,10 @@ let app = new Vue({
} else {
return this.l10n.stringHelpBounceToPosition + ' ' + this.answer + "/" + this.parts + ' ' + this.l10n.stringHelpOfTheWay;
}
},

isPauseAvailable: function () {
return !this.onSlope || this.isFirstPauseClick;
}
},

Expand All @@ -130,6 +135,16 @@ let app = new Vue({
this.SugarL10n = this.$refs.SugarL10n;
},

watch: {
bounceCount: function (newVal) {
if (newVal === 0) {
this.isFirstPauseClick = true;
this.changeGameState();
this.isFirstPauseClick = true;
}
}
},

methods: {

initialized: function () {
Expand Down Expand Up @@ -227,7 +242,12 @@ let app = new Vue({
},

changeGameState: function () {
this.paused = !this.paused;
if (this.isPauseAvailable) {
this.paused = !this.paused;
} else {
return;
}

if (!this.paused) {
this.launch();
if(this.count==30){
Expand All @@ -236,6 +256,11 @@ let app = new Vue({
Score.innerHTML = " ";
}
}

if (this.isFirstPauseClick) {
this.isFirstPauseClick = false;
}

document.getElementById('slopeCanvas').removeEventListener('click', this.startGame);
},

Expand All @@ -248,6 +273,7 @@ let app = new Vue({
if (this.bounceCount == 0) {
this.log = {};
this.correctAnswers = 0;
this.isFirstPauseClick = true;
}

this.vy = -1 * Math.sqrt(window.innerHeight) / 3.90;
Expand Down

0 comments on commit fa24135

Please sign in to comment.