Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - I love my Brick

#1
I never give up on something that challenges me :)

Ive tried to use sprite2mem followed by a location check within the sprite. (I.e.: the centre)

This worked fine and began growing left & right displaying white pixels (rewriting the sprite) where it found a 0 value.

Sadly, I cannot understand how or why my code isnt detecting the RGB value different to nought.

Im left with a fast flowing flood fill of white.

I will say here, this idea is fast in operation compared to drawline or setpixel.

It acts and jumps along like that found in Pro Motion 6, Pro Pixel, Dogwaffle etc

Any Ideas?


Heres the basis of my code.



// getscreensize w,h
// dim area%[w*h]
// type flood....paint as flood with W & E ...    paint[0].w=420*height / paint[0].e=420*height
// list=0 - increases when it finds a new gap to fill

// loop
// mem2sprite
// goto fill routine
// sprite2mem

////

// fill routine

// for each part of "list"
// check West value: (IF area%[paint(list).west]=0 (or) 0xff000000 THEN area%[paint
    .west]=0xffffffff - white)
    // dec west value
    // repeat check for east value
    // if west and east hit boundary do a check above and below for new gaps to fill
    // new gap found - increase list variable (paint(list).w etc, with new found x settings within the sprite/bmp.
#2
Ok Mrs Doyal! I will have a cup of tea :)

This weekend I will add the rest of episode one here.

No! I dont want cake!
#4
I was just jesting Hemlos.  I read "bird" and saw a "bird" representing you.

I`m an admirer of your manipulation of the 2d screen.  keep it up!

Me, well too long in the tooth - so I use old fashioned ways with present day power to create a reaction on screen.

(which often only takes a few lines of code. - I always knew one day they would work)

All code Ive placed is a reflection of ideas that never worked on the humble Amiga.(slow frame rate)

Then I see guys like you with a platform that makes anything possible - unlike the ST & Amiga.

I`m learning Hemlos to embrace this new platform via young guys like you.





#5
Ok, some have read and enjoyed the snippet script which leaves me thinking its not wise to continue.

But for those who enjoyed it I will speed thru the first script.

Ned, Damien & Gerald venture into the market place.  They meet & greet etc.  An old women grabs Ned and begs him to bless her house.  He only agrees when he sees her daughter.  We then learn somthing new about Damien - pets dislike him.  Sat in the house waiting for tea, Ned notices alot of odd photographs placed around.  They depict a old man.  Ned asks about this man thinking he is deceased.  The old women soon leaves you knowing she is an old women stalker obessed with her victim.  Her daughter starts her obsession by taking a snap of Ned....

Ned, Damien & Gerald visit the beach.  Gerald needs alot of fresh air which leads to them heading for the beach. On their way back home they meet the "Bogman" who is attracted by Geralds Pipe and stash of Whiskey.  Damien & Gerald meet him first.  Ned stumbles into the chaos later resulting in the end of the Bogman even though some dimwits have spent months trying to capture it.

The episode ends with Gerald being revealed after a very long scrub bath by Miss Doyal.

Ned: (Surprised and pleased at the same time)

Well! Look at you Father Bells. You look 20 years younger. This calls for a Drink.

Father Bells: ( leans forward in his chair )

Drink! Drink! Girls! Feck!

Damien, Ned & Miss doyal laugh with joy and raise their glasses.

We are left with a familiar face snoring in his chair.

Credits scroll....

The figure wakes up again and leans forward.

"TED!"

He then slumps back and shouts "Arse"

#6
Does this bird look like the pheonix you display near you name? :)

Thankx.

Now Im in Math land lets hope users can see that circluar Math can with clever imagination be implemented into dazzling effects - often cheap on the processor leaving space for other requirements.
 
#7
Yes I agree, now how do we move it?
#8
Very nice Hemlos, reminds me of some kind of fossilised shell.
#9
Quote from: CrystalNoir on 2011-Sep-03
Hi all :)

Here is a code that I wrote to simulate a 3D Starfield, in an amiga style. asic :)


Hi CrystalNoir.  Ive tweaked your code & added a fake Nebula in the background that swirls and grows.  Hope you like it.

Code (glbasic) Select
GETSCREENSIZE w,h

GRABSPRITE 0,0,0,w,h

// Variables Setup

GLOBAL spread = 64
GLOBAL speed# = 1.9
GLOBAL cx = 640/2
GLOBAL cy = 480/2

GLOBAL quit% = 0

// Types

TYPE Stars
x#
y#
z#
sx#
sy#
ENDTYPE

GLOBAL Tlist[] AS Stars

FOR i = 1 TO 400
GOSUB NewStar
NEXT

//////////////// LOOP /////////////////

WHILE TRUE

ROTOSPRITE 0,0,0,0.1

FOR a=0 TO 100

randx=RND(w) ; randy=RND(h)

SETPIXEL randx,randy,RGB(255,200,rnd(255))

randx=RND(w) ; randy=RND(h)

SETPIXEL randx,randy,RGB(0,0,RND(255))
NEXT

GRABSPRITE 0,0,0,w,h

GOSUB DrawTheStars

SHOWSCREEN

WEND


// ------------------------------------------------------------- //
// ---  NEWSTAR  ---
// ------------------------------------------------------------- //
SUB NewStar:
GLOBAL Item AS Stars

Item.z# = RND(55)+200
Item.x# = RND(2000)-1000
Item.y# = RND(2000)-1000

DIMPUSH Tlist[],Item


ENDSUB // NEWSTAR


// ------------------------------------------------------------- //
// ---  DRAWTHESTARS  ---
// ------------------------------------------------------------- //
SUB DrawTheStars:

FOREACH Item IN Tlist[]

IF Item.z# < speed# OR Item.sx# < 0 OR Item.sx# > 640 OR Item.sy# < 0 OR Item.sy# > 480
Item.z# = RND(55)+200
Item.x# = RND(2000)-1000
Item.y# = RND(2000)-1000
ENDIF

Item.z# = Item.z# - speed#
Item.sx# = ( Item.x#*spread) / (Item.z#) + cx#
Item.sy# = ( Item.y#*spread) / (4+Item.z#) + cy#

SETPIXEL Item.sx#, Item.sy#, RGB(255,255,255)
NEXT


ENDSUB // DRAWTHESTARS

#10
Well look at me, I think Im a priest and drag a brick around on a piece of string. :) The code Ive been posting has had a heavy effect upon my sanity :D

But if you do try to implement anything into your particle engine, just remember..."no pain, no gain" :D
#11
Code (glbasic) Select
// Spiral code tweak
// I LOVE MY BRICK

GETSCREENSIZE w,h

GRABSPRITE 0,0,0,w,h

change=3.75

//////////
// DA LOOP
//////////

WHILE TRUE

INC count

IF count=5

ROTOSPRITE 0,0,0,0.1 // draw current display

count=0

ELSE

ROTOSPRITE 0,0,0,0

ENDIF

FOR aa=1 TO 26000 STEP change

x=COS(aa)/32
y=SIN(aa)/32

col=RGB(COS(r)*100+100,SIN(count+aa*5)*127+127,SIN(b+aa*5)*127+127)

DRAWRECT 320+y*aa/2,200+x*aa/2,2,2,col

NEXT

INC change, 0.4 // let the fun begin!

GRABSPRITE 0,0,0,w,h // grab new screen display

SHOWSCREEN

WEND
#12
Code (glbasic) Select
// The tunnel that might be made of jelly tweaked.
// A 50 pence production (c)
// created by "I love my brick"

GETSCREENSIZE w,h

tsize=51 ; xpos=320 ; ypos=200 ; shortradius=14 ; longradius=25 ; rot=1

TYPE tube ; x ; y ; sizex ; sizey ; speed ; r ; g ; b ; sx ; sy ; ENDTYPE

GLOBAL t[] AS tube ; DIM t[tsize]

FOR a=0 TO tsize-1

t[a].speed=0.5 ; t[a].x=xpos ;  t[a].y=ypos ; t[a].sizex=shortradius ; t[a].sizey=longradius
INC shortradius,10; INC longradius,10 ;
t[a].r=0; t[a].g=0; t[a].b=0 ;
INC t[a].sx,2 ; INC t[a].sy,2

NEXT

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Main Loop
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

WHILE NOT FALSE
ROTOSPRITE 0,0,0,0.1
FOR bb=0 TO 50

FOR aa=0 TO 360 STEP 15

x=t[bb].x+t[bb].sizex*COS(aa)*COS(rot)+t[bb].sizey*SIN(aa)*SIN(rot) // the maths bit
y=t[bb].y+t[bb].sizex*COS(aa)*SIN(rot)-t[bb].sizey*SIN(aa)*COS(rot)

DRAWRECT x,y,t[bb].sx,t[bb].sy, RGB(t[bb].r, t[bb].g, t[bb].b)
NEXT

INC t[bb].sx,0.1 ; INC t[bb].sy,0.1 // increase the size of the block
INC t[bb].sizex,t[bb].speed ; INC t[bb].sizey,t[bb].speed ; INC t[bb].speed,0.1 // acceleration

IF t[bb].sizex>500 // return to centre of screen
t[bb].sizex=4 ; t[bb].sizey=25 ;  t[bb].speed=0.1
t[bb].sx=1.1 ; t[bb].sy=1.1 ; t[bb].sizex=10+RND(20) ; t[bb].sizey=5+RND(10)
ENDIF
NEXT

INC rot, 10 // let the wobble begin!
// set new values for next set of colour
ran1=RND(255)
ran2=RND(255)
ran3=RND(255)

FOR a=0 TO 50 STEP RND(50) // alter all colours
t[a].r=ran1
t[a].b=ran2
t[a].g=ran3
NEXT

IF KEY(203)=1 THEN INC x
GRABSPRITE 0,0,0,w,h
SHOWSCREEN
WEND // infinity in action!
#13
Replace the above code with the following:

//
DRAWRECT 300+COS(a)*50+mx,200+SIN(a)*50+my,mx-mx/2,my-my/2,RGB(255/mx+my,200,mx+my)
DRAWRECT 300-COS(a)*50-mx,200+SIN(a)*50-my,mx-mx/2,my-my/2,RGB(0,mx+my,255)
//
DRAWRECT 300+COS(a)*50-mx,200+SIN(a)*50+my,mx-mx/2,my-my/2,RGB(mx+my,200,mx+my)
DRAWRECT 300+COS(a)*50+mx,200+SIN(a)*50-my,mx-mx/2,my-my/2,RGB(0,mx+my,255)
//

It creates a simple sky & landscape - fun for the kids.
#14
erm...or a strange new world :)
#15
Try this small modification to the above code.  Compile it, move the mouse like crazy with left button held down. The overall effect is very similar to a skyscape coming towards you.

//// Skyscape effect

GETSCREENSIZE w,h

GRABSPRITE 0,0,0,w,h

WHILE TRUE

ROTOSPRITE 0,0,0,0 // draw current display

MOUSESTATE mx, my, b1, b2 // read da mouse

IF b1=1 // button pressed

FOR a=0 TO 90 STEP 5 // change the "STEP" for different effects

DRAWRECT 300+COS(a)*50+mx,200+SIN(a)*50+my,mx-mx/2,my-my/2,RGB(255/mx+my,mx+my,255)
DRAWRECT 300-COS(a)*50-mx,200+SIN(a)*50-my,mx-mx/2,my-my/2,RGB(255/mx+my,mx+my,255)
DRAWRECT 300+COS(a)*50-mx,200+SIN(a)*50+my,mx-mx/2,my-my/2,RGB(255/mx+my,mx+my,255)
DRAWRECT 300+COS(a)*50+mx,200+SIN(a)*50-my,mx-mx/2,my-my/2,RGB(255/mx+my,mx+my,255)

NEXT

ENDIF

GRABSPRITE 0,0,0,w,h // grab new screen display

SHOWSCREEN

WEND