Skip to content

Commit

Permalink
'refactor and all sorts of stuff'
Browse files Browse the repository at this point in the history
  • Loading branch information
foglabs committed Nov 1, 2020
1 parent efec97c commit 1c52541
Show file tree
Hide file tree
Showing 346 changed files with 55,233 additions and 1,960 deletions.
8 changes: 5 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
</head>
<body>
<script type="text/javascript">

//utility functions
function k(obj){
return Object.keys(obj)
}
Expand Down Expand Up @@ -100,13 +102,13 @@

MOVE = 0
WAIT = 1

DEMO = 0
</script>

<script type="module">
import * as main from '/v3/lib/main.js'
console.log('scene', main.scene)
import * as main from '/lib/main.js'
</script>


</body>
</html>
78 changes: 39 additions & 39 deletions lib/Character.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as THREE from "./three.module.js"
import { Timer } from "./Timer.js"
import { scene, floor, characters } from "./main.js"
import { scene, place } from "./main.js"

class Character {
constructor(geo, bbox, base_color, mat=false){
Expand Down Expand Up @@ -92,7 +92,7 @@ class Character {
}

arrivedAtPoint(){
return isWithin(this.mesh.position.x, this.routePoints[0][0], 0.1) && isWithin(this.mesh.position.y, this.routePoints[0][1], 0.1) && isWithin(this.mesh.position.z, this.routePoints[0][2], 0.1)
return isWithin(this.mesh.position.x, this.routePoints[0][0], 0.01) && isWithin(this.mesh.position.y, this.routePoints[0][1], 0.01) && isWithin(this.mesh.position.z, this.routePoints[0][2], 0.01)
}

handleRoutePoints(){
Expand All @@ -106,7 +106,7 @@ class Character {
// this.routePoints.shift()

this.action = WAIT
// console.log( 'arrived' )
console.log( 'arrived' )
this.waitTimer.reset()

// if we finished the route, we finished a lap
Expand Down Expand Up @@ -469,7 +469,7 @@ class Character {

gravity(){
// if(this.mesh.position.y > FLOOR){
if(!this.bbox.intersectsBox( floor.bbox )){
if(!this.bbox.intersectsBox( place.floor.bbox )){
// pull down if were not at the floor yet
this.accy = this.accy - 0.05
} else {
Expand Down Expand Up @@ -497,7 +497,7 @@ class Character {
for(var i=0; i<intersects.length; i++){

// look for a char from the intsersect
otherChar = characters[ intersects[i].object.id ]
otherChar = place.characters[ intersects[i].object.id ]
if(otherChar){

// are we actually touching boxes wittem
Expand Down Expand Up @@ -668,49 +668,49 @@ class Character {
// set bounding box from mesh baby
this.bbox.setFromObject(this.mesh)

this.colorCycle()
// this.colorCycle()

if(this.deadSprite && this.deadSpriteMoves){
this.deadSprite.position.set(this.mesh.position.x, this.mesh.position.y, this.mesh.position.z)
}
// if(this.deadSprite && this.deadSpriteMoves){
// this.deadSprite.position.set(this.mesh.position.x, this.mesh.position.y, this.mesh.position.z)
// }

if(this.banners){
this.banners.animation()
}
// if(this.banners){
// this.banners.animation()
// }

if(this.godBanners){
this.godBanners.animation()
}
// if(this.godBanners){
// this.godBanners.animation()
// }

if(this.duster){
// run dis
this.duster.animation()
if(this.dusterTimer.time() > 20){
this.dusterTimer.reset()
// if(this.duster){
// // run dis
// this.duster.animation()
// if(this.dusterTimer.time() > 20){
// this.dusterTimer.reset()

this.duster.particleSystem.material.opacity -= 0.1
if(this.duster.particleSystem.material.opacity <= 0){
// this.duster.particleSystem.material.opacity -= 0.1
// if(this.duster.particleSystem.material.opacity <= 0){

this.duster.remove()
this.duster = null
}
}
}
// this.duster.remove()
// this.duster = null
// }
// }
// }

if(this.bloodDuster){
// run dis
this.bloodDuster.animation()
if(this.bloodDusterTimer.time() > 20){
this.bloodDusterTimer.reset()
// if(this.bloodDuster){
// // run dis
// this.bloodDuster.animation()
// if(this.bloodDusterTimer.time() > 20){
// this.bloodDusterTimer.reset()

this.bloodDuster.particleSystem.material.opacity -= 0.1
if(this.bloodDuster.particleSystem.material.opacity <= 0){
// this.bloodDuster.particleSystem.material.opacity -= 0.1
// if(this.bloodDuster.particleSystem.material.opacity <= 0){

this.bloodDuster.remove()
this.bloodDuster = null
}
}
}
// this.bloodDuster.remove()
// this.bloodDuster = null
// }
// }
// }

}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Game.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Timer } from '/v3/lib/Timer.js'
import { Timer } from '/lib/Timer.js'

class Game {
constructor(){
Expand Down
18 changes: 18 additions & 0 deletions lib/Place.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as THREE from "./three.module.js"
import { Timer } from "./Timer.js"
import { scene } from "./main.js"

class Place {
// encapsulates background color/image control, scenery objects, and floor object
constructor(backgroundHex, characters, floor){
this.backgroundHex = backgroundHex
this.characters = characters
this.floor = floor
}

handlePlace(){

}
}

export { Place }
2 changes: 1 addition & 1 deletion lib/Pointer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Pointer extends Character {
// mesh id aka characters[mesh id]
this.grabbedId = null

let geo = new THREE.BoxGeometry( 0.4,0.4,0.4 )
let geo = new THREE.BoxGeometry( 0.1,0.1,0.1 )
let mat = new THREE.MeshPhysicalMaterial( { color: '#0000ff', transparent: true, transmission: 0.5, reflectivity: 1, roughness: 0, clearcoat: 1.0, clearcoatRoughness: 0.1 })
this.grabBox = new Character(geo, new THREE.Box3(new THREE.Vector3(), new THREE.Vector3()), [23,23,141], mat)
scene.add(this.grabBox.mesh)
Expand Down
205 changes: 0 additions & 205 deletions lib/TubePainter.js

This file was deleted.

Loading

0 comments on commit 1c52541

Please sign in to comment.