Thanks in regards!

Code: Select all
function love.update()
if love.keyboard.isDown("right") then
player.x = player.x + 1
if love.keyboard.isDown("left") then
player.x = player.x - 1
end
end
end
Code: Select all
function love.update()
if love.keyboard.isDown("right") then
player.x = player.x + 1
end
if love.keyboard.isDown("left") then
player.x = player.x - 1
end
end
Code: Select all
function a()
function b()
function c()
end
end
end
Code: Select all
if condition 1 then
do stuff 1
if condition 2 then
do stuff 2
if condition 3 then
do stuff 3
end
end
end
Code: Select all
if condition 1 then
do stuff 1
if condition 2 then
do stuff 2
if condition 3 then
do stuff 3
end
end
end
Code: Select all
if condition1 then
do stuff 1
end
if condition2 then
do stuff 2
end
if condition 3 then
do stuff 3
end
Code: Select all
local FirstSong
local ghetto, person
local objects
local plrx, plry
function love.load()
FirstSong = love.audio.newSource("AllStar.mp3")
FirstSong:setVolume(0.2)
FirstSong:setPitch(1)
FirstSong:play()
ghetto = love.graphics.newImage("TestMap.PNG")
person = love.graphics.newImage("Confederate.PNG")
-- No need for sorting, since this already is sorted according to the second value.
objects = {}
objects[1] = {550,370}
objects[2] = {220,390}
plrx = 200 --love.graphics.getWidth() / 2
plry = 200 --love.graphics.getHeight() / 2
speed = 300
end
function love.update(dt)
if love.keyboard.isDown("right") then
plrx = plrx + (speed * dt)
elseif love.keyboard.isDown("left") then
plrx = plrx - (speed * dt)
end
if love.keyboard.isDown("down") then
plry = plry + (speed * dt)
elseif love.keyboard.isDown("up") then
plry = yplry - (speed * dt)
end
end
function love.draw()
-- You need to draw an image giving the top left to the function.
love.graphics.draw(ghetto, 0, 0)
--for i,v in ipairs(objects) do
-- nothing here...?
--end
--if not drawn then -- if the person is below all objects it won't be drawn within the for loop <- that's not how things work.
-- love.graphics.draw(person, character[1] - person:getWidth()/2, character[2] - person:getHeight())
--end
love.graphics.draw(person, plrx, plry, dt)
end
Users browsing this forum: Amazon [Bot] and 3 guests