WIP: new-cbs #117

Closed
kazhnuz wants to merge 23 commits from new-cbs into master
4 changed files with 36 additions and 6 deletions
Showing only changes of commit 5368b94f88 - Show all commits

View file

@ -3,8 +3,10 @@ local PlayerMovement = Object:extend()
local SPEED = 160
function PlayerMovement:initMovements()
if (not self:isAerial()) then
self:setGravity(480 * 2)
end
end
function PlayerMovement:updateMovements()
self:setFrc()
@ -41,4 +43,12 @@ function PlayerMovement:isNotJumping()
return self.onGround
end
function PlayerMovement:getStartZ()
if (self:isAerial()) then
return 16
else
return 0
end
end
return PlayerMovement

View file

@ -5,11 +5,18 @@ function FighterSprite:changeSprite(name)
self.assets:addSprite(name, self:getSpritePath(name))
end
self.assets.sprites[name]:setCustomSpeed(16)
self:setSprite(name, true, 8, 10)
local ox, oy = self:getOrigin()
self:setSprite(name, true, ox, oy)
self:changeAnimation("idle")
self:setDirection(self.direction or self.defaultDir)
end
function FighterSprite:getOrigin()
local _, _, d = self:getFighterHitbox()
return 8, (d - 14)
end
function FighterSprite:updateSprites(dt)
self.sprite:setCustomSpeed(self:getCustomSpeed())
self:setDirection(self.xsp)

View file

@ -0,0 +1,15 @@
local PlayerHitboxes = Object:extend()
function PlayerHitboxes:getAbstract()
return game.characters.list[game.characters:getActiveCharacter()]
end
function PlayerHitboxes:getFighterHitbox()
return 16, 12, 24
end
function PlayerHitboxes:isAerial()
return false
end
return PlayerHitboxes

View file

@ -4,6 +4,7 @@ local Player = Parent:extend()
local Score = require "game.modules.subgames.world.actors.fighters.player.score"
local Sprites = require "game.modules.subgames.world.actors.fighters.player.sprites"
local Controls = require "game.modules.subgames.world.actors.fighters.player.controls"
local Identity = require "game.modules.subgames.world.actors.fighters.player.identity"
local Team = require "scenes.overworld.actors.player.team"
@ -11,6 +12,7 @@ Player:implement(Score)
Player:implement(Sprites)
Player:implement(Team)
Player:implement(Controls)
Player:implement(Identity)
function Player:new(world, x, y, z, id)
self.defaultDir = 1
@ -20,10 +22,6 @@ function Player:new(world, x, y, z, id)
self:initTeam()
end
function Player:getAbstract()
return game.characters.list[game.characters:getActiveCharacter()]
end
function Player:updateStart(dt)
self:applyInputs()
end