Skip to content

Latest commit

 

History

History
110 lines (84 loc) · 2.15 KB

README.md

File metadata and controls

110 lines (84 loc) · 2.15 KB

2d lua physics engine

this project is built on LOVE 2d game engine, mainly just to hone skills but it is suitable for use

Run Locally

Install my-project with npm

  • create environment
    mkdir my-project
  • clone repo
    git clone https://github.com/MythicalMayhem/physicsNgine
  • install lua and make environment
  • install love 2d (how to install)
  •   cd my-project 
  • run with ALT + L

API Reference

objects

boxes

  boxes:new (canCollide,x,y,w,h,c)
(walls)
  • canCollide : collidable or walk-through
  • x,y : position
  • w,h : width / height
  • c : hitbox color {r,g,b,a} r,g,b,a in [0,1]

entities

  entities:new (x,y,w,h,c)
(walls)
  • canCollide : collidable or walk-through
  • x,y : position
  • w,h : hitbox width / height
  • c : hitbox color {r,g,b,a} r,g,b,a in [0,1]

forces

temporary impulse

  physics:applyImpulse(e,x,y,mag,res)
(jumping or knockback)
  • e : the entity (player or npc)
  • x,y : coordinates of the normalized vector
  • mag : magnitude
  • res : resistance, the rate of diminution

constant force

  physics:linear(e,x,y,mag)
(gravity or flying )
  • e : the entity (player or npc)
  • x,y : coordinates of the normalized vector
  • mag : magnitude

Tweening

create

local tw = tween:new(obj, { x = fromX, y = fromY }, { x = toX, y = toY }, seconds)

pause

tw:pause()

resume

tw:resume()

destroy

tw:destroy()

Acknowledgements

Authors

License

MIT

Usage/Examples