<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>狼的传说</title>
<script src="../phaser.min.js"></script>
<script src="./js/plus.js"></script>
<script src="./assets/sprites/wolf.js"></script>
<script src="./assets/sprites/restore.js"></script>
<script src="./assets/sprites/rattan.js"></script>
<script src="./assets/sprites/ridding.js"></script>
<style>
body{
margin: 0%;
padding: 0%;
}
</style>
</head>
<body>
</body>
<script>
// import './js/libs/weapp-adapter'
// import Phaser from './js/libs/phaser-wx.js'
// import Demon from './assets/demon.js'
//技能图标 1.防御0 2.战斧0 3.风暴3% 4.滚石10% 5.藤曼5% 6.冰柱5% 7.飞跃10% 8.三叶草20% 9.钢叉15%
onload = function(){
var gameScore = 0;
var game = new Phaser.Game({
width: 710,
height: 580,
renderer: Phaser.CANVAS,
// canvas: canvas,
});
var gameState = function (game) {
this.create = function () {
this.game.physics.startSystem(Phaser.Physics.ARCADE);//开启物理引擎
this.bg = this.add.image(0,0,'background');//背景
this.grass = this.add.image(0,0,'battlefield');//草坪
this.underRails = this.add.sprite(0,0,'under-rails');//底座
this.game.physics.arcade.enable(this.underRails);
this.rails = this.add.image(0,0,'rails');//滑道
this.rails.y = 81;
this.underRails.y = 81;
this.underRails.width = this.rails.width;
this.underRails.height = this.rails.height;
this.sky = this.add.image(0,0,'sky');//天空
this.earth = this.add.image(0,0,'earth');//土地
this.wagon = this.add.image(0,this.underRails.y -10,'wagon');//滑板 第一道-10 第二道60 第三道130 第四道200 第五道270 第六道340 累加70
this.wires = this.add.sprite(this.underRails.width,this.underRails.y,'wires');//荆棘
this.wires.active = false;//需要技能图标1 防御 激活
this.wires.hp = 20;
this.wires.hp_ = this.wires.hp;
this.wires.dt = 0;
this.wires.alpha = 0;
this.game.physics.arcade.enable(this.wires);
this.wolf = this.add.image(7,this.wagon.y - 40,'wolf');//狼
this.wolf.y_ = this.wolf.y;
this.wolf.animations.add('walk', [4, 5, 6, 7], 3, true);
this.wolf.animations.add('attack', [0,1, 2, 3], 5, true);
this.attack = false;
this.wolf.animations.play('walk');
this.wolf.bulletSpeed = 60;//quicken 加快 更活跃
this.axe = this.add.image(0,0,'axe');//武器axe hp==1
this.axe.alpha = 0;
this.fork = this.add.image(0,0,'fork');//武器fork hp==2
this.fork.alpha = 0;
this.weapon = this.add.weapon(50,'axe');//武器 //优化时 更换为group weapon.bullets 子弹行为
if (this.weapon.bullets.children[0].key=='axe') {//武器耐性
this.weapon.hp = 1;
}
if (this.weapon.bullets.children[0].key=='fork') {//值
this.weapon.hp = 3;
}
this.weapon.bulletKillType = Phaser.Weapon.KILL_WORLD_BOUNDS;
this.weapon.fireAngle = Phaser.ANGLE_RIGHT;
this.weapon.bulletAngleOffset = 90;
this.weapon.bulletSpeed = 400;
this.weapon.fireRate = 60;
this.weapon.trackSprite(this.wolf, this.wolf.width, this.wolf.height/1.3);
this.pigs = this.add.group();//猪
this.pigs.enableBody = true;
this.skills = this.add.group();//技能图标
for (var i = 0; i < 9; i++) {
let skillIcon = this.skills.create(0,0,'skills');
skillIcon.x = 13 + i * skillIcon.width + i * 13;
skillIcon.y = this.bg.height - 13 - skillIcon.height;
skillIcon.frame = i;
skillIcon.inputEnabled = true;
// if (i>0) {skillIcon.alpha = 0;}
}
this.storm = this.add.group();//技能图标3 风暴 将敌人推出边界
this.storm.enableBody = true;
this.stone = this.add.group();//技能图标4 滚石 碾过敌人
this.stone.enableBody = true;
this.rattan = this.add.group();//技能图标5 藤曼 迟缓诅咒
this.rattan.enableBody = true;
this.ice = this.add.group();//技能图标6 冰冻 冻住敌人
this.ice.enableBody = true;
this.skills.getChildAt(0).events.onInputDown.add(function(){//技能图标1 道具 荆棘防御
this.wires.active = true;
game.add.tween(this.wires).to( { alpha: 1 }, 3000, "Linear", true).onComplete.add(function(){
this.wires.act = true;
},this);
this.skillMask(this.skills.getChildAt(0),100000000);
}, this);
this.skills.getChildAt(1).events.onInputDown.add(function(){//技能图标2 武器 战斧
this.attack = true;
this.wolf.animations.play('attack');
this.weaponReplace(this.weapon,this.axe,this.fork,1);
this.skillMask(this.skills.getChildAt(1),1000000);
}, this);
this.skills.getChildAt(2).events.onInputDown.add(function(){//技能图标3 技能 风暴
if (this.energyEnabled == false) {
return false;
}
this.energy.width -= (this.energy.sum * 3/100);
if (this.storm.length>0) {//风暴出界 风消云散
for (var i = 0; i < this.storm.length; i++) {
if (this.storm.getChildAt(i).x>this.game.world.width) {
this.storm.getChildAt(i).destroy();
}
}
}
for (var i = 0; i < 6; i++) {//六个道路
this.storm_ = this.storm.create(0,0,'storm');
this.storm_.scale.set(2.5);
this.storm_.x = this.underRails.width;
this.storm_.y = 70 + i * 70;
this.storm_.animations.add('storm',[0,1,2,3],5,true);
this.storm_.animations.play('storm');
this.storm_.body.velocity.x = 300;
}
this.skillMask(this.skills.getChildAt(2),3000);//3s
}, this);
this.skills.getChildAt(3).events.onInputDown.add(function(){//技能图标4 技能 滚石
this.iceTo = false;
if (this.energyEnabled == false) {
return false;
}
this.energy.width -= (this.energy.sum * 1/10);
if (this.stone.length>0) {//滚石出界
for (var i = 0; i < this.stone.length; i++) {
if (this.stone.getChildAt(i).x>this.game.world.width) {
this.stone.getChildAt(i).destroy();
}
}
}
for (var i = 0; i < 6; i++) {//六个道路
this.stone_ = this.stone.create(0,0,'stone');
this.stone_.scale.set(2);
this.stone_.x = this.underRails.width + this.wires.width - this.stone_.width;
this.stone_.y = i * 70;
this.stone_.animations.add('stone',[0,1,2,3,4,5,6,7,8,9],5,true);
this.stone_.animations.play('stone');
this.stone_.body.velocity.x = 500;
}
this.skillMask(this.skills.getChildAt(3),10000);//10s
}, this);
this.skills.getChildAt(4).events.onInputDown.add(function(){//技能图标5 道具 藤曼 迟缓诅咒
if (this.energyEnabled == false) {
return false;
}
this.energy.width -= (this.energy.sum * 1/20);
for (let i = 0; i < this.pigs.length; i++) {//生成敌人数目的藤曼
this.rattan_ = this.rattan.create(0,0,'rattan');
this.rattan_.scale.set(.5);
this.rattan_.animations.add('rattan');
this.rattan_.x = this.pigs.getChildAt(i).x - this.pigs.getChildAt(i).width/2;
this.rattan_.y = this.pigs.getChildAt(i).y;
this.pigs.getChildAt(i).body.velocity.x = -30;
var that = this;
没有合适的资源?快使用搜索试试~ 我知道了~
一个基于Phaser的各种小游戏集合+源代码+文档说明
共2000个文件
png:809个
js:487个
mp3:150个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 155 浏览量
2024-03-01
19:36:47
上传
评论
收藏 132.3MB ZIP 举报
温馨提示
游戏列表 learn - 官方案例 fruit - 切水果 plane - 打飞机 flappybird - Flappybird weiduan - 高仿微信聊天界面 2048 - 2048 candytbc - 怪物要糖果(中间版) candy - 怪物要糖果 stardog - 星星狗 run - 跑男 blockdown - 掉方块 breaklovers - 拆散小情侣 puzzle - 拼图 hitball - 弹珠儿 quitsmoke - 别抽烟 circlepath - 往上走 downfloor - 下楼 rpgdemo - RPG小游戏 kupao - 酷跑 kite - 风筝 nail - 别碰钉子 fubag - 接福袋 bike - 骑单车 fctank - FC坦克大战 tank - 坦克大战 getcockscomb - 接鸡冠 marathon - 社区跑 collectstar - 接星星 donottapwhitetile - 别踩白块儿 dragandmatch - 拖一拖 fifty - 看谁能坚持50秒 -----等等
资源推荐
资源详情
资源评论
收起资源包目录
一个基于Phaser的各种小游戏集合+源代码+文档说明 (2000个子文件)
robot.ase 3KB
player-warp.ase 3KB
block-dust.ase 3KB
drill.ase 2KB
battery.ase 2KB
dust.ase 2KB
dust.ase 2KB
spring.ase 2KB
particle.ase 2KB
Scene1.canvas 77KB
swiper.min.css 19KB
booster-api.css 16KB
style.css 4KB
app.css 2KB
style.css 1KB
main.css 280B
main.css 280B
main.css 280B
main.css 280B
main.css 280B
sjm.min.css 244B
fonts.css 189B
fonts.css 2B
fonts.css 2B
fonts.css 2B
fonts.css 2B
fonts.css 2B
Aws.exe 635KB
flappyfont.fnt 8KB
flappyfont.fnt 8KB
flappyfont.fnt 8KB
font.fnt 3KB
2024280444.gif 11KB
preloader.gif 11KB
preloader.gif 11KB
preloader.gif 11KB
preloader.gif 11KB
preloader.gif 11KB
loading.gif 11KB
preloader.gif 11KB
preloader.gif 11KB
preloader.gif 11KB
preloader.gif 11KB
preloader.gif 11KB
preloader.gif 11KB
preloader.gif 11KB
preloader.gif 11KB
preloader.gif 11KB
22-2.gif 4KB
119-2.gif 4KB
TitleBg0.gif 4KB
110-2.gif 4KB
.gitignore 81B
index.htm 1KB
index.html 37KB
index.html 24KB
index.html 20KB
index.html 19KB
index.html 17KB
index.html 14KB
index.html 13KB
index.html 12KB
editor.html 10KB
index.html 8KB
index.html 7KB
share.html 6KB
help.html 6KB
index.html 5KB
index.html 4KB
index.html 4KB
index.html 4KB
index.html 3KB
index.html 3KB
index.html 3KB
index.html 3KB
exam8.html 3KB
index.html 2KB
exam7.html 2KB
index.html 2KB
index.html 2KB
index.html 2KB
exam6.html 2KB
index.html 2KB
index.html 2KB
index.html 2KB
index.html 2KB
index.html 2KB
index.html 2KB
index.html 2KB
index.html 2KB
index.html 2KB
index.html 1KB
exam5.html 1KB
index.html 1KB
index.html 1KB
exam4.html 1KB
index.html 1KB
index.html 1KB
index.html 1KB
index.html 1KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
mldxxxxll5
- 粉丝: 3285
- 资源: 762
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功