Instructions:
1.Tap the screen and then move around finger
2. ENJOY!
--# Main
-- Game
-- Use this function to perform your initial setup
function setup()
print("Hello World!")
object1 = {}
timer=0
end
-- This function gets called once every frame
function draw()
background(0, 0, 0, 255)
for i, o in pairs(object1) do
o:draw() -- loop through your objects table and draw
end
-- Do your drawing here
end
function touched(t)
if t.state==MOVING
then
table.insert(object1,Object1(CurrentTouch.x,CurrentTouch.y))
end
end
--# Object1
Object1 = class()
function Object1:init()
-- you can accept and set parameters here
self.x = x
self.y = y
timer=0
colors={
color(0, 21, 255, 255),
color(255, 0, 201, 255),
color(110, 255, 0, 255),
color(0, 208, 255, 255),
color(255, 242, 0, 255),
color(255, 47, 0, 255),
color(0, 255, 146, 255)}
mycolor = colors[math.random(#colors)]
end
function Object1:draw()
timer=timer+1
if timer==200
then
mycolor = colors[math.random(#colors)]
end
fill(mycolor)
rect(CurrentTouch.x,CurrentTouch.y,100,100)
-- Codea does not automatically call this method
end
function Object1:touched(touch)
-- Codea does not automatically call this method
end