Log In  

Cart [#31517#] | Code | 2016-10-23 | No License | Embed
13

Instructions included.

P#31518 2016-10-23 00:44 ( Edited 2016-10-24 15:20)

Cool!
It was pleasure to read the code :)
Always thought this effect is far more complicated :)

P#31525 2016-10-23 05:45 ( Edited 2016-10-23 09:45)

nice work, that inspired me a lot

P#31538 2016-10-23 09:51 ( Edited 2016-10-23 13:51)
:: dw817

This is like the BEST effect I've seen on PICO, gromozeka, and superhrx - and I never thought I would be the one to present it in such small code. :)

I gotta make a game with this. I know there was an Apple ][ LORES game called FIREBUG that was a type of SNAKE game but your pieces ignited out the backend of your tail when you ate them, similar to this fire effect.

So, for a-while after eating, you had to - ahh - stay away from your tail for gaseous emissions. :)

P#31540 2016-10-23 10:09 ( Edited 2016-10-23 20:21)
:: senilo

Nice, I am new to the Pico and I didn't that realize you could do stuff like this.

I also learned about the repeat-until statement, thanks!

P#31554 2016-10-23 15:22 ( Edited 2016-10-23 19:22)
:: dw817

Yep, Senilo. I wish PICO had a working example program for every single command. GFA did this and I would literally copy and paste every single example they had with the command in question to learn about it thoroughly.

I learn best through example, not by recitation or instruction.

Also be aware that the FOREVER listed in there is just an undefined variable that reads NIL. In this, the statement will never be true and just always loop.

You could've easily have said, UNTIL Z with the understanding Z was also not defined.

I just like to see the UNTIL FOREVER reminding me it's a permanent loop.

And - I was experimenting. How hard could it be to reproduce the PICO display in BlitzMAX and to also reproduce the same effect ?

Apparently not very easy at all ! Here is the source and executable.

' FIREBALL - CONVERSION FROM MY PICO CODE - dw817 - (10-23-16)
Strict

Incbin "audiowide-regular.ttf"
Local font:timagefont=LoadImageFont("incbin::audiowide-regular.ttf",24,SMOOTHFONT)

Global pic:TPixmap=CreatePixmap(128,128,pf_rgb888),colr[5],colg[5],colb[5]
ClearPixels pic
Local a,b,x=64,y=64,i,j,c,t$
colr[0]=0 colg[0]=0 colb[0]=0
colr[1]=128 colg[1]=0 colb[1]=0
colr[2]=255 colg[2]=0 colb[2]=0
colr[3]=255 colg[3]=128 colb[3]=0
colr[4]=255 colg[4]=255 colb[4]=0
SetGraphicsDriver GLMax2DDriver(),0 ' zero forces front buffer
Graphics 640,640
SetBlend alphablend
SetImageFont font

Cls
SetColor(255,255,255)
t$="F I R E B A L L"
DrawText(t$,320-TextWidth(t$)/2,280)
t$="Written by David W (dw817)"
DrawText(t$,320-TextWidth(t$)/2,320)
t$="-- October 23 2016 --"
DrawText(t$,320-TextWidth(t$)/2,360)
Flip
WaitChar

SetScale 5,5
Cls
Repeat
  For i=-7 To 7
    For j=-7 To 7
      pst(x+j,y+i,4)
    Next
  Next
  Cls
  DrawImage LoadImage(pic,0),0,0
  Flip
  For i=1 To 1250
    a=fnr(128)
    b=fnr(128)
    c=pnt(a,b)
    pst(a-1+fnr(3),b-2+fnr(4),c)
    If c>0 Then pst(a,b,c-1)
  Next
  If KeyDown(37) Then x:-1
  If KeyDown(38) Then y:-1
  If KeyDown(39) Then x:+1
  If KeyDown(40) Then y:+1
Until KeyDown(27)

Function pst(x,y,c)
Local n=x*3+y*384
  If x<0 Or x>127 Or y<0 Or y>127 Then Return
  pic.pixels[n]=colr[c]
  pic.pixels[n+1]=colg[c]
  pic.pixels[n+2]=colb[c]
EndFunction

Function pnt(x,y)
Local n=x*3+y*384,r,g,b,i
  If x<0 Or x>127 Or y<0 Or y>127 Then Return
  r=pic.pixels[n] g=pic.pixels[n+1] b=pic.pixels[n+2]
  For i=0 To 4
    If r=colr[i] And g=colg[i] And b=colb[i] Then Return i
  Next
EndFunction

Function fnr(a)
  Return Rand(0,a-1)
EndFunction


https://www.dropbox.com/s/wj3aiqxoj9hlyky/fireball-dw817-10-23-16.zip?dl=0

I don't know how to draw a circle with dots so that's why it's a square.

P#31562 2016-10-23 16:19 ( Edited 2016-10-25 17:06)

This is cool! it feels like it goes through a lot of colors. maybe because of dithering? that is why it tricks our eye into seeing new colors.

P#31605 2016-10-23 19:55 ( Edited 2016-10-23 23:55)
:: dw817

I think it's because every pixel is being manipulated, Kevin. This is exciting territory for me. I never thought computers capable of being able to treat every pixel as a unique object.

This will definitely change my thinking in programming !

P#31608 2016-10-23 20:19 ( Edited 2016-10-24 00:19)

Welcome to the future! Next thing you know, you'll be using _draw()! (well, maybe not immediately) Honestly, I don't entirely "get" the insight you've now wrapped your head around*, but the results speak for themself. Nice work!

(Reminds me of some of the techniques people have used in the tweetjam thread. It's crazy what people have done with so little.)

Here's some random sparks (and more rising, and slower fade because I added too much) because it's what I craved:

Cart [#31647#] | Code | 2016-10-24 | No License | Embed

(*as in I can't read your mind, which is probably for the best)

P#31648 2016-10-24 02:37 ( Edited 2016-10-24 06:43)
:: dw817

It's interesting, Tyroney. While I'm just on the tip of understanding LISTS in PICO, I thought I would have to use something as complex as that for this sort of thing.

But no - it wasn't needed. This opens up all kinds of interesting possibilities. While the system is still limited to 16-colors, there's nothing to say I can't create my own graphic look up table for advanced scripting.

As it is here, I am looking for raw colors - but what if ... what if it used a look-up table instead ?

Try to read my mind will you ? :)

https://youtu.be/g8WC5c6KXe4?t=12

P#31659 2016-10-24 11:20 ( Edited 2016-10-24 15:20)

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-09-23 09:47 | 0.036s | 2097k | Q:44