• Welcome to Dark Bit Factory & Gravity.
 

Short Intro Challenge - snakeBob

Started by Tetra, June 10, 2006

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Tetra

Heres my second entry.

It generates 3 images and moves them about the screen without clearing the background. Exactly 20 lines tooÃ,  :D
Nothing fancy.

Download code and exe: www.tetrahedron.me.uk/snakeBob.rar

Old Revision: ( new further down )

Graphics 640,480,32,2

Image = CreateImage(32,32,4)
bgImg = CreateImage(640,480)

For x = 0 To 32 * 32
h = Sqr(((x Mod 32)-16)*((x Mod 32)-16)+((x/32)-16)*((x/32)-16))
If (h < 16) Then WritePixel( x Mod 32, x / 32,Ã,  (255 - (Sqr(((x Mod 32)-4)*((x Mod 32)-4)+((x/32)-4)*((x/32)-4))*7))Ã,  Ã,  Ã,  , ImageBuffer(image,0) )
If (h < 16) Then WritePixel( x Mod 32, x / 32,Ã,  (255 - (Sqr(((x Mod 32)-4)*((x Mod 32)-4)+((x/32)-4)*((x/32)-4))*7))ShlÃ,  8, ImageBuffer(image,1) )
If (h < 16) Then WritePixel( x Mod 32, x / 32,Ã,  (255 - (Sqr(((x Mod 32)-4)*((x Mod 32)-4)+((x/32)-4)*((x/32)-4))*7))Shl 16, ImageBuffer(image,2) )
Next

While Not KeyDown( 1 )
DrawImage( bgImg, 0, 0 )
i# = (i# + 2.4) Mod 360
j# = (j# + 1) Mod 360
DrawImage( Image, (Sin(iÃ,  Ã,  Ã,  ) * 300)+304, (Cos(jÃ,  Ã,  Ã,  ) * 200)+224, 0 )
DrawImage( Image, (Cos(i + 120) * 300)+304, (Sin(j + 120) * 200)+224, 1 )
DrawImage( Image, (Sin(i + 240) * 300)+304, (Cos(j + 240) * 200)+224, 2 )
Flip
GrabImage( bgImg, 0,0 )
Cls
Wend




:||
Challenge Trophies Won:

Rbz

Challenge Trophies Won:

TinDragon

Tetra, since your grabbing the previous buffer and drawing it over the top of the last you dont really need the cls  ;)

Now you have 1 more line to fill  ;D

Shockwave

Shockwave ^ Codigos
Challenge Trophies Won:

Tetra

Thanxs for pointing that out TD :)


Graphics 640,480,32,2

Image = CreateImage(32,32,4)
bgImg = CreateImage(640,480)

For x = 0 To 32 * 32
h = Sqr(((x Mod 32)-16)*((x Mod 32)-16)+((x/32)-16)*((x/32)-16))
If (h < 16) Then WritePixel( x Mod 32, x / 32,Ã,  (255 - (Sqr(((x Mod 32)-4)*((x Mod 32)-4)+((x/32)-4)*((x/32)-4))*7))Ã,  Ã,  Ã,  , ImageBuffer(image,0) )
If (h < 16) Then WritePixel( x Mod 32, x / 32,Ã,  (255 - (Sqr(((x Mod 32)-4)*((x Mod 32)-4)+((x/32)-4)*((x/32)-4))*7))ShlÃ,  8, ImageBuffer(image,1) )
If (h < 16) Then WritePixel( x Mod 32, x / 32,Ã,  (255 - (Sqr(((x Mod 32)-4)*((x Mod 32)-4)+((x/32)-4)*((x/32)-4))*7))Shl 16, ImageBuffer(image,2) )
Next

While Not KeyDown( 1 )
DrawImage( bgImg, 0, 0 )
i# = (i# + 2.4) Mod 360
j# = (j# + 1) Mod 360
DrawImage( Image, (Sin(iÃ,  Ã,  Ã,  ) * 300)+304, (Cos(jÃ,  Ã,  Ã,  ) * 200)+224, 0Ã,  )
DrawImage( Image, (Cos(i +Ã,  90) * 300)+304, (Sin(j + 270) * 200)+224, 1Ã,  )
DrawImage( Image, (Sin(i + 180) * 300)+304, (Cos(j +Ã,  90) * 200)+224, 2Ã,  )
DrawImage( Image, (Sin(i + 270) * 300)+304, (Cos(j + 180) * 200)+224, Rnd(2) )
Flip
GrabImage( bgImg, 0,0 )
Wend
Challenge Trophies Won:

Rbz

Hey Tetra, I think you've more spare linesÃ,  ;)


Graphics 640,480,32,2

Image = CreateImage(32,32,4)

