Package Exports
- @rbxts/matter
- @rbxts/matter/src/lib/init.lua
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@rbxts/matter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@rbxts/matter
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 [entity_id, bal, name, wants_money] of world.query(Balance, Name, WantsMoney)) {
if (wants_money.flag) world.insert(entity_id, 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)
