# Need Help

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()

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

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

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

``````

Sound(SOUND_HIT,465)

465 is a number that is the pitch of the sound, they are random, use any number

Can you stick it on gist or posterous? I tried pasting from this, but formatting got mangled.

Fixed the formatting in the OP

It looks like you don’t have “end” after your last four if statements. I’ve pasted a corrected version below:

``````
function Sound()
if y == 768 then
SOUND_HIT(1,20)
end -- missing "end" here

if y == 10 then -- LINE #81
SOUND_HIT(1,20)
end -- missing "end" here

if x == 758 then
SOUND_HIT(1,20)
end -- missing "end" here

if x == 10 then
SOUND_HIT(1,20)
end -- missing "end" here
end

``````