5 Commits
bglap ... main

Author SHA1 Message Date
0aeb0139d3 clock update 2021-12-27 22:23:19 +01:00
391e2ab1b7 new clock 2021-12-27 20:43:37 +01:00
3af5bbe928 fixed level jump 2021-12-27 17:37:14 +01:00
e0ac6abaef remove debug messages 2021-12-27 17:25:07 +01:00
56ffd396bc movement update and fixes 2021-12-27 17:18:47 +01:00
12 changed files with 186 additions and 104 deletions

View File

@@ -10,6 +10,4 @@ Lua game inspired by an old arcade game(Qix/Gals Panic) using LOVE2D for Linux.
- Add more pictures (manga?) - Add more pictures (manga?)
- Fix Mesh
- Fix balls sometimes attaching to the lines - Fix balls sometimes attaching to the lines

View File

@@ -37,6 +37,7 @@ if os.getenv("LOCAL_LUA_DEBUGGER_VSCODE") == "1" then
function love.load() function love.load()
love.window.setTitle('SpiderCut') love.window.setTitle('SpiderCut')
love.graphics.setDefaultFilter('nearest', 'nearest') love.graphics.setDefaultFilter('nearest', 'nearest')
love.graphics.setLineJoin( "bevel" )
math.randomseed(os.time()) math.randomseed(os.time())
push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, { push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, {
@@ -60,6 +61,10 @@ function love.keypressed(key)
love.event.quit() love.event.quit()
end end
if key == 'f' then
push:switchFullscreen()
end
love.keyboard.keysPressed[key] = true love.keyboard.keysPressed[key] = true
end end

36
src/Clock.lua Normal file
View File

@@ -0,0 +1,36 @@
Clock = Class {}
function Clock:init(timelimit, direction)
self.timeLimit = timelimit
self.direction = direction
self.color = {56 / 255, 56 / 255, 56 / 255, 1}
self.currentTime = "0"
self.timer = 0
self.startTime = self:getOsTime()
end
function Clock:update(dt)
local passed = math.floor((self:getOsTime() - self.startTime) * 10 + 0.5)
if self.direction == 'down' then
self.currentTime = tostring(self.timeLimit - passed)
else
self.currentTime = tostring(passed)
end
end
function Clock:render()
if self.currentTime * 1 <= 10 then
local a = math.abs(math.cos(love.timer.getTime() * .85 % 2 * math.pi))
love.graphics.setColor(.8, .12, .12, a)
else
love.graphics.setColor(self.color[1], self.color[2], self.color[3],
self.color[4])
end
love.graphics.setFont(gFonts['medium'])
love.graphics.printf('Time: ' .. self.currentTime, 0, 5, VIRTUAL_WIDTH,
'right')
love.graphics.setFont(gFonts['small'])
love.graphics.setColor(1, 1, 1, 1)
end
function Clock:getOsTime() return os.clock() end

View File

@@ -10,6 +10,7 @@ Timer = require 'lib/knife.timer'
require 'src/Animation' require 'src/Animation'
require 'src/constants' require 'src/constants'
require 'src/StateMachine' require 'src/StateMachine'
require 'src/Clock'
require 'src/Util' require 'src/Util'
require 'src/Level' require 'src/Level'

View File

@@ -1,24 +1,17 @@
-- require('mobdebug').start() -- require('mobdebug').start()
Level = Class {} Level = Class {}
function Level:init(stage) function Level:init(def, stage)
self.stage = stage self.stage = stage
self.points = {} self.points = {}
self.player = {} self.player = {}
self.segments = self:createLevel() self.segments = self:createLevelFromDef(def, stage)
self.polygon = self:createPolygon() self.polygon = self:createPolygon()
self.mesh = poly2mesh(self.points) self.mesh = poly2mesh(self.points)
end end
function Level:update(dt) function Level:update(dt)
-- print_r(self.points)
-- print(tostring(#self.points))
-- if self.mesh == nil and #self.points > 2 then
-- self.mesh = poly2mesh(self.points)
-- end
self.mesh = poly2mesh(self.points) self.mesh = poly2mesh(self.points)
-- print_r(self.mesh:getVertices())
end end
function Level:render() function Level:render()
@@ -38,6 +31,14 @@ function Level:renderBackground()
end end
end end
function Level:createLevelFromDef(def, stage)
local level = {}
for i, seg in pairs(def[1].segments) do
table.insert(level, Segment(seg.p1, seg.p2, seg.width, seg.face) )
end
return level
end
function Level:createLevel() function Level:createLevel()
local level = { local level = {
[1] = Segment({LEVEL_RENDER_OFFSET, LEVEL_RENDER_OFFSET_TOP}, { [1] = Segment({LEVEL_RENDER_OFFSET, LEVEL_RENDER_OFFSET_TOP}, {

View File

@@ -39,6 +39,7 @@ function Player:init(def, level )
end end
function Player:isMoveAllowed(point) function Player:isMoveAllowed(point)
point = {point[1] + self.width/2, point[2] + self.width/2}
for i,segment in pairs (self.trailSegments) do for i,segment in pairs (self.trailSegments) do
if segment:pointInSegment(point) then if segment:pointInSegment(point) then
return false return false

View File

@@ -1,10 +1,9 @@
-- require('mobdebug').start() -- require('mobdebug').start()
Segment = Class {}
Segment = Class{}
local symbols = {['up'] = 207, ['down'] = 209, ['right'] = 199, ['left'] = 182} local symbols = {['up'] = 207, ['down'] = 209, ['right'] = 199, ['left'] = 182}
function Segment:init(firstPoint, secondPoint,lineWidth, face, color) function Segment:init(firstPoint, secondPoint, lineWidth, face, color)
self.firstPointX = firstPoint[1] self.firstPointX = firstPoint[1]
self.firstPointY = firstPoint[2] self.firstPointY = firstPoint[2]
self.secondPointX = secondPoint[1] self.secondPointX = secondPoint[1]
@@ -14,15 +13,16 @@ function Segment:init(firstPoint, secondPoint,lineWidth, face, color)
self.horizontal = self.firstPointY == self.secondPointY self.horizontal = self.firstPointY == self.secondPointY
self.face = face or '' self.face = face or ''
self.direction = self:calculateDirection() self.direction = self:calculateDirection()
self.color = color or {r=255,g=255,b=255} self.color = color or {r = 255, g = 255, b = 255}
end end
function Segment:render() function Segment:render()
love.graphics.setColor(self.color.r,self.color.g, self.color.b,255) love.graphics.setColor(self.color.r, self.color.g, self.color.b, 1)
love.graphics.setLineWidth(self.lineWidth) love.graphics.setLineWidth(self.lineWidth)
love.graphics.line(self.firstPointX,self.firstPointY,self.secondPointX, self.secondPointY) love.graphics.line(self.firstPointX, self.firstPointY, self.secondPointX,
self.secondPointY)
love.graphics.setColor(255,255, 255, 255) love.graphics.setColor(1, 1, 1, 1)
-- debug -- debug
-- love.graphics.setFont(gFonts['small']) -- love.graphics.setFont(gFonts['small'])
@@ -31,14 +31,18 @@ function Segment:render()
end end
function Segment:segmentToPoints() function Segment:segmentToPoints()
return self.firstPointX, self.firstPointY, self.secondPointX, self.secondPointY return self.firstPointX, self.firstPointY, self.secondPointX,
self.secondPointY
end end
function Segment:length() function Segment:length()
return math.sqrt( (self.secondPointX - self.firstPointX) * (self.secondPointX - self.firstPointX) + (self.secondPointY - self.firstPointY) * (self.secondPointY - self.firstPointY) ) return math.sqrt((self.secondPointX - self.firstPointX) *
(self.secondPointX - self.firstPointX) +
(self.secondPointY - self.firstPointY) *
(self.secondPointY - self.firstPointY))
end end
function Segment:sideOfSegment(x,y) function Segment:sideOfSegment(x, y)
if y < self.firstPointY and y < self.secondPointY then -- above if y < self.firstPointY and y < self.secondPointY then -- above
return 'up' return 'up'
end end
@@ -55,9 +59,7 @@ function Segment:sideOfSegment(x,y)
end end
function Segment:debug(msg) function Segment:debug(msg)
if not msg then if not msg then msg = '' end
msg = ''
end
-- print("Segment:debug ".. msg .." ...............") -- print("Segment:debug ".. msg .." ...............")
-- print("FirstPoint: "..tostring(self.firstPointX)..','..tostring(self.firstPointY)) -- print("FirstPoint: "..tostring(self.firstPointX)..','..tostring(self.firstPointY))
-- print("SecondPoint: "..tostring(self.secondPointX)..','..tostring(self.secondPointY)) -- print("SecondPoint: "..tostring(self.secondPointX)..','..tostring(self.secondPointY))
@@ -72,35 +74,35 @@ function Segment:copy()
copy.secondPointY = self.secondPointY copy.secondPointY = self.secondPointY
copy.lineWidth = self.lineWidth copy.lineWidth = self.lineWidth
copy.face = self.face copy.face = self.face
return Segment({copy.firstPointX,copy.firstPointY},{copy.secondPointX,copy.secondPointY},copy.lineWidth, copy.face) return Segment({copy.firstPointX, copy.firstPointY},
{copy.secondPointX, copy.secondPointY}, copy.lineWidth,
copy.face)
end end
function Segment:endEqualsStartOf(s) function Segment:endEqualsStartOf(s)
-- segments are linked at the end of this one -- segments are linked at the end of this one
if self.secondPointX == s.firstPointX and if self.secondPointX == s.firstPointX and self.secondPointY == s.firstPointY then
self.secondPointY == s.firstPointY then
return true return true
end end
return false return false
end end
function Segment:endEqualsEndOf(s) function Segment:endEqualsEndOf(s)
-- segments are linked at the end of this one -- segments are linked at the end of this one
if self.secondPointX == s.secondPointX and self.secondPointY == s.secondPointY then if self.secondPointX == s.secondPointX and self.secondPointY ==
return true s.secondPointY then return true end
end
return false return false
end end
function Segment:startEqualsEndOf(s) function Segment:startEqualsEndOf(s)
-- segments are linked at the beginning of this one -- segments are linked at the beginning of this one
if self.firstPointX == s.secondPointX and self.firstPointY == s.secondPointY then if self.firstPointX == s.secondPointX and self.firstPointY == s.secondPointY then
return true return true
end end
return false return false
end end
function Segment:startEqualsStartOf(s) function Segment:startEqualsStartOf(s)
-- segments are linked at the beginning of this one -- segments are linked at the beginning of this one
if self.firstPointX == s.firstPointX and self.firstPointY == s.PointY then if self.firstPointX == s.firstPointX and self.firstPointY == s.PointY then
return true return true
end end
return false return false
@@ -129,27 +131,17 @@ function Segment:splitInTwoWithPoint(point) -- number
local s1, s2 = {} local s1, s2 = {}
if point > 0 then if point > 0 then
if self.vertical then if self.vertical then
s1 = Segment( s1 = Segment({self.firstPointX, self.firstPointY},
{self.firstPointX, self.firstPointY}, {self.secondPointX, point}, self.lineWidth, self.face)
{self.secondPointX, point}, s2 = Segment({self.firstPointX, point},
self.lineWidth, self.face {self.secondPointX, self.secondPointY}, self.lineWidth,
) self.face)
s2 = Segment(
{self.firstPointX, point},
{self.secondPointX,self.secondPointY},
self.lineWidth, self.face
)
else else
s1 = Segment( s1 = Segment({self.firstPointX, self.firstPointY},
{self.firstPointX, self.firstPointY}, {point, self.secondPointY}, self.lineWidth, self.face)
{point, self.secondPointY}, s2 = Segment({point, self.firstPointY},
self.lineWidth, self.face {self.secondPointX, self.secondPointY}, self.lineWidth,
) self.face)
s2 = Segment(
{point, self.firstPointY},
{self.secondPointX,self.secondPointY},
self.lineWidth, self.face
)
end end
else else
return nil, nil return nil, nil
@@ -181,16 +173,14 @@ function Segment:joinPerpendicular(s)
-- changes the self, not the parameter -- changes the self, not the parameter
if s.vertical then if s.vertical then
local sx = s.firstPointX local sx = s.firstPointX
if math.abs(self.firstPointX - sx) < if math.abs(self.firstPointX - sx) < math.abs(self.secondPointX - sx) then
math.abs(self.secondPointX - sx) then
self.firstPointX = sx self.firstPointX = sx
else else
self.secondPointX = sx self.secondPointX = sx
end end
else else
local sy = s.firstPointY local sy = s.firstPointY
if math.abs(self.firstPointY - sy) < if math.abs(self.firstPointY - sy) < math.abs(self.secondPointY - sy) then
math.abs(self.secondPointY - sy) then
self.firstPointY = sy self.firstPointY = sy
else else
self.secondPointY = sy self.secondPointY = sy
@@ -259,14 +249,14 @@ function Segment:compare(s)
return self.firstPointY - s.firstPointY return self.firstPointY - s.firstPointY
end end
else else
return (self.firstPointX + self.firstPointY + return (self.firstPointX + self.firstPointY + self.secondPointX +
self.secondPointX + self.secondPointY) - ( self.secondPointY) -
s.firstPointX + s.firstPointY + s.secondPointX (s.firstPointX + s.firstPointY + s.secondPointX +
+s.secondPointY) s.secondPointY)
end end
end end
function Segment:splitInThreeWithSegments(s1,s2) function Segment:splitInThreeWithSegments(s1, s2)
local p1, p2, p3, t = {} local p1, p2, p3, t = {}
if self.direction == 'down' or self.direction == 'right' then if self.direction == 'down' or self.direction == 'right' then
if s1:compare(s2) < 0 then if s1:compare(s2) < 0 then
@@ -286,23 +276,32 @@ function Segment:splitInThreeWithSegments(s1,s2)
end end
end end
return p1,p2,p3 return p1, p2, p3
end end
function Segment:insert(list) function Segment:insert(list) end
end
function Segment:pointInSegment(point) function Segment:pointInSegment(point)
-- remove "+ 8" and replace by sprite.width / 2
if self.direction == 'up' or self.direction == 'down' then if self.direction == 'up' or self.direction == 'down' then
if point[1] <= self.firstPointX + 1 and if point[1] <= self.firstPointX + 1 and point[1] >= self.firstPointX - 1 then
point[1] >= self.firstPointX - 1 then if self.direction == 'down' then
return true if point[2] >= self.firstPointY and point[2] <=
self.secondPointY then return true end
else
if point[2] >= self.secondPointY and point[2] <=
self.firstPointY then return true end
end
end end
else else
if point[2] <= self.firstPointY + 1 and if point[2] <= self.firstPointY + 1 and point[2] >= self.firstPointY - 1 then
point[2] >= self.firstPointY - 1 then if self.direction == 'right' then
return true if point[1] >= self.firstPointX and point[1] <=
self.secondPointX then return true end
else
if point[1] >= self.secondPointX and point[1] <=
self.firstPointX then return true end
end
end end
end end

View File

@@ -10,3 +10,5 @@ LEVEL_RENDER_OFFSET_TOP = 30
LEVEL_RENDER_OFFSET = 10 LEVEL_RENDER_OFFSET = 10
TILE_SIZE = 16 TILE_SIZE = 16
LINE_WIDTH = .5

View File

@@ -25,9 +25,9 @@ function Entity:changeState(name)
-- printChangeState to "..name) -- printChangeState to "..name)
end end
-- function Entity:isMoveAllowed(point) function Entity:isMoveAllowed(point)
-- return point.x, point.y return true
-- end end
function Entity:changeAnimation(name) function Entity:changeAnimation(name)
self.currentAnimation = self.animations[name] self.currentAnimation = self.animations[name]

View File

@@ -45,3 +45,35 @@ ENTITY_DEFS = {
} }
} }
} }
LEVELS_DEF = {
[1] = {
segments =
{
{
p1 = {LEVEL_RENDER_OFFSET, LEVEL_RENDER_OFFSET_TOP},
p2 = {VIRTUAL_WIDTH - LEVEL_RENDER_OFFSET, LEVEL_RENDER_OFFSET_TOP},
width = LINE_WIDTH,
face = 'down'
},
{
p1 = {VIRTUAL_WIDTH - LEVEL_RENDER_OFFSET, LEVEL_RENDER_OFFSET_TOP},
p2 = {VIRTUAL_WIDTH - LEVEL_RENDER_OFFSET, VIRTUAL_HEIGHT - LEVEL_RENDER_OFFSET},
width = LINE_WIDTH,
face = 'left'
},
{
p1 = {VIRTUAL_WIDTH - LEVEL_RENDER_OFFSET, VIRTUAL_HEIGHT - LEVEL_RENDER_OFFSET},
p2 = {LEVEL_RENDER_OFFSET, VIRTUAL_HEIGHT - LEVEL_RENDER_OFFSET},
width = LINE_WIDTH,
face = 'up'
},
{
p1 = {LEVEL_RENDER_OFFSET, VIRTUAL_HEIGHT - LEVEL_RENDER_OFFSET},
p2 = {LEVEL_RENDER_OFFSET, LEVEL_RENDER_OFFSET_TOP},
width= LINE_WIDTH,
face = 'right'
},
},
},
}

View File

@@ -9,9 +9,11 @@ function EntityWalkState:init(entity)
end end
function EntityWalkState:update(dt) function EntityWalkState:update(dt)
-- print("EntityWalkState - Current Position:" .. tostring(self.entity.x) .. "," .. tostring(self.entity.y))
if self.entity.direction == 'up' then if self.entity.direction == 'up' then
if self.entity:isMoveAllowed({self.entity.x, self.entity.y - self.entity.walkingSpeed * dt}) then local move = {math.floor(self.entity.x + 0.5), math.floor(self.entity.y - self.entity.walkingSpeed * dt + 0.5)}
self.entity.y = self.entity.y - self.entity.walkingSpeed * dt if self.entity:isMoveAllowed(move) then
self.entity.y = move[2]
if self.entity.y + TILE_SIZE / 2 < LEVEL_RENDER_OFFSET_TOP - 2 then if self.entity.y + TILE_SIZE / 2 < LEVEL_RENDER_OFFSET_TOP - 2 then
self.entity.y = self.entity.y + self.entity.walkingSpeed * dt self.entity.y = self.entity.y + self.entity.walkingSpeed * dt
Event.dispatch('back-to-wall') Event.dispatch('back-to-wall')
@@ -19,8 +21,9 @@ function EntityWalkState:update(dt)
end end
end end
elseif self.entity.direction == 'down' then elseif self.entity.direction == 'down' then
if self.entity:isMoveAllowed({self.entity.x, self.entity.y + self.entity.walkingSpeed * dt}) then local move = {math.floor(self.entity.x + 0.5), math.floor(self.entity.y + self.entity.walkingSpeed * dt + 0.5)}
self.entity.y = self.entity.y + self.entity.walkingSpeed * dt if self.entity:isMoveAllowed(move) then
self.entity.y = move[2]
if self.entity.y + TILE_SIZE / 2 > VIRTUAL_HEIGHT - LEVEL_RENDER_OFFSET + 2 then if self.entity.y + TILE_SIZE / 2 > VIRTUAL_HEIGHT - LEVEL_RENDER_OFFSET + 2 then
self.entity.y = self.entity.y - self.entity.walkingSpeed * dt self.entity.y = self.entity.y - self.entity.walkingSpeed * dt
Event.dispatch('back-to-wall') Event.dispatch('back-to-wall')
@@ -28,8 +31,9 @@ function EntityWalkState:update(dt)
end end
end end
elseif self.entity.direction == 'right' then elseif self.entity.direction == 'right' then
if self.entity:isMoveAllowed({self.entity.x + self.entity.walkingSpeed * dt, self.entity.y}) then local move = {math.floor(self.entity.x + self.entity.walkingSpeed * dt + 0.5), math.floor(self.entity.y + 0.5)}
self.entity.x = self.entity.x + self.entity.walkingSpeed * dt if self.entity:isMoveAllowed(move) then
self.entity.x = move[1]
if self.entity.x + TILE_SIZE / 2 > VIRTUAL_WIDTH - TILE_SIZE / 2 + 2 or self.entity.previousdirection == 'left' then if self.entity.x + TILE_SIZE / 2 > VIRTUAL_WIDTH - TILE_SIZE / 2 + 2 or self.entity.previousdirection == 'left' then
self.entity.x = self.entity.x - self.entity.walkingSpeed * dt self.entity.x = self.entity.x - self.entity.walkingSpeed * dt
Event.dispatch('back-to-wall') Event.dispatch('back-to-wall')
@@ -37,8 +41,9 @@ function EntityWalkState:update(dt)
end end
end end
elseif self.entity.direction == 'left' then elseif self.entity.direction == 'left' then
if self.entity:isMoveAllowed({self.entity.x - self.entity.walkingSpeed * dt, self.entity.y}) then local move = {math.floor(self.entity.x - self.entity.walkingSpeed * dt + 0.5),math.floor(self.entity.y + 0.5)}
self.entity.x = self.entity.x - self.entity.walkingSpeed * dt if self.entity:isMoveAllowed(move) then
self.entity.x = move[1]
if self.entity.x < 0 or self.entity.previousdirection == 'right' then if self.entity.x < 0 or self.entity.previousdirection == 'right' then
self.entity.x = self.entity.x + self.entity.walkingSpeed * dt self.entity.x = self.entity.x + self.entity.walkingSpeed * dt
Event.dispatch('back-to-wall') Event.dispatch('back-to-wall')

View File

@@ -5,12 +5,13 @@ PlayState = Class{__includes = BaseState}
function PlayState:init() function PlayState:init()
self.name = 'PlayState' self.name = 'PlayState'
self.stage = 1 self.stage = 1
self.level = Level(self.stage) self.level = Level(LEVELS_DEF, self.stage)
self.player = Player ( ENTITY_DEFS['player'] , self.level) self.player = Player ( ENTITY_DEFS['player'] , self.level)
self.level.player = self.player self.level.player = self.player
self.balls = {} self.balls = {}
self:createBalls() self:createBalls()
self.level.balls = self.balls self.level.balls = self.balls
self.clock = Clock(30,"down")
gSounds['music']:setLooping(true) gSounds['music']:setLooping(true)
gSounds['music']:play() gSounds['music']:play()
@@ -23,6 +24,7 @@ end
function PlayState:update(dt) function PlayState:update(dt)
self.level:update(dt) self.level:update(dt)
self.player:update(dt) self.player:update(dt)
self.clock:update(dt)
self:updateBalls(dt, self.level) self:updateBalls(dt, self.level)
self:checkEndLevel(self.level) self:checkEndLevel(self.level)
end end
@@ -39,6 +41,7 @@ function PlayState:render()
love.graphics.printf('Stage '..tostring(self.stage), love.graphics.printf('Stage '..tostring(self.stage),
0, 5, VIRTUAL_WIDTH, 'center') 0, 5, VIRTUAL_WIDTH, 'center')
self.clock:render()
self.level:render() self.level:render()
self.player:render() self.player:render()
self:renderBalls(dt) self:renderBalls(dt)
@@ -71,15 +74,6 @@ function PlayState:updateBalls(dt, level)
end end
end end
if #self.balls <= 0 then
-- game over - reset level
self:gameOver()
end
-- check perimeter of level, if low enough, create new level move on to the next stage
if level:getPerimeter() < 500 then
self:nextStage()
end
end end
function PlayState:checkEndLevel (level) function PlayState:checkEndLevel (level)
@@ -92,6 +86,13 @@ function PlayState:checkEndLevel (level)
if level:getPerimeter() < 500 then if level:getPerimeter() < 500 then
self:nextStage() self:nextStage()
end end
-- check if clock finished counting limit time
if self.clock.direction == 'up' and self.clock.currentTime * 1 > self.clock.timeLimit then
self:gameOver()
elseif self.clock.direction == 'down' and self.clock.currentTime * 1 <= 0 then
self:gameOver()
end
end end
function PlayState:renderBalls(dt) function PlayState:renderBalls(dt)
@@ -110,7 +111,8 @@ function PlayState:nextStage()
gStateStack:push(FadeOutState({ gStateStack:push(FadeOutState({
r = 255/255, g = 255/255, b = 255/255}, 1,function() r = 255/255, g = 255/255, b = 255/255}, 1,function()
self.stage = self.stage + 1 self.stage = self.stage + 1
self.level = Level(self.stage) self.level = Level(LEVELS_DEF,self.stage)
self.clock = Clock(self.clock.timeLimit + 3 * #self.balls,"down")
self.player:reset() self.player:reset()
self.player.score = self.player.score + self.player.multiplier * #self.balls self.player.score = self.player.score + self.player.multiplier * #self.balls
self.player.multiplier = self.player.multiplier + #self.balls self.player.multiplier = self.player.multiplier + #self.balls