Skip to content

Commit

Permalink
Game mode done
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriymuryn committed Nov 26, 2017
1 parent 751d055 commit 1890d6d
Show file tree
Hide file tree
Showing 12 changed files with 186 additions and 127 deletions.
25 changes: 1 addition & 24 deletions _TODO
Original file line number Diff line number Diff line change
@@ -1,32 +1,11 @@
- Boosts funcionais (implementado o boost central)
Pode trazer alguns porblemas por causa do movimento atual da personagem


- Melhorar o movimento da personagem.
Provavelmente algo com um contador onde é simulada aceleração

- BulletPool
Reutilizar as balas em vez de estar sempre a criar e a destruir

- EnemyPool
Same

- Octree Raycasting
Ver se melhora o desempenho do Raycasting

- Dividir o mapa em 3
Uma parte de chao para ser usado com o raycast para baixo
Outra parte de paredes para usar com raycast lateral
Outra parte só estética (tecto) para não empatar

- Adicionar um trail à bala
Provavelmente ver as particulas se fica mais rapido / dá para fazer
Se não, acrescentar um mesh atras da bala

- Escolher e implementar o modo de jogo
Survival, onde inimigos aparecem sempre, cada vez mais, e tens um highscore de quantos mataste
TimeAttack, onde tens X segundos para matar os inimigos, e é por rondas (meh)
...

- Movimentos e ações dos inimigos
Previsão da nossa posição para disparar contra nos
Espécie de Pathfinding
Expand All @@ -40,5 +19,3 @@

- THREE.BufferGeometry para mapa
supostamente mais rapido para objetos que nao se mexem

- Recoil da arma
5 changes: 5 additions & 0 deletions _TopicosRelatorio
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
Foi feita uma ilusao de sombra usando dois materias diferentes

- O mapa criado tinha 3 mil faces e depois de uma otimização passou para 1,5 mil
Posteriormente foi dividido em 3 para melhorar o desempenho

- MD2Character não dava para copiar para varios inimigos. As animações não eram grande coisa
Passou-se a usar MD2CharacterComplex

- Bullet & Enemy Pool
O porque de se usar, falar do garbage collector e criação de modelos

- firefox vs chrome
1 change: 0 additions & 1 deletion boost.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ function Boost(postion,actionFunction) {
var self = this;

this.update = function(posObject){
//console.log("threshold " + this.thresholdDistance);
if (posObject.distanceTo(postion)<this.thresholdDistance){//conta o valor de Y por isso deve ser descontada a altura dos objetos
this.actionFunction();// aplicação de forças para o jump!
}
Expand Down
4 changes: 0 additions & 4 deletions bullet.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ function Bullet(damage) {

this.update = function (delta, objectIndex) {
//this.box.position.copy(new THREE.Vector3().addVectors(this.mesh.position,this.direction.normalize()));
//console.log(this.mesh.position);
this.raycaster.ray.origin.copy(this.mesh.position);
this.raycaster.ray.direction.copy(this.direction);

var intersections = this.raycaster.intersectObjects(this.objectStatic,true);
if (intersections.length>0){
console.log("Colisão bala");
this.destroy(objectIndex);
return;
}
Expand All @@ -61,7 +59,6 @@ function Bullet(damage) {
intersections = this.raycaster.intersectObject(game.enemies[i].mesh,true);
if (intersections.length>0){
game.enemies[i].damage(this.damage,i);
console.log("Enemy hit");
this.destroy(objectIndex);
return;
}
Expand All @@ -70,7 +67,6 @@ function Bullet(damage) {

if (!this.shotByPlayer && game.player.playerBB.containsPoint(this.mesh.position)){
game.player.takeDamage(this.damage);
console.log("Player hit");
this.destroy(objectIndex);
return;
}
Expand Down
6 changes: 3 additions & 3 deletions enemy.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ function Enemy() {
direction.y=0;

var bullet = bPool.allocate();
console.log("shoot");
bullet.activate(this.enemyDamage, pointBulletVec, direction, this.bulletSpeed, false);
};

Expand Down Expand Up @@ -137,7 +136,6 @@ function Enemy() {
this.boosts[i].update(new THREE.Vector3().subVectors(this.mesh.position,new THREE.Vector3(0,this.enemyHeight,0)))//ver se é preciso passar o delta
}

// console.log(this.mesh.position)
//update fisica
this.updatePhysics(delta);

Expand Down Expand Up @@ -175,7 +173,6 @@ function Enemy() {
});//quando terminar de olhar para o player resta timeLook para 5
}

//console.log("move " , this.timeLook)

//this.mesh.rotateY(0.3*delta * superHotConstant);
//this.mesh.translateZ(-this.speed*delta * superHotConstant);
Expand All @@ -195,11 +192,14 @@ function Enemy() {

if (this.health <= 0){
this.destroy(index);
game.score += 1;
scoreDiv.innerHTML = game.score;
}
};

this.activate = function (position) {
this.active = true;
this.health = 100;
game.enemies.push(this);
this.setPosition(position);

Expand Down
Loading

0 comments on commit 1890d6d

Please sign in to comment.