Results 1 to 4 of 4

Thread: Fast Draw Help!

  1. #1
    Join Date
    Jun 2007
    Posts
    124
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Fast Draw Help!

    I am making this dot game script and whenever the dot that you control goes over the green dot it is supposed to move the green dot to a new place, but it doesn't move unless you hit all the direction buttons at once when your dot is over the green dot(which is very hard).

    If anyone knows whats wrong plz post it.
    This is the script:

    SCAR Code:
    program DotGame;
    var
      Dot,Back,x,y,a,z,GDot:Integer;

    procedure SetUp;
    begin
    DisplayDebugImgWindow(250,250);
    ActivateClient;
    Dot:= BitmapFromString(5,5,'');
    GDot:= BitmapFromString(5,5,'');
    Back:= BitmapFromString(250,250,'');
    FastDrawClear(Dot,2480383);
    SafeDrawBitmap(Dot,GetDebugCanvas,125,125);
    x := 125;
    y := 125;
    end;

    procedure RandDot;
    begin
    a:= (1 + Random(244));
    z:= (1 + Random(245));
    SafeDrawBitmap(GDot,GetDebugCanvas,a,z)
    end;

    procedure DotMoveLeft;
    begin
    repeat
    FastDrawClear(Back,0);
    FastDrawClear(GDot,2990379);
    FastDrawTransparent(x,y,Dot,Back);
    FastDrawTransparent(x,y,Dot,GDot);
    x:=x+1;
    SafeDrawBitmap(Back,GetDebugCanvas,0,0);
    SafeDrawBitmap(GDot,GetDebugCanvas,a,z)
    Wait(10);
    until(x>=246) or (IsArrowDown(0)) or (IsArrowDown(2)) or (IsArrowDown(3)) or (IsFunctionKeyDown(0));
    end;

    procedure DotMoveDown;
    begin
    repeat
    FastDrawClear(Back,0);
    FastDrawClear(GDot,2990379);
    FastDrawTransparent(x,y,Dot,Back);
    FastDrawTransparent(x,y,Dot,GDot);
    y:=y+1;
    SafeDrawBitmap(Back,GetDebugCanvas,0,0);
    SafeDrawBitmap(GDot,GetDebugCanvas,a,z)
    Wait(10);
    until(y>=246) or (IsArrowDown(0)) or (IsArrowDown(1)) or (IsArrowDown(3)) or (IsFunctionKeyDown(0));
    end;

    procedure DotMoveRight;
    begin
    repeat
    FastDrawClear(Back,0);
    FastDrawClear(GDot,2990379);
    FastDrawTransparent(x,y,Dot,Back);
    FastDrawTransparent(x,y,Dot,GDot);
    x:=x-1;
    SafeDrawBitmap(Back,GetDebugCanvas,0,0);
    SafeDrawBitmap(GDot,GetDebugCanvas,a,z)
    Wait(10);
    until(x<=-1) or (IsArrowDown(0)) or (IsArrowDown(1)) or (IsArrowDown(2)) or (IsFunctionKeyDown(0));
    end;

    procedure DotMoveUp;
    begin
    repeat
    FastDrawClear(Back,0);
    FastDrawClear(GDot,2990379);
    FastDrawTransparent(x,y,Dot,Back);
    FastDrawTransparent(x,y,Dot,GDot);
    y:=y-1;
    SafeDrawBitmap(Back,GetDebugCanvas,0,0);
    SafeDrawBitmap(GDot,GetDebugCanvas,a,z)
    Wait(10);
    until(y<=-1) or (IsArrowDown(1)) or (IsArrowDown(2)) or (IsArrowDown(3)) or (IsFunctionKeyDown(0));
    end;

    begin
    SetUp;
    RandDot;

    repeat
    if (IsArrowDown(1)) then
    DotMoveLeft;

    if (IsArrowDown(2)) then
    DotMoveDown;

    if (IsArrowDown(3)) then
    DotMoveRight;

    if (IsArrowDown(0)) then
    DotMoveUp;

    if (x = a-5)and(y = z-5) or (x = a+5)and(y = z+5)
    or (x = a-4)and(y = z-4) or (x = a+4)and(y = z+4)
    or (x = a-3)and(y = z-3) or (x = a+3)and(y = z+3)
    or (x = a-2)and(y = z-2) or (x = a+2)and(y = z+2)
    or (x = a-1)and(y = z-1) or (x = a+1)and(y = z+1)
    or (x = a-0)and(y = z-0) or (x = a+0)and(y = z+0) then
    begin
    RandDot;
    Writeln('cool');
    end;

    until(false);
    end.

  2. #2
    Join Date
    Jul 2007
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    instead of

    SCAR Code:
    if (x = a-5)and(y = z-5) or (x = a+5)and(y = z+5)
    or (x = a-4)and(y = z-4) or (x = a+4)and(y = z+4)
    or (x = a-3)and(y = z-3) or (x = a+3)and(y = z+3)
    or (x = a-2)and(y = z-2) or (x = a+2)and(y = z+2)
    or (x = a-1)and(y = z-1) or (x = a+1)and(y = z+1)
    or (x = a-0)and(y = z-0) or (x = a+0)and(y = z+0) then

    try

    SCAR Code:
    for I:=0 to 5 do
    if (x = a-I) or (y = z-I) or (x = a-I) or (y = z-I) then

    it seems to work better for me when i try it (h)

    Nice game btw.

  3. #3
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Okej here i made your script using standards! VERY handy to use and i fixed it a bit up:
    The reason was, it was repeating moving the yellow dot up, but it wasn't checking the position. So i made a procedure CheckTheDot, it checks if the Yellow dot is in a area of 10*10 of the green dot using a handy function . Enjoy.
    SCAR Code:
    program DotGame;
    var
      Dot,Back,x,y,a,z,GDot:Integer;
      TheBox:TBox;

    procedure RandDot;
    begin
      a:= 1 + Random(244);
      z:= 1 + Random(245);
      SafeDrawBitmap(GDot,GetDebugCanvas,a,z)
    end;

    procedure SetUp;
    begin
      DisplayDebugImgWindow(250,250);
      ActivateClient;
      Dot:= BitmapFromString(5,5,'');
      GDot:= BitmapFromString(5,5,'');
      Back:= BitmapFromString(250,250,'');
      SafeDrawBitmap(Back,GetDebugCanvas,0,0);
      FastDrawClear(Dot,2480383);
      SafeDrawBitmap(Dot,GetDebugCanvas,125,125);
      RandDot;
      x := 125;
      y := 125;
    end;

    Procedure CheckTheDot;
    begin;
       TheBox.x1:=a-5;
       TheBox.y1:=z-5;
       TheBox.x2:=a+5;
       TheBox.y2:=z+5;
       if IntInBox(x,y,TheBox) then
       begin
        RandDot;
        Writeln('cool');
      end;
    end;

    procedure DotMoveLeft;
    begin
      repeat
        FastDrawClear(Back,0);
        FastDrawClear(GDot,2990379);
        FastDrawTransparent(x,y,Dot,Back);
        FastDrawTransparent(x,y,Dot,GDot);
        x:=x+1;
        SafeDrawBitmap(Back,GetDebugCanvas,0,0);
        SafeDrawBitmap(GDot,GetDebugCanvas,a,z);
        CheckTheDot;
        Wait(10);
      until(x>=246) or (IsArrowDown(0)) or (IsArrowDown(2)) or (IsArrowDown(3)) or (IsFunctionKeyDown(0));
    end;

    procedure DotMoveDown;
    begin
      repeat
        FastDrawClear(Back,0);
        FastDrawClear(GDot,2990379);
        FastDrawTransparent(x,y,Dot,Back);
        FastDrawTransparent(x,y,Dot,GDot);
        y:=y+1;
        SafeDrawBitmap(Back,GetDebugCanvas,0,0);
        SafeDrawBitmap(GDot,GetDebugCanvas,a,z);
        CheckTheDot;
        Wait(10);
      until(y>=246) or (IsArrowDown(0)) or (IsArrowDown(1)) or (IsArrowDown(3)) or (IsFunctionKeyDown(0));
    end;

    procedure DotMoveRight;
    begin
      repeat
        FastDrawClear(Back,0);
        FastDrawClear(GDot,2990379);
        FastDrawTransparent(x,y,Dot,Back);
        FastDrawTransparent(x,y,Dot,GDot);
        x:=x-1;
        SafeDrawBitmap(Back,GetDebugCanvas,0,0);
        SafeDrawBitmap(GDot,GetDebugCanvas,a,z);
        CheckTheDot;
        Wait(10);
      until(x<=-1) or (IsArrowDown(0)) or (IsArrowDown(1)) or (IsArrowDown(2)) or (IsFunctionKeyDown(0));
    end;

    procedure DotMoveUp;
    begin
      repeat
        FastDrawClear(Back,0);
        FastDrawClear(GDot,2990379);
        FastDrawTransparent(x,y,Dot,Back);
        FastDrawTransparent(x,y,Dot,GDot);
        y:=y-1;
        SafeDrawBitmap(Back,GetDebugCanvas,0,0);
        SafeDrawBitmap(GDot,GetDebugCanvas,a,z);
        CheckTheDot;
        Wait(10);
      until(y<=-1) or (IsArrowDown(1)) or (IsArrowDown(2)) or (IsArrowDown(3)) or (IsFunctionKeyDown(0));
    end;

    begin
      SetUp;
      repeat
        if (IsArrowDown(1)) then
          DotMoveLeft;
        if (IsArrowDown(2)) then
          DotMoveDown;
        if (IsArrowDown(3)) then
          DotMoveRight;
        if (IsArrowDown(0)) then
          DotMoveUp;
      until(false);
    end.
    Verrekte Koekwous

  4. #4
    Join Date
    Jun 2007
    Posts
    124
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hey thx guys

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. calculate the values and draw chart
    By Laimonas171 in forum C#/Visual Basic Help and Tutorials
    Replies: 2
    Last Post: 12-26-2008, 09:12 AM
  2. How to Draw Stuff In RS
    By Naum in forum RuneScape Guides
    Replies: 79
    Last Post: 10-13-2008, 11:05 AM
  3. Draw Pizza/ Cartwheel
    By n3ss3s in forum Research & Development Lounge
    Replies: 4
    Last Post: 03-01-2008, 08:02 PM
  4. "Draw" on Runescape?
    By Trifonius in forum OSR Help
    Replies: 17
    Last Post: 01-06-2008, 02:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •