scenes/boost: some styling fix

This commit is contained in:
Kazhnuz 2019-02-06 07:51:20 +01:00
parent f7582fbe16
commit 90538d5a01

View file

@ -23,7 +23,7 @@ local Character = Entity:extend()
function Character:new(charcontroller, rail, character, id) function Character:new(charcontroller, rail, character, id)
self.charcontroller = charcontroller self.charcontroller = charcontroller
local world = self.charcontroller.controller.world local world = self.charcontroller.controller.world
local rail = rail or 2 local rail = rail or 2
@ -46,8 +46,8 @@ function Character:new(charcontroller, rail, character, id)
self.isInAction = false self.isInAction = false
self.canAction = true self.canAction = true
self.dash = false self.dash = false
self.dashCam = false self.dashCam = false
self:setDebugColor(0, 255, 0) self:setDebugColor(0, 255, 0)
@ -65,16 +65,16 @@ function Character:new(charcontroller, rail, character, id)
self.life = 3 self.life = 3
self.startx = self.x self.startx = self.x
self.starty = self.y self.starty = self.y
self.view = {} self.view = {}
self.view.x = self.x self.view.x = self.x
self.view.y = self.y self.view.y = self.y
self.view.dx = 0 self.view.dx = 0
self.relx = 0 self.relx = 0
self.relxspeed= 0 self.relxspeed = 0
self.grind = false self.grind = false
@ -130,10 +130,10 @@ function Character:sideSteps()
else else
if (self.keys["up"].isDown) then if (self.keys["up"].isDown) then
self.yspeed = - 1 * 60 * phys.side self.yspeed = - 1 * 60 * phys.side
self.ymove = true self.ymove = true
elseif (self.keys["down"].isDown) then elseif (self.keys["down"].isDown) then
self.yspeed = 60 * phys.side self.yspeed = 60 * phys.side
self.ymove = true self.ymove = true
else else
self.ymove = false self.ymove = false
end end
@ -152,16 +152,16 @@ end
function Character:jumpAction() function Character:jumpAction()
if self.data.stats.jumpaction == "doublejump" then if self.data.stats.jumpaction == "doublejump" then
if (self.keys["A"].isPressed) and (self.isJumping) and (self.canAerialAction) then if (self.keys["A"].isPressed) and (self.isJumping) and (self.canAerialAction) then
self.zspeed = 60 * self.data.stats.jumpaction_power self.zspeed = 60 * self.data.stats.jumpaction_power
self.isInAerialAction = true self.isInAerialAction = true
self.canAerialAction = false self.canAerialAction = false
end end
elseif self.data.stats.jumpaction == "jumpdash" then elseif self.data.stats.jumpaction == "jumpdash" then
if (self.keys["A"].isPressed) and (self.isJumping) and (self.canAerialAction) then if (self.keys["A"].isPressed) and (self.isJumping) and (self.canAerialAction) then
self.zspeed = 60 * 1 self.zspeed = 60 * 1
self.xspeed = math.max(self.xspeed, self.data.stats.spd * 60 * 1.2) self.xspeed = math.max(self.xspeed, self.data.stats.spd * 60 * 1.2)
self.isInAerialAction = true self.isInAerialAction = true
self.canAerialAction = false self.canAerialAction = false
self.dashCam = true self.dashCam = true
self:addTimer("dashCam", .5) self:addTimer("dashCam", .5)
end end
@ -171,12 +171,12 @@ end
function Character:normalAction() function Character:normalAction()
if self.data.stats.action == "spinattack" then if self.data.stats.action == "spinattack" then
if (self.keys["B"].isPressed) and (self.onGround) and (self.canAction) and (self.grind == false) then if (self.keys["B"].isPressed) and (self.onGround) and (self.canAction) and (self.grind == false) then
self.xspeed = math.max(self.xspeed, self.data.stats.spd * 60 * 1.5) self.xspeed = math.max(self.xspeed, self.data.stats.spd * 60 * 1.5)
self.isInAction = true self.isInAction = true
self.canAction = false self.canAction = false
self.dashCam = true
self:addTimer("action", .5) self:addTimer("action", .5)
self:addTimer("action_cooldown", 1) self:addTimer("action_cooldown", 1)
self.dashCam = true
self:addTimer("dashCam", .5) self:addTimer("dashCam", .5)
end end
end end
@ -377,10 +377,10 @@ function Character:snaptoRails(dt)
local newyrail = math.floor((centery + self.yspeed*dt - 10) / 20) local newyrail = math.floor((centery + self.yspeed*dt - 10) / 20)
if (newyrail < 0) and (self.yspeed < 0) then if (newyrail < 0) and (self.yspeed < 0) then
centery = 10 centery = 10
self.yspeed = 0 self.yspeed = 0
elseif (newyrail >= 4) and (self.yspeed > 0) then elseif (newyrail >= 4) and (self.yspeed > 0) then
centery = 90 centery = 90
self.yspeed = 0 self.yspeed = 0
else else
if (self.ymove == false) and (yrail ~= newyrail) then if (self.ymove == false) and (yrail ~= newyrail) then
@ -509,14 +509,14 @@ function Character:die()
if self.life == 0 then if self.life == 0 then
self.charcontroller:die() self.charcontroller:die()
else else
self.life = self.life - 1 self.life = self.life - 1
self.view.x = self.startx self.view.x = self.startx
self.relx = 0 self.relx = 0
self.dash = false self.dash = false
self.dashCam= false self.dashCam = false
self.y = self.starty self.y = self.starty
self.z = 0 self.z = 0
self.rings = 0 self.rings = 0
end end
end end