diff options
author | Aki <nthirtyone@gmail.com> | 2017-09-23 14:08:32 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-09-23 14:08:32 +0200 |
commit | 19a19538c205fce74550c20d648fb239e26f0cf3 (patch) | |
tree | 59339bebc67f2eb9ab0f7620a1163d469667155d /not/Player.lua | |
parent | d651584d7a550a507670d9e028ed1c9be5fae427 (diff) | |
download | roflnauts-19a19538c205fce74550c20d648fb239e26f0cf3.zip roflnauts-19a19538c205fce74550c20d648fb239e26f0cf3.tar.gz roflnauts-19a19538c205fce74550c20d648fb239e26f0cf3.tar.bz2 |
Hero walking moved from Player, separated into methods
Diffstat (limited to 'not/Player.lua')
-rw-r--r-- | not/Player.lua | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/not/Player.lua b/not/Player.lua index b0dac75..6996c9d 100644 --- a/not/Player.lua +++ b/not/Player.lua @@ -38,20 +38,10 @@ function Player:update (dt) -- Walking. if self:isControlDown("left") then - self.facing = -1 - self:applyForce(-250, 0) - -- Controlled speed limit - if x < -self.MAX_VELOCITY then - self:applyForce(250, 0) - end + self:walkLeft() end if self:isControlDown("right") then - self.facing = 1 - self:applyForce(250, 0) - -- Controlled speed limit - if x > self.MAX_VELOCITY then - self:applyForce(-250, 0) - end + self:walkRight() end end |