Skip to content

Commit

Permalink
the first edition on publish.
Browse files Browse the repository at this point in the history
  • Loading branch information
BigSaltyFish committed May 5, 2019
1 parent 3f125a5 commit 48e1682
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
18 changes: 14 additions & 4 deletions miniprogram/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import Button from './display/button.js'
const openDataContext = wx.getOpenDataContext()
const sharedCanvas = openDataContext.canvas

let counter = 0

let ctx = canvas.getContext('2d')
let databus = new DataBus()
let background = databus.images.home_page
Expand Down Expand Up @@ -58,7 +60,6 @@ const zoom = (index) => {
let startbg = new Image()
startbg.src = 'images/start/bg.png'

console.log(wx.cloud.init)
wx.cloud.init({
env: 'class-release-8cfbab'
})
Expand Down Expand Up @@ -217,6 +218,7 @@ export default class Main {
this.player.changeColor(0)
} else {
let enemy = databus.enemys[0]
// console.log(`a touch occured: ${classification} for enemy ${enemy.classification}`)
if (enemy.isLiving != 1) {
if (enemy.classification == classification) {
enemy.comeout(enemy.x, enemy.y, enemy.classification)
Expand All @@ -225,12 +227,17 @@ export default class Main {
else if (databus.mode == 1) databus.score += 30
}

counter++
let piece = {
choose: names[classification - 1],
answer: names[enemy.classification - 1]
answer: names[enemy.classification - 1],
stamp: classification
}
if(enemy !== lastEnemy)
if ((enemy !== lastEnemy || enemy.classification == classification) &&
classification !== 0) {
// console.log('added')
this.gameinfo.gameData.record.push(piece)
}
lastEnemy = enemy
}

Expand Down Expand Up @@ -301,7 +308,10 @@ export default class Main {

databus.enemys.forEach((item) => {
let piece = item.update()
if (piece !== null) this.gameinfo.gameData.record.push(piece)
if (piece !== null) {
this.gameinfo.gameData.record.push(piece)
lastEnemy = null
}
if (item.isLiving == -1) {

if(databus.life==1){
Expand Down
1 change: 0 additions & 1 deletion miniprogram/js/runtime/music.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default class Music {

playBgm() {
if(databus.music) {
console.log('music')
this.playAudio.pause()
this.bgmAudio.play()
}
Expand Down
1 change: 0 additions & 1 deletion miniprogram/openDataContext/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ wx.onMessage(data => {
wx.getFriendCloudStorage({
keyList: ['score'],
success: res => {
console.log(res)
friendData = res.data
drawRankList(res.data)
},
Expand Down
2 changes: 2 additions & 0 deletions project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"projectname": "classification-master",
"miniprogramRoot": "miniprogram/",
"cloudfunctionRoot": "cloudfunction/",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,
Expand Down

0 comments on commit 48e1682

Please sign in to comment.