贵人礼-中秋微信推广游戏
2016-08-27 16:42
387 查看
项目描述 中秋节推广小游戏 规定时间吃月饼游戏
需求:增加订阅数
我的工作:1. 通过CreateJS给游戏添加音效
2.关注,分享朋友圈功能
3,游戏核心逻辑判断
添加音频 通过SoundJS,
createjs.Sound.registerSound("assets/sound.mp3", "soundname");
createjs.Sound.registerSound( {src:”video/err.mp3”, id:”err”} );
createjs.Sound.registerSound( {src:”video/end.mp3”, id:”end”} );
createjs.Sound.registerSound( {src:”video/tap.mp3”, id:”tap”} );
使用时调用:
createjs.Sound.play("soundname"); createjs.Sound.play("end");
2.关注分享功能
window.shareData = {
“imgUrl”: “images/logo.jpg”,
“timeLineLink”: “http://www.misslays.sinaapp.com/“,
“tTitle”: “中秋就要到,吃月饼大赛开始了!”,
“tContent”: “快来一起吃月饼!”
};
3,游戏核心逻辑判断
function gameTapEvent(e){ if (_gameOver) { return false; } var tar = e.target; var y = e.clientY || e.targetTouches[0].clientY, x = (e.clientX || e.targetTouches[0].clientX)-body.offsetLeft, p = _gameBBList[_gameBBListIndex]; if ( y > touchArea[0] || y < touchArea[1] ) { return false; } if( (p.id==tar.id&&tar.notEmpty) || (p.cell==0&&x<blockSize) || (p.cell==1&&x>blockSize&&x<2*blockSize) || (p.cell==2&&x>2*blockSize&&x<3*blockSize) || (p.cell==3&&x>3*blockSize) ){ if( !_gameStart ){ gameStart(); } createjs.Sound.play("tap"); tar = document.getElementById(p.id); tar.className = tar.className.replace(_ttreg, ' tt$1'); _gameBBListIndex++; _gameScore ++; gameLayerMoveNextRow(); }else if( _gameStart && !tar.notEmpty ){ createjs.Sound.play("err"); gameOver(); tar.className += ' bad'; } return false; }
function gameLayerMoveNextRow(){ for(var i=0; i<GameLayer.length; i++){ var g = GameLayer[i]; g.y += blockSize; if( g.y > blockSize*(Math.floor(g.children.length/4)) ){ refreshGameLayer(g, 1, -1); }else{ g.style[transform] = 'translate3D(0,'+g.y+'px,0)'; } } }
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() { WeixinJSBridge.on('menu:share:appmessage', function(argv) { WeixinJSBridge.invoke('sendAppMessage', { "img_url": window.shareData.imgUrl, "link": window.shareData.timeLineLink, "desc": window.shareData.tContent, "title": window.shareData.tTitle }, function(res) { document.location.href = mebtnopenurl; }) }); WeixinJSBridge.on('menu:share:timeline', function(argv) { WeixinJSBridge.invoke('shareTimeline', { "img_url": window.shareData.imgUrl, "img_width": "640", "img_height": "640", "link": window.shareData.timeLineLink, "desc": window.shareData.tContent, "title": window.shareData.tTitle }, function(res) { document.location.href = mebtnopenurl; }); }); }, false);
相关文章推荐
- 贵人礼-情人节微信送玫瑰小游戏总结
- 微信加油中秋有礼 免费加油卡最后两天大放送
- 基于google Zxing实现二维码、条形码扫描,仿微信二维码扫描效果
- 自定义AlertDialog(仿微信)
- WeUI 为微信 Web 服务量身设计-h5前端框架
- 高仿微信5.2.1主界面及消息提醒
- 微信小程序
- 微信H5支付可以实现在非微信浏览器(如QQ浏览器、谷歌浏览器、Safari等)中使用微信支付的场景。
- 微信视频直播如何做收费直播(如何做付费的微信直播)图文教程
- 微信跑步机
- 纯css模仿微信switch开关按钮
- 使用ASP.NET的C#语言写后台如何将数据返回给微信小程序的JS
- 手把手教您开发JAVA微信SDK-序言
- thinkphp调用微信接口完成自定义菜单的添加和删除
- 微信开发Demo
- 微信
- 微信调试之页面缓存问题
- 微信二维码海报推广示例
- 开发微信小程序:工具准备和发布流程
- 微信数据库转子http://blog.csdn.net/qq_24531461/article/details/77624255项目在https://github.com/1998lixin/WeCh