Commit d80db96a by Иван Кубота

Merge branch 'master' of gitlab.quokka.pub:Zibx/projectSane

parents 62f3f3ef e90f7b86
node_modules/*
package-lock.json
\ No newline at end of file
package-lock.json
.idea/*
\ No newline at end of file
This diff is collapsed. Click to expand it.
......@@ -7,7 +7,8 @@ Game({
Player,
Key,
NPC,
Tree
Tree,
Trash
},
loaded: function() {
......
......@@ -324,7 +324,7 @@ GameObject.prototype = {
visible: true,
opacity: 1,
say: function( sentence, duration) {
duration = duration || sentence.length/8;
duration = duration || sentence.length/16;
var actions = [];
sentence = sentence.split('\n');
......@@ -575,6 +575,8 @@ GameObject.prototype = {
}
return true;
})[0]
}else{
return its[0];
}
},
loadAnimation: function(animationName, {manual, duration, path, size, frames, offset, padding}) {
......
......@@ -24,6 +24,7 @@
<script src="object/NPC.js"></script>
<script src="object/Zone.js"></script>
<script src="object/Tree.js"></script>
<script src="object/Trash.js"></script>
<script src="js/main.js"></script>
</body>
......
class Key extends GameObject {
step(dt, tfs){
if(this.collide(Player)){
var hole = this.getItem( Zone, { Name: 'Hole' } );
var hole = this.getItem( Zone, { Name: this.AttachedZone } );
this.startTime = tfs;
hole.animate( 'hideWall', function( progress ){
if(progress === 0){
......
......@@ -9,20 +9,39 @@ class NPC extends GameObject {
}
}else{
this.wobble = Math.sin( tfs * 4 ) * 1;
this.wobble2 = Math.sin( tfs * 3+5 ) * 3;
this.position[ 1 ] = this.originalY + 1 + this.wobble | 0;
this.position[ 0 ] = this.originalX + ( this.wobble2 | 0 );
}
/*this.wobble = Math.sin( tfs * 4 ) * 1;
this.wobble2 = Math.sin( tfs * 3+5 ) * 3;
this.position[ 1 ] = this.originalY + 1 + this.wobble | 0;
this.position[ 0 ] = this.originalX + ( this.wobble2 | 0 );*/
}
if(this.saying){
this.setAnimation('puzing');
}else{
this.setAnimation('blinking');
}
this.updateAnimation(dt);
}
init() {
this.loadAnimation('blinking', {
path: 'sprites/Jaba1.png',
size: [64, 64],
frames: 4,
duration: 2
});
this.loadAnimation('puzing', {
path: 'sprites/Jaba2.png',
size: [64, 64],
frames: 4,
duration: 2
});
if(this.Dialog)
this.sentance = 0;
/*
this.wobble = 0;
this.originalX = this.position[0];
this.originalY = this.position[1];
this.originalY = this.position[1];*/
this.actions = {
openPassage: function() {
var passage = this.getItem(Zone, {Name: 'RocksPassage'});
......
// Класс игрока
class Player extends GameObject {
init(){
this.tinCans = 0;
this.extendSprite();
this.position[1]++;
this.collisionOffset = [5,8,5,9];
......
// Зона вырезает кусок слоя уровня и даёт возможность показывать и скрывать выбранные участки геометрии уровня
class Trash extends GameObject {
init() {
}
step(dt, tfs){
if(this.collide(Player) && this.visible){
this.getItem( Player ).tinCans += 1;
console.log('Tin cans = ', this.getItem( Player ).tinCans )
this.visible = false;
}
}
}
\ 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