~nasser/lospec-2

f052c545ce889a4591317a325d625badc1131be6 — Ramsey Nasser 6 months ago d15b597 main
Final changes
4 files changed, 28 insertions(+), 14 deletions(-)

M blend/level.blend
M blend/level.blend1
M gltf/level.glb
M main.js
M blend/level.blend => blend/level.blend +0 -0
M blend/level.blend1 => blend/level.blend1 +0 -0
M gltf/level.glb => gltf/level.glb +0 -0
M main.js => main.js +28 -14
@@ 12,12 12,18 @@ import { gamepad, axes, view } from './input'
import { easeInOutCubic } from 'easing-utils'

import ls16 from "./ls16"
// import * as Tone from 'tone'
import 'reset-css/reset.css'
import './style.css'
import palettePass from "./palette-pass"
import canvasPass from "./canvas-pass"

// https://stackoverflow.com/questions/8916620/disable-arrow-key-scrolling-in-users-browser
window.addEventListener("keydown", function (e) {
    if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].indexOf(e.code) > -1) {
        e.preventDefault();
    }
}, false);

import kittyImage from './kitty.png?url'
import controlsImage from './controls.png?url'
import level from './gltf/level.glb?url'


@@ 122,8 128,8 @@ SCHED.add(function* () {
    // CTX.font = '9px "BM Space"'
    CTX.font = '24px "BM Japan"'
    CTX.lineWidth = 2
    
    yield* coro.seconds(beat)

    // yield* coro.seconds(beat)
    text('SHEEP', 10, 40)
    CTX.font = '8px "04b03"'
    SCHED.add(fadeInFromFog())


@@ 136,7 142,7 @@ SCHED.add(function* () {
    yield* coro.seconds(beat * 4)
    CTX.clearRect(0, 0, biggest, biggest)
    yield* coro.seconds(beat * 4)
    text('the game is inspired by my dog', 10, 30)
    text('this game is inspired by my dog', 10, 30)
    yield* coro.seconds(beat * 4)
    clear()
    yield* coro.seconds(beat * 4)


@@ 183,17 189,19 @@ sun.shadow.camera.left = -500
sun.shadow.camera.right = 500
sun.shadow.camera.top = -500
sun.shadow.camera.bottom = 500

scene.add(sun)

const sun2 = new THREE.DirectionalLight('blue', .275)
sun2.position.set(-50, 200, -70)
sun2.castShadow = true
sun2.shadow.normalBias = 10
sun2.shadow.camera.left = -500
sun2.shadow.camera.right = 500
sun2.shadow.camera.top = -500
sun2.shadow.camera.bottom = 500
scene.add(sun2)
// const sun2 = new THREE.DirectionalLight('blue', .275)
// sun2.position.set(-50, 200, -70)
// sun2.castShadow = true
// sun2.shadow.normalBias = 10
// sun2.shadow.camera.left = -500
// sun2.shadow.camera.right = 500
// sun2.shadow.camera.top = -500
// sun2.shadow.camera.bottom = 500
// scene.add(sun2)

scene.add(new THREE.AmbientLight('white', 1))

const goalZones = []


@@ 274,7 282,7 @@ function levelFinished() {
function* levelProgression() {
    const exitVelocity = new THREE.Vector2(0, -1)
    for (let i = 0; i < levels.length; i++) {
        loadLevel(levels[i], new THREE.Vector2(0, i * -399))
        loadLevel(levels[i], new THREE.Vector2(0, i * -400))
        while (!levelFinished())
            yield
        if (i < levels.length - 1) {


@@ 439,6 447,7 @@ function* oneSheep(sheep) {
            }
        }

        sheep.velocity.clampLength(0, 10)
        sheep.position.addScaledVector(sheep.velocity, 0.1)

        // drawPeg(sheep.position, 'white', 8)


@@ 523,6 532,10 @@ SCHED.add(function* dogMovement() {
        }
    })

    const sunOffset = sun.position.clone()
    const sunRotation = sun.rotation.clone()
    sun.target = mesh

    while (true) {
        const h = INPUT.now.axes.horizontal
        const v = INPUT.now.axes.vertical


@@ 561,6 574,7 @@ SCHED.add(function* dogMovement() {
        camera.lookAt(scene.position)
        camera.position.x += mesh.position.x
        camera.position.z += mesh.position.z
        sun.position.copy(sunOffset).add(mesh.position)
        yield
    }
})