I can't get this to work at all

So I thought I was getting the hang and understanding a little now I can’t do crap from new project I’m getting really frustrated I can’t get anything to show up on screen when I run. I’m trying to simply creat two circles and have them rotate around each other.

Circle one rotate around circle two when you tap the screen they switch cir 2 rotates around cir 1. Here is my code so far

Main class:

function setup()
    
    function createCircle(x,y,r)
    local circle = physics.body(CIRCLE, r)
    -- enable smooth motion
    circle.interpolate = true
    circle.x = x
    circle.y = y
    circle.restitution = 25
    circle.sleepingAllowed = false
    return circle
    end
end

```


Then circle class:

Circle = class()

function Circle:init(x, y, size)
    -- you can accept and set parameters here
    self.x = WIDTH/2
    self.y = HEIGHT/2
    self.size = 25
end

function Circle:draw()
    pushStyle()
    
    fill(180,10,30)
    
    ellipse(self.x, self.y, self.size)
    
    popStyle()
end
    -- Codea does not automatically call this method

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

```


Please help what am I doing wrong lol

It will greatly help ppl copy ur code if u put – in front of your notes and put it between a pair of fences. Fences look like:

~~~

--Code Here

~~~

where in main do you call the Circle class?
And you know the create circle function doesnt run itself.
Just a sec fixing up your code

.@DeanC1985 your circle class is good but you need to call it from your main program to initialise and draw it. Getting the circles to rotate round each other was a bit tricky but the following should work. I included a basic tap control and the option for you to modify to anticlockwise rotation if you wish


--# Circle
Circle = class()

function Circle:init(x,y,r,state)
    -- you can accept and set parameters here
    self.x = x
    self.y=y
    self.size=r
    self.state=state
    self.rotspeed=0.02
end

function Circle:draw(p)
    self.p=p
    ellipse(self.x,self.y,self.size)
    local dist=math.sqrt(((self.x-self.p.x)^2)+((self.y-self.p.y)^2))
    local angle=math.atan2((self.x-self.p.x),(self.y-self.p.y))    
    if self.state==CLOCKWISE then
        self.x = self.p.x + dist*math.sin(angle+self.rotspeed)         
        self.y = self.p.y + dist*math.cos(angle+self.rotspeed)
    end
    
end

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

And


--# Main
-- circle demo

-- Use this function to perform your initial setup
function setup()
    STATIONARY=0
    CLOCKWISE=1
    ANTICLOCKWISE=2
    c1=Circle(WIDTH/2,HEIGHT/2,50,STATIONARY)
    c2=Circle(WIDTH/4,HEIGHT/2,50,CLOCKWISE)
    timer=0
    touches={}
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(40, 40, 50)

c1:draw(c2)
c2:draw(c1)

    for k,touch in pairs(touches) do
        -- Use the touch id as the random seed
        
        if (math.abs(touch.x-c1.x)<20 and math.abs(touch.y-c1.y)) or (math.abs(touch.x-c2.x)<20 and math.abs(touch.y-c2.y)) then
            
            if c2.state==STATIONARY then
                c2.state=CLOCKWISE
                c1.state=STATIONARY
            else
                c1.state=CLOCKWISE
                c2.state=STATIONARY
            end
                    touches[k] = nil
        end

    end




end

function touched(touch)
    if touch.state == ENDED then
        touches[touch.id] = nil
    else
        touches[touch.id] = touch
    end
end