How keep codea happy?

Hi, guys. Sorry for noob questions from me, but whats wrong in this piece of code?

Fishes = class()

function Fishes:init()
    -- you can accept and set parameters here
    self.fish = physics.body(CIRCLE,20)
    self.fish.x = 100
    self.fish.y = 0
end

function Fishes:draw()
   ellipse(self.fish.x,self.fish.y,40) -- this string makes codea unhappy
end

function Fishes:touched(touch)
    -- Codea does not automatically call this method
end

I expect codea dont like this values : “self.fish.x and self.fish.x”

http://s28.postimg.org/xjccmfpd9/IMG_0073.png

works fine for me
i assume you wrote

    f.draw()

instead of

    f:draw()

@Jvm38 Im foregin and sometimes i understand your advices like slowpoke,but what you mean?

do you see the '.' instead of ':'

i suppose you made a typo mistake when calling the draw().
This is very common when you begin with lua…

@Jvm38 no. I understand this. But problem in something else

then post the whole code, what you have posted works fine.

btw, what do you mean ‘makes codea unhappy’? can you post the error text?

PS: sorry for my short answers, i hope you dont feel this as rudeness. I just try to be quick and concise.

@Jvm38


--# Main
-- Kraken
-- Use this function to perform your initial setup
displayMode(FULLSCREEN)
function setup()
    
    w = WIDTH/2
    h = HEIGHT/2
    xb = w
    xs = h
    xch = 270
    xch = xch + 1
    count = 1
    
    floor = physics.body(EDGE,vec2(-WIDTH,0),vec2(WIDTH,0))
    physics.pause()
    
    grav = physics.gravity(Gravity)
    ship = physics.body(CIRCLE,89)
    ship.y = h+199
    ship.restitution = 1
    
    
    
end
function touched(touch)
    if touch.state == ENDED then
        physics.resume()
    end

end

function outofscreen()
    
        if xb > w then
        xb = 0
        count = count + 1
        elseif xb < w then
        xb = 0
        end
       if xs > w then
        xs = -20
       end
    
end


function draw()  
    xch = xch + 1
 --   if touch.state == ENDED then
--    ship.y = grav.y
    
    
 --   end
    pushStyle()
    sprite("Documents:backgroundblur",w,h)
    sprite("Documents:waveback",w-200,h+300)
    sprite("Documents:waveback",w+250,h+300)
    sprite("Documents:ship(vlad dont like this)",xch,ship.y,270,178)
    sprite("Documents:wavefrontbig",w,h+280)
   -- sprite("Documents:wavefront",w+440,h+290)
    popStyle()
    Fishes:draw()
    
end


--# Fishes
Fishes = class()

function Fishes:init()
    -- you can accept and set parameters here
    self.fish = physics.body(CIRCLE,20)
    self.fish.x = 100
    self.fish.y = 0
end

function Fishes:draw()
   ellipse(self.fish.x,self.fish.y,40)
end

function Fishes:touched(touch)
    -- Codea does not automatically call this method
end

this makes no sense:

draw()
    Fishes:draw()
end

Fishes is a class, not an instance of the class, you must create and draw one sample fish1 or more:


--# Main
-- Kraken
-- Use this function to perform your initial setup
displayMode(FULLSCREEN)
function setup()

    w = WIDTH/2
    h = HEIGHT/2
    xb = w
    xs = h
    xch = 270
    xch = xch + 1
    count = 1

    floor = physics.body(EDGE,vec2(-WIDTH,0),vec2(WIDTH,0))
    physics.pause()

    grav = physics.gravity(Gravity)
    ship = physics.body(CIRCLE,89)
    ship.y = h+199
    ship.restitution = 1

    fish1 = Fishes()

end
function touched(touch)
    if touch.state == ENDED then
        physics.resume()
    end

end

function outofscreen()

        if xb > w then
        xb = 0
        count = count + 1
        elseif xb < w then
        xb = 0
        end
       if xs > w then
        xs = -20
       end

end


function draw()  
    xch = xch + 1
 --   if touch.state == ENDED then
--    ship.y = grav.y


 --   end
    pushStyle()
    sprite("Documents:backgroundblur",w,h)
    sprite("Documents:waveback",w-200,h+300)
    sprite("Documents:waveback",w+250,h+300)
    sprite("Documents:ship(vlad dont like this)",xch,ship.y,270,178)
    sprite("Documents:wavefrontbig",w,h+280)
   -- sprite("Documents:wavefront",w+440,h+290)
    popStyle()
    fish1:draw()

end


--# Fishes
Fishes = class()

function Fishes:init()
    -- you can accept and set parameters here
    self.fish = physics.body(CIRCLE,20)
    self.fish.x = 100
    self.fish.y = 0
end

function Fishes:draw()
   ellipse(self.fish.x,self.fish.y,40)
end

function Fishes:touched(touch)
    -- Codea does not automatically call this method
end

@Jvm38 thank you very much