For x = 0 To 32 * 32
h = Sqr(((x Mod 32)-16)*((x Mod 32)-16)+((x/32)-16)*((x/32)-16))
If (h < 16) Then WritePixel( x Mod 32, x / 32,Ã,  (255 - (Sqr(((x Mod 32)-4)*((x Mod 32)-4)+((x/32)-4)*((x/32)-4))*7))Ã,  Ã,  Ã,  , ImageBuffer(image,0) )
If (h < 16) Then WritePixel( x Mod 32, x / 32,Ã,  (255 - (Sqr(((x Mod 32)-4)*((x Mod 32)-4)+((x/32)-4)*((x/32)-4))*7))ShlÃ,  8, ImageBuffer(image,1) )
If (h < 16) Then WritePixel( x Mod 32, x / 32,Ã,  (255 - (Sqr(((x Mod 32)-4)*((x Mod 32)-4)+((x/32)-4)*((x/32)-4))*7))Shl 16, ImageBuffer(image,2) )
Next

While Not KeyDown( 1 )
i# = (i# + 2.4) Mod 360
j# = (j# + 1) Mod 360
DrawImage( Image, (Sin(iÃ,  Ã,  Ã,  ) * 300)+304, (Cos(jÃ,  Ã,  Ã,  ) * 200)+224, 0Ã,  )
DrawImage( Image, (Cos(i +Ã,  90) * 300)+304, (Sin(j + 270) * 200)+224, 1Ã,  )
DrawImage( Image, (Sin(i + 180) * 300)+304, (Cos(j +Ã,  90) * 200)+224, 2Ã,  )
DrawImage( Image, (Sin(i + 270) * 300)+304, (Cos(j + 180) * 200)+224, Rnd(2) )
Flip
Wend
Challenge Trophies Won:

Shockwave

You know, what I really love about this one is the code to generate the bobs :) Really nice.
Shockwave ^ Codigos
Challenge Trophies Won:

Tetra

\o/ Tnx RbrazÃ,  ;D

Tnx Shockwave, You gave me an Idea :), so I changed them a little.

Its now a big mess of colors lol but heres the revision:-

Download Code and Exe: www.tetrahc.me.uk/snakeBob.rar


Graphics 640,480,32,2

Image = CreateImage(32,32,5)

For x = 0 To 32 * 32
h = Sqr(((x Mod 32)-16)*((x Mod 32)-16)+((x/32)-16)*((x/32)-16))
If (h < 16) Then WritePixel( x Mod 32, x / 32,Ã,  (255 - (Sqr(((x Mod 32)- 4)*((x Mod 32)- 4)+((x/32)- 4)*((x/32)- 4))*7)), ImageBuffer(image,0) )
If (h < 16)And( x Mod 2 = 0 )Then WritePixel( x Mod 32, x / 32,Ã,  (255 - (Sqr(((x Mod 32)-16)*((x Mod 32)-16)+((x/32)-16)*((x/32)-16))*7))ShlÃ,  8 + 255 Shl 16, ImageBuffer(image,1) )
If (h < 16) Then WritePixel( x Mod 32, x / 32,Ã,  (Ã,  Ã,  Ã,  (Sqr(((x Mod 32)-28)*((x Mod 32)-28)+((x/32)-28)*((x/32)-28))*7))Shl 16 + 255 ShlÃ,  8, ImageBuffer(image,2) )
If (h < 16) Then WritePixel( x Mod 32, x / 32,Ã,  (255 - (Sqr(((x Mod 32)-28)*((x Mod 32)-28)+((x/32)-28)*((x/32)-28))*7))Shl 16, ImageBuffer(image,3) )
If (h < 16)And( x Mod 2 = 0 )And( (x/32) Mod 2 = 0 ) Then WritePixel( x Mod 32, x / 32, (255 - (h * 8))Shl 16 + (255 - (h * 8)) Shl 8+ (255 - (h * 8)) , ImageBuffer(image,4) )
Next

While Not KeyDown( 1 )
i# = (i# + 2.4) Mod 360
j# = (j# + 1) Mod 360

DrawImage( Image, ((Sin(iÃ,  Ã,  Ã,  ) * 300)+504) Mod 640, ((Cos(jÃ,  Ã,  Ã,  ) * 200)+124) Mod 480, 0 )
DrawImage( Image, ((Cos(j +Ã,  90) * 300)+304) Mod 640, ((Sin(i + 270) * 200)+224) Mod 480, 1 )
DrawImage( Image, ((Cos(i + 180) * 300)+104) Mod 640, ((Sin(j +Ã,  90) * 200)+324) Mod 480, 2 )
DrawImage( Image, ((Sin(j + 270) * 300)+404) Mod 640, ((Cos(i + 180) * 200)+424) Mod 480, 3 )
DrawImage( Image, ((Cos(j + 370) * 300)+404) Mod 640, ((Sin(i + 180) * 200)+524) Mod 480, 4 )
Flip
Wend
Challenge Trophies Won:

Shockwave

Shockwave ^ Codigos
Challenge Trophies Won: