Skip to content

UrbanIndigo/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 [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)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%