GitLab system status is available here and here

Commit bd64db67 authored by wbtate's avatar wbtate
Browse files

Finally working

parent 59a9c85c
......@@ -12,7 +12,8 @@
</style>
</head>
<body>
<script src =“./lib/phaser.js”></script>
<script src ="./lib/phaser.js"></script>
<script src ="src/prefabs/Rocket.js"></script>
<script src ="./src/scenes/Menu.js"></script>
<script src ="./src/scenes/Play.js"></script>
<script src = "./src/main.js"></script>
......
const { Phaser } = require("../../lib/phaser");
// Rocket prefab
class Rocket extends Phaser.GameObjects.Sprite {
constructor(scene, x, y, texture, frame) {
super(scene, x, y, texture, frame);
// add object to existing scene
scene.add.existing(this);
this.isFiring=false;
this.moveSpeed=2;
}
update(){
if(!this.isFiring){
if(keyLEFT.isDown && this.x>=borderUISize+this.width){
this.x-=this.moveSpeed;
} else if(keyRIGHT.isDown && this.x <=game.config.width-borderUISize-this.width){
this.x+=this.moveSpeed;
}
}
if(Phaser.Input.Keyboard.JustDown(keyF)){
this.isFiring=true;
}
if(this.isFiring&&this.y>=borderUISize*3+borderPadding){
this.y-=this.moveSpeed;
}
if(this.y<=borderUISize*3+borderPadding){
this.isFiring=false;
this.y=game.config.height-borderUISize-borderPadding;
}
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment