Skip to content

LittleJS 1.28.0 - Cameras, Screen Shake and Box2D Platforms

Latest

Choose a tag to compare

@KilledByAPixel KilledByAPixel released this 20 Oct 22:18
· 1 commit to main since this release

New Demos

  • 3D Third Person - Run a ball around a field of blocks with a camera that swings around behind it and pulls in at walls
  • Camera Shake - A bump on Space and a blast on a click, shakes that add up and fade on their own
  • Box2D Platformer - Jump up through one way ledges, drop back down through them and ride conveyor belts with crates, all in Box2D
  • 3D Plugin - The island's ball now rolls the way the camera looks, with the camera swinging around behind it
  • Platforming Game - The camera now looks ahead the way you run, stays over the level, and explosions shake the screen

New Changes

  • Cameras: the new camera plugin follows things for you. new FollowCamera(player) follows in 2D with smooth movement, a dead zone, level bounds, zoom, and a look ahead that shows more of the way the player is going and slides across when they turn. new ThirdPersonCamera3D(player) puts the 3D camera on a pole behind the player that swings around as they move, turns with the mouse or a gamepad stick, and pulls in when a wall gets in the way. Smoothing is in seconds, so it feels the same at any frame rate
  • cameraShake(amount): screen shake for hits and explosions, in 2D and 3D, with or without a camera; shakes add up and fade by themselves, and hold through a pause or a hit stop at time scale 0
  • A child object's pos and angle can be set: it stays where you put it and moves with its parent from there, where before the parent put it straight back
  • setWorldPos3D, setWorldRotation3D and getWorldRotation3D put a 3D child at a place or rotation in the world
  • Box2D: beginContact tells where two objects touched and how hard they hit; oneWay platforms, conveyor belts with setSurfaceSpeed, and preSolve for letting a contact pass, as for dropping through a ledge
  • engineAddPlugin takes an updatePost function, called after every object has moved each update

Breaking Changes

  • CameraControl3D and FirstPersonCamera3D now set the 3D camera after every object has moved, not in their own update(); code that calls their update() by hand and reads the camera calls updateCamera() after it

Check out the latest on GitHub to see everything we've been working on!

box2dPlatformer cameraShake