local items = {
"Gold bar",
"Dagger of the forest",
"Spirit Lock",
"Book of knowledge",
"Balloon dog",
"Tomato",
"Garbage bag",
"Digested gum",
"Lint Chunk",
"Potion of Strength",
"Walmart Shopping Cart"
}
local menu = love.audio.newSource("menu.mp3", "stream")
local ksong = love.audio.newSource("kenti village.mp3", "stream")
local swoovo = love.audio.newSource("swoovo.mp3", "stream")
local fsong = love.audio.newSource("peak's forest.mp3", "stream")
local inventory = {}
local coins = 0
local level = 1
local digit1 = 0
local digit2 = 0
local btforest = nil
local btkenti = false
local cttmarie = true
local zone = swoovo
swoovoday = love.graphics.newImage("swoovoback1.png")
swoovonight = love.graphics.newImage("swoovonight.png")
function background(image)
local scaleX = 200/image:getWidth() -- 200 and 100 from rectangle width and height
local scaleY = 100/image:getHeight() -- e.g. 100/200 -> scales by 0.5
love.graphics.draw(image, 0,0, 0, scaleX, scaleY)
end
function wait(seconds)
love.timer.sleep(seconds)
end
local function p(txt, x, y)
love.graphics.print(txt, x, y)
end
menu:play()
background(swoovoday)
p("Welcome to goofy tading", 250, 250)
wait(1)
-- note: you'll only need a single instance of love.draw.
-- Declaring another one will have one overwrite the other.
function love.draw ()
background(swoovoday)
p("Welcome to goofy tading", 250, 250)
end
Do note that in love2d, you don't want to call a wait function or equivalent while drawing your graphics, because this will halt the rendering (and rest of program execution) until that wait finishes. Such pausing can lead to erratic behavior, or even the application hanging up.
function background(image)
-- if we're always going to draw the image at half-height, we don't need to call image:getWidth/Height.
-- Instead, we can just plug in the desired scale factor directly.
love.graphics.draw(image, 0,0, 0, 1.0, 0.5)
end
I would also look at the wiki and the listed callback functions, to understand how löve expects you to set things up: https://love2d.org/wiki/love#Callbacks
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.