npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

juno-console

v0.0.60

Published

Juno is a clean and lightweight 2D game framework written in TypeScript for making tiny HTML5 Games.

Downloads

19

Readme

dependencies status badge GitHub issues GitHub stars Contributions welcome GitHub license

Juno is a simple and lightweight 2D game framework written in TypeScript for making tiny pixel style HTML5 Games. The structure of Juno is similar to that of fantasy consoles with a simple API. Creating prototypes has never been easier.

The framework is still in an early stage of development.

What are you waiting for? Start with Juno and create games in a nutshell!

Getting started

Installation

npm install juno-console --save
yarn add juno-console
bower install juno-console --save

Usage

For a boilerplate and examples have a look at the Juno examples.

API

For more details see comments in the code.

ipal

Init your own color palette.

cls

Clear the screen.

pix

Draw a pixel.

pget

Get pixel color index from 2D position.

load

Load your spritesheet.

spr

Add a sprite.

map

Load a Tilemap.

mget

Get map tile index.

mset

Set map tile index.

circ

Draw a filled circle.

circb

Draw a circle outline.

line

Draw a line.

rect

Draw a filled rect.

rectb

Draw a rectangle outline.

print

Draw some text.

trace

Trace a variable for it's value.

key

Check if a key is currently pressed.

keyp

Check if a key was pressed in the frame before (only once).

mouse

Get the mouse coordinates.

ggw

Get the game width.

ggh

Get the game height.

ticks

Get the ticks since start of the game.

rnd

Get a random number between min and max value.

crc

Simple circle-rectangle-collision.

rrc

Simple rectangle-rectangle collision.

anim

Animate your sprite.

FAQ

How is the basic setup?

Have a look at the Juno examples. You will find a boilerplate.

Basically, only three functions are required. The init() function can be used to initiate the color palette, load the sprites or the json map file and define variables. With the update() function parameters are adjusted and the render() function draws your masterpieces.

How do I load my sprites?

Make a call of the load() function in your init(). The path is relative to your root folder. You can then draw your sprites in the render() function.

init(): void {
  this.api.load("sprites", "./src/assets/sprites.png", 8);
}

render(): void {
  this.api.spr(0, 10, 10);
}

Be aware: Currently you can only load one sheet (spritesheet and Tileset together)

How do I load my JSON map?

Similar as loading your sprites. Be sure to load your tiles before.

init(): void {
  this.api.load("tiles", "./assets/tiles.png", 8);
  this.api.load("map", "./assets/map.json", 8);
}

render(): void {
  this.api.spr(0, 10, 10);
}

Be aware: Currently you can only load one sheet (spritesheet and Tileset together)

How do I load my own color palette?

One palette comprises a total of 16 colours. By default, a predefined palette is loaded. Your own palette can be loaded using a chain of hex strings (6 x 16 = 96 characters).

init(): void {
  this.api.ipal(1a1c2c572956b14156ee7b58ffd079a0f07238b86e276e7b29366f405bd04fa4f786ecf8f4f4f493b6c1557185324056);
}

OK, so I have chosen a color palette, but how do I get the colors into my graphics editor?

The easiest way is to load the already defined .css swatch directly into your graphics editor. Et voilà!

Changelog

Learn about the latest improvements

Contributing

Want to correct a bug, contribute some code, or improve the codes? Excellent! Let me know!

License

This project is licensed under the MIT License - see the LICENSE.md file for details.