?
Solved

Flame as a procedure w/ (X,Y)

Posted on 1998-05-18
8
Medium Priority
?
221 Views
Last Modified: 2010-04-16
for uses graph;

I want to make a simple flame procedure that is able to be placed where i want it by (X, Y, SIZE);
or something like that....at cooridnates 120, 200 i would do this fire(120, 200, 3); and it would put a flame there.

My goal is to put a fire below a rocket ship.  
I have the entire ship drawn already, i just need the flame below it.  I would prefer it to be animated, as i seen them
before...please help.  thanks...

i hope 100 pts is fair enough, as i am low, and i have other questions pending elsewhere....

where if i want something on fire at coordinates 120, 200, i
0
Comment
Question by:weinrj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 1

Expert Comment

by:FuzzyLogic
ID: 1217028
Well, I made ones a "flame" in pascal version (BGI) and in asm version (*MUCH* faster).
I'll see if I convert my flame into procedure as you requested.
However, I need to know how you make your GFXs. Do you use BGI or direct $A000 drawing?
Keep it in mind that the flame graphics take about 64 colors.

Fuzzy
0
 

Author Comment

by:weinrj
ID: 1217029
I use BGI-graph mode...  thanks
0
 
LVL 1

Expert Comment

by:FuzzyLogic
ID: 1217030
Please specify what mode are you using. The BGI version I made is using non-standart BGI that can handle more that 16 colors.
If you are using non-standart version of BGI, you can send it to me at fuzzy_logic@usa.net

Fuzzy
0
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 

Author Comment

by:weinrj
ID: 1217031
i will be using the standard BGI that Pascal uses...i think it is EGAVGA.BGI or some crap like that...
0
 
LVL 1

Accepted Solution

by:
FuzzyLogic earned 400 total points
ID: 1217032
Ohh well...
I could not do it with 16 colors. So I'll give you a my version of "flame" that I fixed to "procedure type". It is using 64 of 256 colors.
As a BGI version, I can send you the BGI package I user (it is a shareware) if you'll leave me your EMail address.

Fuzzy
0
 
LVL 1

Expert Comment

by:FuzzyLogic
ID: 1217033
Program FireWall;

Uses Graph,Crt;

const
  MaxX=640;
  StartColor=192;

var
  GraphMode, GraphDriver : integer;
  a:word;


{$F+}
function DetectVGA256 : Integer;
  begin
{   Writeln('  0) 320x200x256');
    Writeln('  1) 640x400x256');
    Writeln('  2) 640x480x256');
    Writeln('  3) 800x600x256');
    Writeln('  4) 1024x768x256'); }

    DetectVGA256 := 0;
  end;
{$F-}

procedure DrawFlame(x1,x2,y1,h:integer);
  var
    a,b,c:word;
    Line,Line2,Line0:array[0..MaxX] of integer;
    direction:boolean;
    decrement:byte;

  begin;
    for a:=0 to MaxX do begin;
      Line[a]:=0; Line0[a]:=0; Line2[a]:=0;
    end;

    if (x1<0) or (x2<=x1) or (abs(h)<10) then exit;
    direction:=(h>0);
    decrement:=192 div abs(h);
    if decrement=0 then decrement:=1;

    for a:=x1+1 to x2-1 do Line[a]:=random(255);

    repeat;
      for a:=x1 to x2 do begin;
        Line0[a]:=Line0[a]+random(256)-128;
        if Line0[a]<0 then Line0[a]:=0
        else if Line0[a]>255 then Line0[a]:=255;
      end;

      { Smoothing first line }
      Line:=Line0;
      for a:=x1+1 to x2-1 do Line0[a]:=(Line[a-1]+Line[a+1]+Line[a]) div 3;

      Line:=Line0;

      for b:=0 to abs(h) do begin;
        if direction then c:=y1+b else c:=y1-b;
        for a:=x1+1 to x2-1 do begin;
          Line2[a]:=(Line[a-1]+Line[a+1]+Line[a]) div 3;
          if Line2[a]>0 then begin;
            dec(Line2[a],decrement); if Line2[a]<0 then Line2[a]:=0;
          end;
          PutPixel(a,c,StartColor+Line2[a] div 4);
        end;
        Line:=Line2;
      end;
      delay(150);
    until KeyPressed;
    a:=ord(ReadKey);
  end;


begin
  Randomize;
  GraphDriver := InstallUserDriver('SVGA256',@DetectVGA256);
  GraphDriver := Detect;
  InitGraph(GraphDriver,GraphMode,'d:\dev\tp\bgi');

{ You can play with the colors... Enjoy yourself ;)
  Hint: Try deviding the flame colors (like from yellow (63,63,0) to red
        and fading to black)...
}
  for a:=0 to 63 do SetRGBPalette(StartColor+a,a,0,a div 16);

  DrawFlame(140,180,120,-50);

  CloseGraph;
end.
0
 

Author Comment

by:weinrj
ID: 1217034
thank you!  but,. the flame is rainbow colored..i dont have this superVGA thing...how do i work that?
0
 

Author Comment

by:weinrj
ID: 1217035
oh u need my address..it is jwnrb@cybernex.net
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Check out the latest tech news, community articles, and expert highlights in August's newsletter.
The top devops trends for 2017 are focused on improved deployment frequency, decreased lead time for change and decreased MTTR.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question