Commit b6454e67 by Sanya

Добавила деревев, мусора, говорение жабки. Поменяла спрайт ключа

parent a9007751
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -8,6 +8,7 @@ Game({ ...@@ -8,6 +8,7 @@ Game({
Key, Key,
NPC, NPC,
Tree, Tree,
Tree2,
Trash Trash
}, },
loaded: function() { loaded: function() {
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
<script src="object/NPC.js"></script> <script src="object/NPC.js"></script>
<script src="object/Zone.js"></script> <script src="object/Zone.js"></script>
<script src="object/Tree.js"></script> <script src="object/Tree.js"></script>
<script src="object/Tree2.js"></script>
<script src="object/Trash.js"></script> <script src="object/Trash.js"></script>
<script src="js/main.js"></script> <script src="js/main.js"></script>
......
...@@ -19,6 +19,6 @@ class Key extends GameObject { ...@@ -19,6 +19,6 @@ class Key extends GameObject {
} }
draw(){ draw(){
this.render(); this.render();
this.debug(); //this.debug();
} }
} }
\ No newline at end of file
...@@ -3,10 +3,12 @@ class NPC extends GameObject { ...@@ -3,10 +3,12 @@ class NPC extends GameObject {
if(this.collide(Player)){ if(this.collide(Player)){
if(!this.saying){ if(!this.saying){
if(this.sentance < this.Dialog.length){ if(this.sentance < this.Dialog.length){
if(this.sentance<2 || this.getItem('Player').tinCans>=8){
this.say( this.Dialog[ this.sentance ] ); this.say( this.Dialog[ this.sentance ] );
this.sentance++; this.sentance++;
} }
} }
}
}else{ }else{
...@@ -52,6 +54,12 @@ class NPC extends GameObject { ...@@ -52,6 +54,12 @@ class NPC extends GameObject {
passage.visible = false; passage.visible = false;
} }
}, 2 ); }, 2 );
},
growTrees: function(){
[
...this.getAll('Tree', {}),
...this.getAll('Tree2', {})
].forEach(tree=>tree.show());
} }
} }
} }
......
...@@ -9,6 +9,12 @@ class Trash extends GameObject { ...@@ -9,6 +9,12 @@ class Trash extends GameObject {
console.log('Tin cans = ', this.getItem( Player ).tinCans ) console.log('Tin cans = ', this.getItem( Player ).tinCans )
this.visible = false; this.visible = false;
// var trees = [
// ...this.getAll('Tree', {}),
// ...this.getAll('Tree2', {})
// ];
// trees[this.getItem( Player ).tinCans].show();
} }
} }
} }
\ No newline at end of file
class Tree extends GameObject { class Tree extends GameObject {
init(){ init(){
this.visible = false;
this.extendSprite(); this.extendSprite();
} }
show(){
this.opacity = 0;
this.visible = true;
this.animate( 'showTree', ( progress )=>{
this.opacity = progress;
}, 1+Math.random()*2 );
}
} }
\ No newline at end of file
class Tree2 extends GameObject {
init(){
this.visible = false;
this.extendSprite();
}
show(){
this.opacity = 0;
this.visible = true;
this.animate( 'showTree', ( progress )=>{
this.opacity = progress;
}, 1+Math.random()*2 );
}
}
\ No newline at end of file
Markdown is supported
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