Skip to content

Commit 0ccd280

Browse files
authored
Switch to using doodle components for object properties. (google#141)
Also fix issues with the previous state of code for adding elves.
1 parent b1a16cb commit 0ccd280

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

static/scenes/railroad/js/systems/elves-system.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,14 @@ class ElvesSystem {
5656

5757
generateElvesFromScene() {
5858
for (const scene of this.placeholderScene.getScene().children) {
59-
if (!scene.isScene) continue;
6059
for (const obj of scene.children) {
61-
if (obj.userData.type === 'elf') {
62-
console.log(obj);
63-
new THREE.TextureLoader().load(`img/${obj.userData.assetUrl}`, (elfTexture) => {
64-
const material = new THREE.SpriteMaterial({map: elfTexture});
60+
if (obj.userData.doodle_components.includes('clickable') && obj.userData.clickable.type === 'elf') {
61+
new THREE.TextureLoader().load(`img/${obj.userData.sprite.assetUrl}`, (elfTexture) => {
62+
const material = new THREE.SpriteMaterial({map: elfTexture, transparent: true});
6563
const sprite = new THREE.Sprite(material);
6664
sprite.material.rotation = (obj.rotation.y);
6765
sprite.userData.isElf = true;
6866
obj.add(sprite);
69-
console.log(obj);
7067
});
7168
}
7269
}

static/scenes/railroad/js/systems/raycaster.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class RaycasterSystem {
3030
for (const {object} of intersections) {
3131
if (object.userData.isElf === true) {
3232
score += 1;
33-
} else if (object.userData.type === 'ice') {
33+
} else if (object.userData.clickable.type === 'ice') {
3434
this.placeholderScene.setTimeScale(0.5);
3535
}
3636
}
412 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)