Repository navigation
klyph 1.2: Scrolling worlds
klyph 1.2.0: Scrolling worlds. Add it to a game with
plugins { id("com.eventslooped.klyph") version "1.2.0" }
klyph { entryPoint = "mygame.main" }
kotlin { sourceSets.nativeMain.dependencies { implementation("com.eventslooped.klyph:klyph:1.2.0") } }or start from klyph-template. The guide and API reference are at https://inemtsev.github.io/klyph/.
Scrolling worlds: layers that move at their own speed, textures that repeat, a sky under the
world, and a camera that follows what is drawn.
Added
ParallaxLayer: a sprite that follows the camera at a fraction of the world's speed and repeats to fill the view;
see the Scrolling worlds guide.DrawSpace.BACKGROUND: canvas quads in points drawn under the whole world, such as a one-call sky.- Repeating textures:
SamplerAddress.REPEATonAssets.texture,textureOrNullandcreateTexture, then
Sprite.tileWidthandtileHeightorCanvas.drawTiledto repeat the texture across a larger area instead of stretching it. Sprite.originXandoriginY: anchor a sprite to itsTransformat any point, such as a character's feet, instead of the center.Camera.offsetXandoffsetY: shift the view afterfollowand the bounds clamp, such as for a screen shake.drawnPositionOfonWorldandApp: where anInterpolatedentity is drawn this frame, for a camera to follow.World.snapInterpolation(entity): draws a teleported or respawnedInterpolatedentity at its new place, with no sweep from the old one.Scene.elapsedandelapsedSeconds: how long a scene has been on top, standing still while another scene covers it.AppConfig.textureFilterandAssets.textureFilter: the filter that textures, sprite sheets and fonts load with
unless the call passes one, so a pixel-art game setsNEARESTonce.Image.fillRectandImage.draw: paint a rectangle, or lay one image over another with alpha blending, beforecreateTexture.Overlap.otherOrNull(entity): the other entity of a pair, ornullfor an entity in neither slot.Time.fixedDeltaSecondsandelapsedSeconds: the fixed step's length and the game time asFloatseconds, besidedeltaSeconds.TextureRegion.aspectRatio: a region's width over its height, to size a sprite by one side without distorting it.
Changed
DrawSpace.BACKGROUNDis the enum's first entry, beforeWORLDandSCREEN: an exhaustivewhenover
the two needs a branch for it, and the ordinals moved.