Skip to content

HylianBasement/rbxts-matter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@rbxts/matter

NPM

Roblox-TS typings for Matter made by @evaera and @lpghatguy.

Installation:

npm i @rbxts/matter

Example Usage

import { component, Loop, World } from "@rbxts/matter"

const world = new World()

const Balance = component<{ amount: number }>()
const Name = component<{ name: string} >()
const WantsMoney = component<{ flag: boolean }>()

const Marcus = world.spawn(Balance({ amount: 1000 }), Name({ name: "Marcus" }), WantsMoney({ flag: true }))
const Jade = world.spawn(Balance({ amount: 1000 }), Name({ name: "Jade" }), WantsMoney({ flag: false }))

for (const [entityId, bal, name, wantsMoney] of world.query(Balance, Name, WantsMoney)) {
  if (wantsMoney.flag) world.insert(entityId, bal.patch({ amount: bal.amount + 500 }))
}

assert(world.get(Marcus, Amount).amount === 1500)
assert(world.get(Jade, Amount).amount === 1000)

To see Matter used in a game, see Ukendio/For-Animia

Documentation

See Evaera/Matter

Changelog

0.0.1

  • Republished Matter (from GitHub commit d0df77f)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%