Well i have a bit of a problem i'm basicly making a program like paint . so evrything is setup basic colors etc.
But now i ran in to some kind of trouble i want to draw to the screen multiple copies of the same color (you can't have a picture with only one red dot. i need more red dots) so i tried making an array of red dots an draw them all one per one that didn't work out i'm puzzeled i'm kinda new to this engine and it's amazing only i can't see how to overcome this problem. i uploaded the .love file on sendspace here's the link http://www.sendspace.com/file/xj9yit also here is the code ( sorry it's a bit messy
Code: Select all
local i
local volume
local cursor
local font
local colors= {"blue", "red", "yellow", "brown", "black", "white"}
local paul
local k
local red={}
local xcol=
local ycol
function love.load()
k = 1
volume = 0.0
paul = black
bgm = love.audio.newSource("/music/jazz.ogg", "stream")
love.audio.play(bgm)
cursor = love.graphics.newImage("/images/cursor.png")
love.mouse.setVisible(false)
font = love.graphics.newFont("/fonts/font.ttf", 20)
i=1
while k < 101 do
red[k] =love.graphics.newImage("/colors/red.png")
k = k+1
end
end
function riet()
function love.draw()
love.graphics.setFont(font)
local foo, boo = love.mouse.getPosition( )
love.graphics.printf(foo.." "..boo,0,70,500, "left")
love.graphics.draw(cursor,foo,boo)
love.graphics.draw(red[i],xcol[i],ycol[i])
i=i+1
end
end
function love.update(dt)
mich()
love.audio.setVolume(volume)
end
function love.draw()
love.graphics.setFont(font)
local foo, boo = love.mouse.getPosition( )
love.graphics.printf(foo.." "..boo,0,70,500, "left")
love.graphics.draw(cursor,foo,boo)
end
function mich()
function love.keypressed( key, unicode )
if key == "1" then
paul= blue
end
if key == "2" then
paul = red
end
if key == "3" then
paul= yellow
end
if key == "4" then
paul = brown
end
if key == "5" then
paul = black
end
if key == "6" then
paul = white
end
if key == "f" then
love.graphics.toggleFullscreen()
end
if key == "m" then
love.audio.stop()
end
if key == "kp+" then
volume = volume + 0.01
end
if key == "kp-" then
volume = volume -0.01
end
if volume > 1.0 then
volume = 1.0
end
if volume < 0 then
volume = 0
end
end
if love.mouse.isDown("r") then
text2= "you pressed the right mouse button"
end
if love.mouse.isDown("l") then
end
function love.mousereleased(x, y, button)
if button == "l" then
local foo, boo = love.mouse.getPosition( )
xcol=foo
ycol=boo
riet()
end
end
end