Skip to content

peerhadi/Nexus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nexus Engine

A lightweight 2D game engine built with TypeScript and HTML5 Canvas.
Designed for arcade-style games like Pong, platformers, and simple simulations.


Features

  • Game loop using requestAnimationFrame
  • Scene system (menus, levels, game states)
  • 2D renderer (shapes, sprites, text)
  • Camera system (follow + zoom)
  • Basic physics (rigidbody, gravity, collisions)
  • Sprite sheets + animations
  • Texture loading system
  • Delta time + FPS tracking

Install

npm install


Run development server

npm run dev


Build for production

npm run build


Basic Usage

Create a scene by extending Scene.

Use render(renderer) to draw objects.

Create a Game instance with width, height, and title.

Load scenes using engine.loadScene().

Start game with game.start().


Scene Lifecycle

start() → runs once when scene loads
update() → runs every frame for logic
render(renderer) → runs every frame for drawing


Mouse Input Example

canvas.addEventListener("mousemove", (e) => { console.log(e.clientX, e.clientY); });


Pong Example (Paddle)

  • Store paddle Y position
  • Update it using mouse movement or input
  • Draw using renderer.fillRect
  • Paddle is a vertical rectangle

Notes

  • Engine is still in development
  • Physics system is simple but extendable
  • Built for learning and experimentation

License

MIT

About

A lightweight 2D game engine built with TypeScript and HTML5 Canvas.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors