Author Topic: Flames tutorial  (Read 48433 times)

0 Members and 1 Guest are viewing this topic.

Offline Stryars

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 12
  • Rating: +0/-0
    • View Profile
Re: Flames tutorial
« Reply #75 on: December 11, 2012, 01:41:30 pm »
(sorry for bad english, I'm french :/)

Nice tutorial !

But I didn't really understand this part:
Code: [Select]
For(F,L6+12,L6+767       //loop through all of the screen pixels except the last 12
{F} and {rand^8+Str1}->{F-12}   //take the byte, use AND to erase a single bit from it, and then store it into the byte directly *above* it
End                     //this makes it so that as the byte rises, each frame a pixel is erased from it

Why "except the last 12" ?
 
And how works the line 2?
Code: [Select]
{F} and {rand^8+Str1}->{F-12}   //take the byte, use AND to erase a single bit from it, and then store it into the byte directly *above* it
Thanks :)

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Flames tutorial
« Reply #76 on: December 11, 2012, 01:48:39 pm »
Code: [Select]
For(F,L6+12,L6+767       //loop through all of the screen pixels except the last 12
{F} and {rand^8+Str1}->{F-12}   //take the byte, use AND to erase a single bit from it, and then store it into the byte directly *above* it
End                     //this makes it so that as the byte rises, each frame a pixel is erased from it

Thie first line loops through all the bytes in L6 (except for the last row, which is the last 12 bytes. We save those so that there's something to "feed" the flames). Since L6 has 768 bytes, we loop from 12 to 767.

If you look at the Str1 sprite, it's essentially diagonal pixels filling up the sprite, and each row/column has exactly one pixel. By using rand^8, we select one row at random, and erase that pixel from the screen. We then shift the entire screen up a row. By adding more pixels or taking them away from the sprite, you can do all sorts of things with the flames - bias them to one direction, make them last much shorter times, etc.
« Last Edit: December 11, 2012, 01:54:51 pm by leafy »
In-progress: Graviter (...)

Offline Stryars

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 12
  • Rating: +0/-0
    • View Profile
Re: Flames tutorial
« Reply #77 on: December 11, 2012, 01:58:42 pm »
Oh ok, I undersand erverything now, thanks :) !

Bye and have a nice day ;)

Offline Joshuasm32

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 142
  • Rating: +19/-7
    • View Profile
    • Network
Re: Flames tutorial
« Reply #78 on: December 12, 2012, 06:40:08 pm »
It does not work when I do it... :banghead:
My name is Josh and I a developer at Moonzean. I enjoy Radiohead, web development, Java, and cryptograms.
Spoiler For No Surprises, by Radiohead:
A heart that's full up like a landfill
A job that slowly kills you
Bruises that won't heal

You look so tired unhappy
Bring down the government
They don't, they don't speak for us

I'll take a quiet life
A handshake of carbon monoxide

And no alarms and no surprises
No alarms and no surprises
No alarms and no surprises
Silent, silent

This is my final fit
My final bellyache

With no alarms and no surprises
No alarms and no surprises
No alarms and no surprises please

Such a pretty house
And such a pretty garden

No alarms and no surprises
No alarms and no surprises
No alarms and no surprises please

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Flames tutorial
« Reply #79 on: December 12, 2012, 06:42:16 pm »
What part isn't working, could you be more specific? Remember, this is Axe code. Also, you should introduce yourself codebender :) I'm assuming your the same 'codebender' from TI-BASICDeveloper?

Offline Joshuasm32

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 142
  • Rating: +19/-7
    • View Profile
    • Network
Re: Flames tutorial
« Reply #80 on: April 27, 2013, 01:22:04 pm »
When I compile, an error occurs:

EDIT: It stopped.  Thank you, though...   ???
My name is Josh and I a developer at Moonzean. I enjoy Radiohead, web development, Java, and cryptograms.
Spoiler For No Surprises, by Radiohead:
A heart that's full up like a landfill
A job that slowly kills you
Bruises that won't heal

You look so tired unhappy
Bring down the government
They don't, they don't speak for us

I'll take a quiet life
A handshake of carbon monoxide

And no alarms and no surprises
No alarms and no surprises
No alarms and no surprises
Silent, silent

This is my final fit
My final bellyache

With no alarms and no surprises
No alarms and no surprises
No alarms and no surprises please

Such a pretty house
And such a pretty garden

No alarms and no surprises
No alarms and no surprises
No alarms and no surprises please

Offline The VFX Wizard

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 9
  • Rating: +0/-0
    • View Profile
Re: Flames tutorial
« Reply #81 on: March 16, 2018, 07:46:42 pm »
I am confused (sorry for being such a noob). I understand everything before the for loop, but I don't understand how L6 can draw to the screen and how that works. Also, why do you only need 768 bytes for 6144 pixels?
« Last Edit: March 19, 2018, 06:36:06 pm by The VFX Wizard »
5 Things I hate the most: lists, irony, lists, repitition, typos, and the Oxford comma

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Flames tutorial
« Reply #82 on: March 19, 2018, 07:01:49 pm »
Also, why do you only need 768 bytes for 6144 pixels?
Each byte is made up of 8 bits. Since the display is purely monochrome and doesn't support grayscale, you can store one pixel in each bit, and 768*8=6144.