• Welcome to Dark Bit Factory & Gravity.
 

Pompom - Amoeba things[BB2D]

Started by mike_g, January 06, 2007

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mike_g

A function I am working on that draws fuzzy things. It became a bit more complex than I initially expected so I might rewrite it useing types intead of arrays. I also plan on adding rotation and improving the speed. Anyway here it is:

;GLOBAL ARRAYS NEEDED
Dim fuzzer(10, 360), fuzzdir(10, 360)
;---------------------------------------------------------------------;
;***************************** DEMO **********************************;
;---------------------------------------------------------------------;
Graphics 1024, 768
SetBuffer BackBuffer()
SeedRnd MilliSecs()
Color 200, 50, 50
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 KeyHit(1)
Cls
FUZZY_CIRCLE(1, 300, 300, 100, 160, 50, 5, 1)
FUZZY_CIRCLE(2, 800, 500, 100, 360, 50, 5, 0)
FUZZY_CIRCLE(3, 550, 200, 50, 50, 40, 3, 0)
FUZZY_CIRCLE(4, 550, 200, 50, 50, 10, 1, 0)
FUZZY_CIRCLE(5, 400, 600, 100, 20, 10, 1, 0)
Flip
Wend
;---------------------------------------------------------------------;
;*************************** FUNCTIONS *******************************;
;---------------------------------------------------------------------;
Function FUZZ_INIT(number, intense, fuzz)
For i = 1 To fuzz
fuzzer(number, i) = Rand(0, intense)
Next
End Function
;------------------------------;
Function FUZZY_CIRCLE(number, cx, cy, rad, fuzz, intense, vibration, randy)
angstep# = Float(360) / Float(fuzz)

first_x = (cx - (rad +fuzzer(number, 1)) * Cos(deg#))
first_y = (cy - (rad +fuzzer(number, 1)) * Sin(deg#))
this_x = (cx - (rad +fuzzer(number, 1)) * Cos(deg#))
this_y = (cy - (rad +fuzzer(number, 1)) * Sin(deg#))
FUZZ_MOVE(number, 1, intense, vibration, randy)

LockBuffer
For i = 2 To fuzz
deg# = deg# + angstep#
last_x = this_x
last_y = this_y
FUZZ_MOVE(number, i, intense, vibration, randy)
this_x = (cx - (rad +fuzzer(number, i)) * Cos(deg#))
this_y = (cy - (rad +fuzzer(number, i)) * Sin(deg#))
Line last_x, last_y, this_x, this_y
Next
Line this_x, this_y, first_x, first_y
UnlockBuffer
End Function
;-------------------------------;
Function FUZZ_MOVE(number, i, intense, vibration, randy)
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
End Function

Ghost^BHT


Clyde

That is awesome dude, welldone indeed :)
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

zawran

Thats pretty cool. It could be used for some kind of asteroid like enemies. Invasion of the fuzzies.

taj


Mike_g

Any chance of an exe? We dont all have basic here.
Challenge Trophies Won:

zawran

I have compiled it and put it online. You can download it from here:  amoebe

mike_g

Hey zawran thanks for putting an exe up for me. I would have done so myself but havent been paying much attention to the Blitz forums the last couple of days. Anyway have some karma :) and yeah Im working on a little vector graphics game at the moment so i might put them in as evil wobbly blobs.

benny!

Very nice. I liked the one at the left bottom best ! Thanks for supplying an exe as
I do not have Blitz either !!!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

rdc

Cool indeed mike_g. Thanks for the exe zawran.

mike_g

Hey I'm glad you guys like it. I had a go at filling them using a (slightly crude) floodfill I made but it runs too slow if I use it each loop. The best way I can think of would be to start off with a fill and then switch only the pixels that need changing but I dont think i'm clever enough to work that one out :(

Maybe I'll do a line version, as opposed to circular. That would be a bit simpler to find out what pixels need changing.

Also in future I'll make exes for stuff. I dident originally do one for this cos I wasent finished with it, but then I got distracted and started doing something else.

rdc

This article has some different flood-fill algos that may help. The quick-fill looks pretty good, although I haven't tried it myself.

mike_g

Cool :) I bookmarked it for now since i'm a little drunk, but i'll be sure to go over it tomorrow or something.

Clyde

#12
Very cool stuff indeed.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

taj

Zawran: karma++ for supplying the exe!

Nice effect mike_g...I especially like the one down the bottom right. I wonder what it would look like if you changed colour depending on distance from centre of circle (eg things in the midle of the circle darker and things outside brighter???)

Challenge Trophies Won:

mike_g

Quote from: tajNice effect mike_g...I especially like the one down the bottom right. I wonder what it would look like if you changed colour depending on distance from centre of circle (eg things in the midle of the circle darker and things outside brighter???)

Nice idea, I might do that :) but first i think I better rewrite the things using types, since the longer  leave it the more difficult it will become. At the moment I got a lot of other stuff to do for assignments I been leaving to the last minute that need to be in this week. Oh well maybe on the weekend.

Clyde

Dude if you've got assignments to do, get those done first matey their more important.

Looking forward to seeing what you conjur up next :)

Cheers,
Clyde :)
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won: