jquery实现奔跑吧兄弟网页游戏源代码【原创

来源:https://www.sucaihuo.com/js/2920.html 2017-09-05 06:39浏览(1078) 收藏

这是一款非常好玩的jquery小游戏,虽然很简单,但确识很好玩和很有挑战性,整理分享给大家,点击屏幕开始奔跑吧兄弟
jquery实现奔跑吧兄弟网页游戏源代码
分类:游戏 > 益智 难易:入门级
查看演示 下载资源 下载积分: 70 积分

html5带音乐播放的js奔跑吧兄弟小游戏代码

function MusicObject(url,flag){
	this.mobj=new Audio();
	this.mobj.src=url;
	this.enabled=true;
	if(flag){
		this.mobj.loop=flag;
		this.mobj.addEventListener("ended",function(){
			this.currentTime=0;
			this.play();
		});
	}
	
}
MusicObject.prototype.setEabled=function(flag){
	this.enabled=flag;
		try{
			if(this.mobj.isplayed){
				this.mobj.pause();
			}
		
		}catch(e){
			console.error("音乐停止播放错误!");
		}
}
MusicObject.prototype.play=function(){
		try{
			this.mobj.play();
		
		}catch(e){
			console.error("音乐播放错误!");
		}
}
MusicObject.prototype.pause=function(){
		try{
			this.mobj.pause();
		}catch(e){
			console.error("音乐停止播放错误!");
		}
}
MusicObject.prototype.replay=function(){
		try{
			if(this.mobj.isplayed){
				this.mobj.currentTime=0;
			}
			this.mobj.play();
		}catch(e){
			console.error("音乐重复播放错误!");
			this.mobj.play();
		}
}
标签: 游戏奔跑
声明:本文为原创文章,如需转载,请注明来源sucaihuo.com并保留原文链接:https://www.sucaihuo.com/js/2920.html
评论0
头像

系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791

1 2