I’m mostly new to the once called codify but now Codea and I made this bit of code that Makes a ovel with a shadow bounce around the screen. I got it too work but then one day it didn’t and it said there was a problem with line 81 Here’s a copy of what I have.
MOVE_RIGHT = 1
MOVE_LEFT = 2
MOVE_UP = 3
MOVE_DOWN = 4
-- Use this function to perform your initial setup
function setup()
print("Hello World!")
xdir = MOVE_LEFT
ydir = MOVE_UP
x = WIDTH/2
xl = x
y = HEIGHT/2
end
-- This function gets called once every frame
function draw()
adjustx()
adjusty()
background(255, 43, 0, 255)
-- put shadow drawn first - things you want far away draw them first
fill(0, 0, 0, 255)
ellipse( xl, y - 5, 100, 20)
fill(43, 60, 222, 255)
ellipse( x, y, 100, 20)
end
-- Calc a new value for x
function adjustx()
if x > 758 then
xdir = MOVE_LEFT
end
if x < 10 then
xdir = MOVE_RIGHT
end
xl = x
if xdir == MOVE_LEFT then
x = x - 6
end
if xdir == MOVE_RIGHT then
x = x + 6
end
end
--Changes y as needed
function adjusty()
if y > 768 then
ydir = MOVE_DOWN
end
if y < 10 then
ydir = MOVE_UP
end
if ydir == MOVE_DOWN then
y = y - 5
end
if ydir == MOVE_UP then
y = y + 5
end
function Sound()
if y == 768 then
SOUND_HIT(1,20)
(NOT PART OF CODE Line # 81) if y == 10 then
SOUND_HIT(1,20)
if x == 758 then
SOUND_HIT(1,20)
if x == 10 then
SOUND_HIT(1,20)
end
end