diff options
author | Aki <nthirtyone@gmail.com> | 2017-04-03 22:07:32 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-04-03 22:07:32 +0200 |
commit | 603fac3ce18ff7df7b8d2f74d5e57cc728c0abc2 (patch) | |
tree | 47a920fe8b5355e82006e7545cba640f3638ac80 /not/PhysicalBody.lua | |
parent | be64dffe9e3354fda6220a1b25251e1664cd71cc (diff) | |
download | roflnauts-603fac3ce18ff7df7b8d2f74d5e57cc728c0abc2.zip roflnauts-603fac3ce18ff7df7b8d2f74d5e57cc728c0abc2.tar.gz roflnauts-603fac3ce18ff7df7b8d2f74d5e57cc728c0abc2.tar.bz2 |
Created physics functions to influence PhysicalBody; changed Hero to use them. Comments.
Diffstat (limited to 'not/PhysicalBody.lua')
-rw-r--r-- | not/PhysicalBody.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/not/PhysicalBody.lua b/not/PhysicalBody.lua index a7abcc0..a9ac63b 100644 --- a/not/PhysicalBody.lua +++ b/not/PhysicalBody.lua @@ -38,6 +38,14 @@ function PhysicalBody:setPosition (x, y) self.body:setPosition(x, y) end +-- Velocity-related methods. +function PhysicalBody:setLinearVelocity (x, y) + self.body:setLinearVelocity(x, y) +end +function PhysicalBody:getLinearVelocity () + return self.body:getLinearVelocity() +end + -- Various setters from Body. -- type: BodyType ("static", "dynamic", "kinematic") function PhysicalBody:setBodyType (type) @@ -46,6 +54,17 @@ end function PhysicalBody:setBodyFixedRotation (bool) self.body:setFixedRotation(bool) end +function PhysicalBody:setBodyActive (bool) + self.body:setActive(bool) +end + +-- Physical influence methods. +function PhysicalBody:applyLinearImpulse (x, y) + self.body:applyLinearImpulse(x, y) +end +function PhysicalBody:applyForce (x, y) + self.body:applyForce(x, y) +end -- Update of `PhysicalBody`. function PhysicalBody:update (dt) |