CAN YOU HELP ME PLEASE ?? It does not work!!!
Posted: Wed Mar 20, 2013 5:20 pm
function love.load ()
rectangle1 = { x = math.random (0,750) , y = 400, breite = 50 , hoehe = 75}
rectangle2 = { x =math.random (0,750) , y = 200, breite = 100, hoehe = 50}
rectangle3 = { x = math.random (0,750) , y = 10 , breite = 75 , hoehe = 88 }
rectangle4 = { x = math.random (0,750) , y = 522 , breite = 64 , hoehe = 46 }
rectangle5 = { x = math.random (0,750) , y = 300 , breite = 64 , hoehe = 46 }
rectangle6 = { x = math.random (0,750) , y = 355 , breite = 64 , hoehe = 46 }
rectangleList = { rectangle1 ,rectangle2, rectangle3 , rectangle4,rectangle5,rectangle6}
end
function love.draw()
drawRectangleOne()
drawRectangleTwo()
drawRectangleThree()
drawRectangleFour()
drawRectangleFive()
drawRectangleSix()
end
function drawRectangleOne()
love.graphics.setColor(0,255,0)
for index,meinRechteck in ipairs (rectangleList) do
love.graphics.rectangle("fill",rectangle1.x,rectangle1.y,rectangle1.breite,rectangle1.hoehe)
end
end
function drawRectangleTwo()
love.graphics.setColor(0,255,0)
for index,meinRechteck in ipairs (rectangleList) do
love.graphics.rectangle("fill",rectangle2.x,rectangle2.y,rectangle2.breite,rectangle2.hoehe)
end
end
function drawRectangleThree()
love.graphics.setColor(0,255,0)
for index,meinRechteck in ipairs (rectangleList) do
love.graphics.rectangle("fill",rectangle3.x,rectangle3.y,rectangle3.breite,rectangle3.hoehe)
end
end
function drawRectangleFour()
love.graphics.setColor(0,255,0)
for index,meinRechteck in ipairs (rectangleList) do
love.graphics.rectangle("fill",rectangle4.x,rectangle4.y,rectangle4.breite,rectangle4.hoehe)
end
end
function drawRectangleFive()
love.graphics.setColor(0,255,0)
for index,meinRechteck in ipairs (rectangleList) do
love.graphics.rectangle("fill",rectangle5.x,rectangle5.y,rectangle5.breite,rectangle5.hoehe)
end
end
function drawRectangleSix()
love.graphics.setColor(0,255,0)
for index,meinRechteck in ipairs (rectangleList) do
love.graphics.rectangle("fill",rectangle6.x,rectangle6.y,rectangle6.breite,rectangle6.hoehe)
end
end
function love.mousepressed(x, y, button)
if button == "l" then
for i, v in ipairs(rectangleList ) do
if v.x <= rectangle1.x and rectangle1.x <= v.x and v.y <= rectangle1.y and rectangle1.y <= v.y and
v.x <= rectangle2.x and rectangle.x <= v.x and v.y <= rectangle2.y and rectangle2.y <= v.y and
v.x <= rectangle3.x and rectangle3.x <= v.x and v.y <= rectangle3.y and rectangle3.y <= v.y and
v.x <= rechteck4.x and rectangle4.x <= v.x and v.y <= rectangle4.y and rectangle4.y <= v.y and
v.x <= rechteck5.x and rectangle5.x <= v.x and v.y <= rectangle5.y and rectangle5.y <= v.y and
v.x <= rechteck6.x and rectangle6.x <= v.x and v.y <= rectangle6.y and rectangle6.y <= v.y
then
table.remove(rectangleListe,i)
end
end
end
end
function love.update(dt)
for index,meinRechteck in ipairs (rectangleList) do
rectangle1.y = rectangle1.y + math.random(-3,3)
rectangle1.x = rectangle1.x + math.random(-3,3)
rectangle2.y = rectangle2.y + math.random(-3,3)
rectangle2.x = rectangle2.x + math.random(-3,3)
rectangle3.y = rectangle3.y + math.random(-3,3)
rectangle3.x = rectangle3.x + math.random(-3,3)
rectangle4.y = rectangle4.y + math.random(-3,3)
rectangle4.x = rectangle4.x + math.random(-3,3)
rectangle5.y = rectangle5.y + math.random(-3,3)
rectangle5.x = rectangle5.x + math.random(-3,3)
rectangle6.y = rectangle6.y + math.random(-3,3)
rectangle6.x = rectangle6.x + math.random(-3,3)
end
end
rectangle1 = { x = math.random (0,750) , y = 400, breite = 50 , hoehe = 75}
rectangle2 = { x =math.random (0,750) , y = 200, breite = 100, hoehe = 50}
rectangle3 = { x = math.random (0,750) , y = 10 , breite = 75 , hoehe = 88 }
rectangle4 = { x = math.random (0,750) , y = 522 , breite = 64 , hoehe = 46 }
rectangle5 = { x = math.random (0,750) , y = 300 , breite = 64 , hoehe = 46 }
rectangle6 = { x = math.random (0,750) , y = 355 , breite = 64 , hoehe = 46 }
rectangleList = { rectangle1 ,rectangle2, rectangle3 , rectangle4,rectangle5,rectangle6}
end
function love.draw()
drawRectangleOne()
drawRectangleTwo()
drawRectangleThree()
drawRectangleFour()
drawRectangleFive()
drawRectangleSix()
end
function drawRectangleOne()
love.graphics.setColor(0,255,0)
for index,meinRechteck in ipairs (rectangleList) do
love.graphics.rectangle("fill",rectangle1.x,rectangle1.y,rectangle1.breite,rectangle1.hoehe)
end
end
function drawRectangleTwo()
love.graphics.setColor(0,255,0)
for index,meinRechteck in ipairs (rectangleList) do
love.graphics.rectangle("fill",rectangle2.x,rectangle2.y,rectangle2.breite,rectangle2.hoehe)
end
end
function drawRectangleThree()
love.graphics.setColor(0,255,0)
for index,meinRechteck in ipairs (rectangleList) do
love.graphics.rectangle("fill",rectangle3.x,rectangle3.y,rectangle3.breite,rectangle3.hoehe)
end
end
function drawRectangleFour()
love.graphics.setColor(0,255,0)
for index,meinRechteck in ipairs (rectangleList) do
love.graphics.rectangle("fill",rectangle4.x,rectangle4.y,rectangle4.breite,rectangle4.hoehe)
end
end
function drawRectangleFive()
love.graphics.setColor(0,255,0)
for index,meinRechteck in ipairs (rectangleList) do
love.graphics.rectangle("fill",rectangle5.x,rectangle5.y,rectangle5.breite,rectangle5.hoehe)
end
end
function drawRectangleSix()
love.graphics.setColor(0,255,0)
for index,meinRechteck in ipairs (rectangleList) do
love.graphics.rectangle("fill",rectangle6.x,rectangle6.y,rectangle6.breite,rectangle6.hoehe)
end
end
function love.mousepressed(x, y, button)
if button == "l" then
for i, v in ipairs(rectangleList ) do
if v.x <= rectangle1.x and rectangle1.x <= v.x and v.y <= rectangle1.y and rectangle1.y <= v.y and
v.x <= rectangle2.x and rectangle.x <= v.x and v.y <= rectangle2.y and rectangle2.y <= v.y and
v.x <= rectangle3.x and rectangle3.x <= v.x and v.y <= rectangle3.y and rectangle3.y <= v.y and
v.x <= rechteck4.x and rectangle4.x <= v.x and v.y <= rectangle4.y and rectangle4.y <= v.y and
v.x <= rechteck5.x and rectangle5.x <= v.x and v.y <= rectangle5.y and rectangle5.y <= v.y and
v.x <= rechteck6.x and rectangle6.x <= v.x and v.y <= rectangle6.y and rectangle6.y <= v.y
then
table.remove(rectangleListe,i)
end
end
end
end
function love.update(dt)
for index,meinRechteck in ipairs (rectangleList) do
rectangle1.y = rectangle1.y + math.random(-3,3)
rectangle1.x = rectangle1.x + math.random(-3,3)
rectangle2.y = rectangle2.y + math.random(-3,3)
rectangle2.x = rectangle2.x + math.random(-3,3)
rectangle3.y = rectangle3.y + math.random(-3,3)
rectangle3.x = rectangle3.x + math.random(-3,3)
rectangle4.y = rectangle4.y + math.random(-3,3)
rectangle4.x = rectangle4.x + math.random(-3,3)
rectangle5.y = rectangle5.y + math.random(-3,3)
rectangle5.x = rectangle5.x + math.random(-3,3)
rectangle6.y = rectangle6.y + math.random(-3,3)
rectangle6.x = rectangle6.x + math.random(-3,3)
end
end