Skip to content

Commit e979c2b

Browse files
committed
reimplemented the laser as an Ability
1 parent 54b3d2d commit e979c2b

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

scenes/Dash.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,20 @@ class GameSceneDash extends GameScene
1515
this.player.x = this.shortSide/2;
1616
this.player.y = this.longSide - this.normalSpeedSpot;
1717
this.uimgr=new GUIManager();
18+
/*
1819
const bt = new UIButton(new Rectangle(0,this.longSide-100,70,70));
1920
console.log(this.longSide);
2021
bt.click = ()=>{
2122
this.player.doSkill();
2223
};
24+
//*/
25+
const lazor = new Ability(this.player);
26+
lazor.maxcharge=4;
27+
lazor.chargeused=4;
28+
lazor.base_recharge=1;
29+
lazor.apply=()=>this.player.doSkill();
30+
this.player.abilities.push(lazor);
31+
const bt = new AbilitySlot(new Rectangle(0,this.longSide-100,70,70),lazor);
2332
this.uimgr.components.push(bt);
2433
}
2534
addObject(obj)
@@ -55,7 +64,7 @@ class GameSceneDash extends GameScene
5564
console.log("Dash keydown");
5665
if(e.key==" ")
5766
{
58-
this.player.doSkill();
67+
this.player.abilities[0].use();
5968
}
6069
}
6170
drawBg(ctx)

0 commit comments

Comments
 (0)