Shoutout to @Bee

Waaaaazzuuuuup


--bee
function setup()
    iparameter("size",1,25,5)
    iparameter("flying",0,1,0)
    b = Bee(WIDTH/2,HEIGHT/2,size)
end

function draw()
    rect(0,0,10,10)
    b.size = size
    if flying == 1 then b.flying = true else b.flying = false end
    background(37, 103, 36, 255)    
    b:draw()    
end

Bee = class()

function Bee:init(x,y,size)
    self.x = x
    self.y = y
    self.r = 0
    self.up = true
    self.wr = 0
    self.p = false
    self.pc = 0
    self.size = size
    self.flying = false
end

function Bee:draw()
    self:drawBody()
    if self.flying then self:drawWing(20) else self:Landed() end
end

function Bee:Landed()
    if self.p then
        self:drawWing(20)
        self.pc = self.pc + 1
        if self.pc > 12 then self.p = false end
    elseif math.random(100) < 2 then
        self:drawWing(0)
        self.p = true
        self.pc = 0
    else
        self:drawWing(0)
    end    
end

function Bee:drawWing(s)
    if self.up then
        self.wr = self.wr + s
        if self.wr > 45 then self.up = false end
    else
        self.wr = self.wr - s
        if self.wr < -15 then self.up = true end
    end
    fill(255, 255, 255, 135)
    strokeWidth(1)
    local ss13 = (self.size*13.2)
    local ss6 = (self.size*6.6)
    self:lrellipse(self.x-(self.size*8.4),self.y,(self.size*17.6),(self.size*8.6),self.wr)
    self:lrellipse(self.x-(self.size*6.4),self.y,ss13,ss6,self.wr-math.abs(self.wr/2))
    self:lrellipse(self.x-(self.size*6.4),self.y,ss13,ss6,-self.wr+180+math.abs(self.wr/2))
    self:lrellipse(self.x-(self.size*8.4),self.y,(self.size*17.6),(self.size*8.6),-self.wr+180)
end

function Bee:lrellipse(x,y,w,h,r)
    pushMatrix()
    ellipseMode(CENTER)
    translate(x+h,y)
    rotate(r)
    translate(-x-h,-y)
    ellipse(x,y,w,h)
    popMatrix()
end

function Bee:drawBody()
    stroke(0, 0, 0, 255)
    fill(0, 0, 0, 255) --eyes & legs
    strokeWidth((self.size*1.2))
    line(self.x,self.y,self.x+(self.size*10),self.y+(self.size*5))
    line(self.x,self.y,self.x-(self.size*10),self.y+(self.size*5))
    line(self.x,self.y,self.x+(self.size*10),self.y-(self.size*5))
    line(self.x,self.y,self.x-(self.size*10),self.y-(self.size*5))
    line(self.x,self.y,self.x+(self.size*10),self.y-(self.size*10))
    line(self.x,self.y,self.x-(self.size*10),self.y-(self.size*10))
    strokeWidth(0)
    ellipse(self.x-(self.size*3),self.y+(self.size*6),(self.size*5),(self.size*5))
    ellipse(self.x+(self.size*3),self.y+(self.size*6),(self.size*5),(self.size*5))
    fill(55, 54, 28, 255) --head
    ellipse(self.x,self.y+(self.size*5),(self.size*8),(self.size*6))
    strokeWidth((self.size*1.2))
    stroke(123, 132, 38, 255) --atenna 
    line(self.x-(self.size*2),self.y+(self.size*7),self.x-(self.size*6),self.y+(self.size*12)) 
    line(self.x+(self.size*2),self.y+(self.size*7),self.x+(self.size*6),self.y+(self.size*12))
    fill(55, 54, 28, 255) --thorax
    strokeWidth((self.size*0.6))
    ellipse(self.x,self.y,(self.size*8),(self.size*8))
    noStroke()
    fill(243, 255, 0, 255) --abdomen
    ellipse(self.x,self.y-(self.size*10),(self.size*10),(self.size*15)) 
    strokeWidth((self.size*2))
    stroke(1, 1, 1, 255) --abdomen stripes
    line(self.x-(self.size*5),self.y-(self.size*10),self.x+(self.size*5),self.y-(self.size*10))
    line(self.x-(self.size*4),self.y-(self.size*14),self.x+(self.size*4),self.y-(self.size*14))
    line(self.x-(self.size*4),self.y-(self.size*6),self.x+(self.size*4),self.y-(self.size*6))
end

I’ve been thinking about working on a genetic flower game. This is the main character.

It doesn’t cover anything new codewise.

omg this is genious! hahah i love this :slight_smile: i didnt know you can get “self” values out of a class by “classname.selfvalue”! very very cool!

can you explain what the function “bee:irrelipse” does? cant make up my mind…

Haha great work @Ipda41001. I would post a picture but I don’t want to spoil it.

bee:lrellispe rotates an ellispe. I learned from others you have to center the rotate at 0,0

ah okay :slight_smile: thanks

Cleary Bee has taken a step up the evolutionary ladder from Strobey. Looking forward to seeing his further genetic contributions at the dice table.

I see it goes much slower when it gets real big - darn ellipse drawing routine.

Nice job! :bz

Thx, I think the slowness at a large size may be how I’m rotating. I tried to scale it linearly with size and it didn’t work out. @Andrew help :slight_smile:

Bee, did you ever see this?

http://www.youtube.com/watch?v=BTC_uzD7LEQ&feature=youtube_gdata_player

Hahahaha… Nice @Ipda41001! :slight_smile: I didn’t visit this forum for a while and missed this thread until you bring it up again. Thank you, @Ipda41001.