Code: Select all
objects = {
object1 = {
type = circle,
sprite = images.circle1,
x = math.random(50,350),
y = math.random(50,350),
s = math.random(50,150)/100},
object2 = {
type = circle,
sprite = images.circle2,
x = math.random(50,350),
y = math.random(50,350),
s = math.random(50,150)/100},
object3 = {
type = box,
sprite = images.box3,
x = math.random(50,350),
y = math.random(50,350),
s = math.random(50,150)/100},
object4 = {
type = box,
sprite = images.box4,
x = math.random(50,350),
y = math.random(50,350),
s = math.random(50,150)/100},
}
for i = 1,4 do
if math.random(1,10) <= 5 then
objects.object[i].type = circle
else
objects.object[i].type = box
end
end
for i = 1,4 do
if objects.object[i].type == circle
then
if math.random(1,10) <= 5 then
objects.object[i].sprite = images.circle1
else
objects.object[i].sprite = images.circle2
end
else
if math.random(1,10) <= 5 then
objects.object[i].sprite = images.box3
else
objects.object[i].sprite = images.box4
end
end
end
for i = 1,4 do
if objects.object[i].sprite == images.circle1 then
objects.object[i].r = 78*objects.box[i].s
end
end
for i = 1,4 do
if objects.object[i].sprite == images.circle2 then
objects.object[i].r = 57*objects.box[i].s
end
end
for i = 1,4 do
if objects.object[i].sprite == images.box3 then
objects.object[i].w = 100*objects.object[i].s
objects.object[i].h = 100*objects.object[i].s
end
end
for i = 1,4 do
if objects.object[i].sprite == images.box4 then
objects.object[i].w = 140*objects.object[i].s
objects.object[i].h = 70*objects.object[i].s
end
end