Author Topic: Amoeba Things  (Read 4364 times)

0 Members and 1 Guest are viewing this topic.

Offline mike_g

  • Amiga 1200
  • ****
  • Posts: 435
  • Karma: 34
    • View Profile
Amoeba Things
« on: March 09, 2007 »
Heres a Cobra conversion of the amoeba things I made in Blitz. I added a fill parameter to it using the built in floodfill command.
Code: [Select]
program
    uses pure2d, keyset

var
    fuzzer: array[10, 360] of integer
    fuzzdir: array[10, 360] of integer

procedure FUZZ_INIT(number, intensity, fuzz)
var
    i:integer
begin       
    for i = 1 to fuzz
        fuzzer[number, i] = Rand(0, intensity)
    next
end 

procedure FUZZY_CIRCLE(number, cx, cy, rad, fuzz, intensity, vibration, randy, colour, fill)
var
    angle_step: real
    degrees: real
    first_x, first_y: integer
    last_x, last_y: integer
    this_x, this_y: integer
    i: integer

begin   
    angle_step = (toreal(360) / toreal(fuzz))
    first_x = (cx - (rad +fuzzer[number, 1]) * Cos(degrees))
    first_y = (cy - (rad +fuzzer[number, 1]) * Sin(degrees))
    this_x = (cx - (rad +fuzzer[number, 1]) * Cos(degrees))
    this_y = (cy - (rad +fuzzer[number, 1]) * Sin(degrees))
    FUZZ_MOVE(number, 1, intensity, vibration, randy)


    For i = 2 To fuzz
        degrees = degrees + angle_step   
        last_x = this_x
        last_y = this_y
        FUZZ_MOVE(number, i, intensity, vibration, randy)
        this_x = (cx - (rad +fuzzer[number, i]) * Cos(degrees))
    this_y = (cy - (rad +fuzzer[number, i]) * Sin(degrees))
    Line (last_x, last_y, this_x, this_y, colour)
    Next
    Line (this_x, this_y, first_x, first_y, colour)
   
    if fill = 1 then FloodFill(cx, cy, colour, colour, TRUE)
end

procedure FUZZ_MOVE(number, i, intense, vibration, randy)

begin
    If fuzzdir[number, i] = 0
    fuzzer[number, i] = fuzzer[number, i] + vibration +Rand(0, randy)
    Else
    fuzzer[number, i] = fuzzer[number, i] - vibration -Rand(0, randy)
    EndIf

    If fuzzer[number, i] >= intense
    fuzzdir[number, i] = 1
    else
        if fuzzer[number, i] <= -intense
        fuzzdir[number, i] =0
        endif
    EndIf
end




begin
    openscreen(1024, 768)
    FUZZ_INIT(1, 100, 360)
    FUZZ_INIT(2, 100, 360)
    FUZZ_INIT(3, 100, 360)
    FUZZ_INIT(4, 100, 360)
    FUZZ_INIT(5, 100, 360)
   
    while not keydown(vk_escape)
    Cls
    FUZZY_CIRCLE(2, 300, 300, 180, 200, 50, 4, 1, ToRGBA(200, 0, 0),1)
    FUZZY_CIRCLE(3, 300, 300, 100, 120, 40, 3, 1, ToRGBA(200, 100, 0),1)
    FUZZY_CIRCLE(2, 300, 300, 50, 60, 30, 2, 1, ToRGBA(200, 150, 0),1)
    FUZZY_CIRCLE(1, 300, 300, 30, 40, 10, 1, 1, ToRGBA(200, 200, 50),1)
    FUZZY_CIRCLE(1, 300, 300, 20, 30, 2, 1, 0, ToRGBA(200, 200, 200),1)
       
       
    FUZZY_CIRCLE(5, 650, 160, 80, 20, 10, 2, 0, ToRGBA(50, 80, 120),1)       
    FUZZY_CIRCLE(5, 660, 150, 50, 15, 10, 2, 0, ToRGBA(50, 120, 200),1)    
        Flip
    wend
   
end

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Amoeba Things
« Reply #1 on: March 09, 2007 »
These things look cool :) Would be nice to see them dividing up and swimming around the screen too :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline mike_g

  • Amiga 1200
  • ****
  • Posts: 435
  • Karma: 34
    • View Profile
Re: Amoeba Things
« Reply #2 on: March 09, 2007 »
Yeah I had that idea too. It would be cool, but it would take quite a bit of work. I just started on a 20 second demo using the stuff I converted to Cobra. Hopefully I can get it finished today. Then I think i'll have to go back to finishing off my Blitz project. Cheers.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Amoeba Things
« Reply #3 on: March 09, 2007 »
Looking forward to seeing your 20 Second demo :D

I'm wondering what entries we will get, and whether they will be as varied as normal :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline GrahamK

  • Atari ST
  • ***
  • Posts: 118
  • Karma: 17
    • View Profile
Re: Amoeba Things
« Reply #4 on: March 09, 2007 »
wibbly :D