/
alex_baut11
/
lua-container-game
Обзор
Документация
Войти
/
alex_baut11
/
lua-container-game
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
player.lua
64 строки
2 KB
AlexB
sm
29 дек 2025, 11:46
29 дек 2025, 11:46
d4f82fb
Код
Авторство
О чём код?
Player = {} Player.__index = Player function Player:new() local obj = { money = 100.00, inventory = {}, drawitems=true, -- price_tario=1, --к продажи вещей -- trade_ratio=0.1, --к покупки локи curr_cont_rarity=1, -- luck=0.6 --удача:влияет на кол-во лута -- price_ratio = {cidx=1, all={ {1, 0}, {1.20, 250}, {1.33, 320}, {1.5, 560}, {1.75, 700}, {2, 2700}, {2.89, 12000}}}, trade_ratio = {cidx=1, all={ {0.1, 0}, {0.15, 300}, {0.18, 400}, {0.22, 800}, {0.25, 1500}, {0.3, 4850}, {0.33, 27000}}}, -- luck = {cidx=1, all={ {0.6, 0}, {0.61, 250}, {0.63, 400}, {0.65, 555}, {0.66, 900}, {0.7, 5000}, {0.72, 5001}, {0.78, 7770}}} } setmetatable(obj, Player) return obj end function Player:draw() love.graphics.setFont(font) love.graphics.setColor(1, 1, 1, 1) love.graphics.print(self.money.." USD", 10, 10) if self.drawitems then love.graphics.setFont(small_font) for i,el in ipairs(self.inventory) do love.graphics.draw(el.sprite, 10, 30 + i * 20, 0, 1.5, 1.5) love.graphics.print(el.name, 30, 30 + i * 20) end end end function Player:update(dt) end return Player