{"id":144074,"student_id":10,"content":"setBackdrop('bg.jpg');\nvar food = createSprite('food.png');\nvar head = createSprite('head.png');\nvar hint = createSprite('hintt.png');\nvar gameover = createSprite('gameover.png');\nvar bodies = [];\nvar score = 0;\nvar clock = 0;\nvar isStart = false;\n\nhint.moveTo(630, 450);\nhead.moveTo(630, 450);\nfood.x = Math.floor(Math.random()*20)*60 + 30;\nfood.y = Math.floor(Math.random()*15)*60 + 30;\ngameover.hidden = true;\n\nsound.play('bgm.mp3', true);\n\nforever(loop);\n\nfunction loop () {\n print(score, 10, 10, 'white');\n \n var level = Math.floor(score/5);\n if (level \u003e 9) level = 9;\n \n clock++;\n if (clock%(10 - level) == 0 \u0026\u0026 isStart) {\n if (head.touched(food)) {\n food.x = Math.floor(Math.random()*16)*60 + 30;\n food.y = Math.floor(Math.random()*12)*60 + 30;\n var b = createSprite('body.png');\n b.x = head.x;\n b.y = head.y;\n bodies.push(b);\n score++;\n sound.play('bling.ogg');\n }\n if (bodies.length \u003e 0) {\n var b = bodies.pop();\n b.moveTo(head);\n bodies.unshift(b);\n }\n head.stepForward(60);\n if (head.touched(bodies)) {\n gameover.hidden = false;\n stop();\n }\n }\n if (key.up \u0026\u0026 head.direction != 180) {\n head.direction = 0;\n isStart = true;\n }\n if (key.right \u0026\u0026 head.direction != 270) {\n head.direction = 90;\n isStart = true;\n }\n if (key.down \u0026\u0026 head.direction != 0) {\n head.direction = 180;\n isStart = true;\n }\n if (key.left \u0026\u0026 head.direction != 90) {\n head.direction = 270;\n isStart = true;\n }\n if (isStart) {\n hint.hidden = true;\n }\n if (head.x \u003c 0) {\n head.x += 1200;\n }\n if (head.x \u003e 1200) {\n head.x -= 1200;\n }\n if (head.y \u003c 0) {\n head.y += 900;\n }\n if (head.y \u003e 900) {\n head.y -= 900;\n }\n}","created_at":"2020-04-27T12:15:47.022+08:00","updated_at":"2020-04-27T19:49:51.495+08:00","name":"貪食蛇 v2 ","language":"javascript","screenshot":{"url":"/uploads/project/screenshot/144074/3df0a7d014397de1dc76b203b137a0a1.jpg"},"parent_id":2,"plugin":"Game.set({ width: 1200, height: 900 })","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":423,"hashid":"p93s8v66","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2492951,"file_name":"bg.jpg","project_id":144074,"asset_id":209207,"created_at":"2020-04-27T15:41:03.764+08:00","updated_at":"2020-04-27T15:41:03.764+08:00"},{"id":2492790,"file_name":"bling.ogg","project_id":144074,"asset_id":172579,"created_at":"2020-04-27T12:22:28.999+08:00","updated_at":"2020-04-27T12:22:28.999+08:00"},{"id":2492953,"file_name":"hintt.png","project_id":144074,"asset_id":209209,"created_at":"2020-04-27T15:41:28.805+08:00","updated_at":"2020-04-27T15:41:39.341+08:00"},{"id":2492791,"file_name":"bgm.mp3","project_id":144074,"asset_id":172576,"created_at":"2020-04-27T12:22:30.084+08:00","updated_at":"2020-04-27T12:22:30.084+08:00"},{"id":2492792,"file_name":"head.png","project_id":144074,"asset_id":209204,"created_at":"2020-04-27T12:27:55.256+08:00","updated_at":"2020-04-27T12:27:55.256+08:00"},{"id":2492946,"file_name":"gameover.png","project_id":144074,"asset_id":209206,"created_at":"2020-04-27T15:34:08.558+08:00","updated_at":"2020-04-27T15:34:08.558+08:00"},{"id":2492788,"file_name":"body.png","project_id":144074,"asset_id":209202,"created_at":"2020-04-27T12:18:26.867+08:00","updated_at":"2020-04-27T12:18:26.867+08:00"},{"id":2492789,"file_name":"food.png","project_id":144074,"asset_id":209203,"created_at":"2020-04-27T12:18:26.868+08:00","updated_at":"2020-04-27T12:18:26.868+08:00"}]
Orange Apple Learning Platform
My Projects
View Project Page
Export
Remix
Import
Delete
Download Android APP (APK)
Screenshot
繁中
简中
English
日本語
1:1:1
1:1
Full Width
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer