Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Delays!!!! need help bad
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
xHoly-Divinity




PostPosted: Wed Dec 01, 2004 6:04 pm   Post subject: Delays!!!! need help bad

code:

var b, c, d, e : int

b := 50
c := 10

d := 10
e := 10

proc p1 (x, y : int)
    %head
    drawoval (50 + x, 200 + y, 20, 20, black)
    %body
    drawline (50 + x, 180 + y, 50 + x, 100 + y, black)
    %left leg
    drawline (50 + x, 100 + y, 30 + x, 50 + y, black)
    %right leg
    drawline (50 + x, 100 + y, 70 + x, 50 + y, black)
    %left arm
    drawline (50 + x, 140 + y, 10 + x, 160 + y, black)
    %right arm
    drawline (50 + x, 140 + y, 90 + x, 120 + y, black)
end p1

p1 (50, 10)

proc p1_erase (x, y : int)
    %head
    drawoval (50 + x, 200 + y, 20, 20, white)
    %body
    drawline (50 + x, 180 + y, 50 + x, 100 + y, white)
    %left leg
    drawline (50 + x, 100 + y, 30 + x, 50 + y, white)
    %right leg
    drawline (50 + x, 100 + y, 70 + x, 50 + y, white)
    %left arm
    drawline (50 + x, 140 + y, 10 + x, 160 + y, white)
    %right arm
    drawline (50 + x, 140 + y, 90 + x, 120 + y, white)
end p1_erase


proc p2 (x, y : int)
    %head
    drawoval (550 + x, 200 + y, 20, 20, black)
    %body
    drawline (550 + x, 180 + y, 550 + x, 100 + y, black)
    %left leg
    drawline (550 + x, 100 + y, 530 + x, 50 + y, black)
    %right leg
    drawline (550 + x, 100 + y, 570 + x, 50 + y, black)
    %left arm
    drawline (550 + x, 140 + y, 590 + x, 160 + y, black)
    %right arm
    drawline (550 + x, 140 + y, 510 + x, 120 + y, black)
end p2

proc p2_erase (x, y : int)
    %head
    drawoval (550 + x, 200 + y, 20, 20, white)
    %body
    drawline (550 + x, 180 + y, 550 + x, 100 + y, white)
    %left leg
    drawline (550 + x, 100 + y, 530 + x, 50 + y, white)
    %right leg
    drawline (550 + x, 100 + y, 570 + x, 50 + y, white)
    %left arm
    drawline (550 + x, 140 + y, 590 + x, 160 + y, white)
    %right arm
    drawline (550 + x, 140 + y, 510 + x, 120 + y, white)
end p2_erase
p2 (d, e)

loop
    c := 10
    e := 10
    %%%PLAYER 1%%%%%
    var chars : array char of boolean
    Input.KeyDown (chars)
    if chars ('f') then
        p1_erase (b, c)
        b := b + 1
        p1 (b, c)
        delay (10)
    elsif chars ('s') then
        p1_erase (b, c)
        b := b - 1
        p1 (b, c)
        delay (10)
    end if
    %%%%PLAYER 2%%%%%
    var chars2 : array char of boolean
    Input.KeyDown (chars2)
    if chars2 (KEY_RIGHT_ARROW) then
        p2_erase (d, e)
        d := d + 1
        p2 (d, e)
        delay (10)
    elsif chars2 (KEY_LEFT_ARROW) then
        p2_erase (d, e)
        d := d - 1
        p2 (d, e)
        delay (10)
    end loop


I am making a fighting game and am having some difficulty with the delays. The problem is when player 1 moves there is a 10millisecond delay (becase if there isn't a delay it will go super fast and I can't put decimals), and then when player 2 moves, there is another 10millisecond delay. When only one person moves at a time, there is a total delay of 10 milliseconds. But when both of them move at the same time, the delay becomes 20 and the game moves much slower. Any way to fix this, suggestions, or tips?
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Wed Dec 01, 2004 6:13 pm   Post subject: (No subject)

Don't use two seperate arrays for movement.
Instead use one array for simply keyboard input. Then go a single if-structure to account for ALL possible inputs (player 1 and player 2).
That way you'll only have 1 delay().
xHoly-Divinity




PostPosted: Wed Dec 01, 2004 6:22 pm   Post subject: (No subject)

hmm.... I am really not understanding what you are trying to say. WOuld you be able to send an example... Anyways, I changed the format around a little so that I am not moving the procedure because if I do it like that, then I won't be able to make it if the person punches, kicks, etc. This is my new way


code:

    var a, b, aa, bb : int
    a := 0
    b := 0
    aa := 0
    bb := 0

    %head
    drawoval (50 + a, 200 + b, 20, 20, black)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, black)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, black)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, black)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, black)

proc p1
    delay (10)
    %head
    drawoval (50 + a, 200 + b, 20, 20, white)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, white)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, white)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, white)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, white)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, white)
    a := a + 1
    %head
    drawoval (50 + a, 200 + b, 20, 20, black)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, black)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, black)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, black)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, black)
end p1


proc p2
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, white)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, white)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, white)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, white)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, white)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, white)
    aa := aa - 1
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, black)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, black)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, black)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, black)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)
    delay (10)
end p2



In this new code the same thing happens, but would you be able to send me an example of what you were reffering to?
MysticVegeta




PostPosted: Wed Dec 01, 2004 6:42 pm   Post subject: (No subject)

hmm, all i can do is tell you to simplify the top 5 lines into 1->
code:
var a, b, aa, bb :int := 0
Cervantes




PostPosted: Wed Dec 01, 2004 6:53 pm   Post subject: (No subject)

He means to do this:
code:

loop
    c := 10
    e := 10
    var chars : array char of boolean
    Input.KeyDown (chars)
    if chars ('f') then
        p1_erase (b, c)
        b := b + 1
        p1 (b, c)
    elsif chars ('s') then
        p1_erase (b, c)
        b := b - 1
        p1 (b, c)
    end if
    if chars (KEY_RIGHT_ARROW) then
        p2_erase (d, e)
        d := d + 1
        p2 (d, e)
    elsif chars (KEY_LEFT_ARROW) then
        p2_erase (d, e)
        d := d - 1
        p2 (d, e)
    end if
    delay (10)
end loop
xHoly-Divinity




PostPosted: Wed Dec 01, 2004 7:04 pm   Post subject: (No subject)

Wow!!! I can't believe i didn't get that i feel like a dumbass, lol. Anyways, thanks guys!
xHoly-Divinity




PostPosted: Wed Dec 01, 2004 7:16 pm   Post subject: (No subject)

Sorry, now I have another problem Confused !!! WHen either player hits e.g. punches/kicks I have to put in a delay so that the graphic can be shown therfore adding an extra delay (i put delay (100)). ANyways, if player 1 gets punched, and player 2 just holds the key for punch, player 1 will not be able to "get out of the punch" and will keep getting hit. Is there a way to empty the keyboard buffer so that once a key is pressed then do the procedure as opposed to if the key is down do the procedure???
Delos




PostPosted: Wed Dec 01, 2004 8:39 pm   Post subject: (No subject)

Well, you could always use Input.Flush...
but I'm not sure if that will solve your problem.

What you may want to do is include a timed delay factor to your punches and kicks...
So one player presses (and holds) punch (in an effort to exploit any possible bugs)...your procedure starts. It also notes down the runtime (Time.Elapsed). When it's done, the loop is returned to. Momentarily, it realises that the key is still pressed, and calls the procedure again. The procedure compares the current runtime with the noted down value, and finds that just a few milliseconds have passed, so it does not execute.
Of course you'll have to look into other things like FPS limiting for this to be effective on any given system (OOT has a bad habit of use CPU speeds to determine delays as opposed to actual time counters - AFAIK).
Sponsor
Sponsor
Sponsor
sponsor
xHoly-Divinity




PostPosted: Wed Dec 01, 2004 10:35 pm   Post subject: (No subject)

code:


var a, b, aa, bb : int := 0

var E1, E2 : int := 20

%head
drawoval (50 + a, 200 + b, 20, 20, black)
%body
drawline (50 + a, 180 + b, 50 + a, 100 + b, black)
%left leg
drawline (50 + a, 100 + b, 30 + a, 50 + b, black)
%right leg
drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
%left arm
drawline (50 + a, 140 + b, 10 + a, 160 + b, black)
%right arm
drawline (50 + a, 140 + b, 90 + a, 120 + b, black)

%head
drawoval (550 + aa, 200 + bb, 20, 20, black)
%body
drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, black)
%left leg
drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
%right leg
drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, black)
%left arm
drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, black)
%right arm
drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)

proc p1_right
    %head
    drawoval (50 + a, 200 + b, 20, 20, white)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, white)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, white)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, white)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, white)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, white)
    a := a + 1
    %head
    drawoval (50 + a, 200 + b, 20, 20, black)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, black)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, black)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, black)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, black)
end p1_right

proc p1_left
    %head
    drawoval (50 + a, 200 + b, 20, 20, white)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, white)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, white)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, white)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, white)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, white)
    a := a - 1
    %head
    drawoval (50 + a, 200 + b, 20, 20, black)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, black)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, black)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, black)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, black)
end p1_left

proc p2_right
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, white)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, white)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, white)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, white)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, white)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, white)
    aa := aa + 1
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, black)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, black)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, black)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, black)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)
end p2_right

proc p2_left
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, white)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, white)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, white)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, white)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, white)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, white)
    aa := aa - 1
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, black)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, black)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, black)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, black)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)
end p2_left

proc p2_punch
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, white)
    drawline (550 + aa, 140 + bb, 470 + aa, 200 + bb, black)
    delay (100)
    drawline (550 + aa, 140 + bb, 470 + aa, 200 + bb, white)
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)
end p2_punch

proc p1_punch
    drawline (50 + a, 140 + b, 90 + a, 120 + b, white)
    drawline (50 + a, 140 + b, 130 + a, 200 + b, black)
    delay (100)
    drawline (50 + a, 140 + b, 130 + a, 200 + b, white)
    drawline (50 + a, 140 + b, 90 + a, 120 + b, black)
end p1_punch

proc p2_highkick
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, white)
    drawline (550 + aa, 100 + bb, 480 + aa, 200 + bb, black)
    delay (100)
    drawline (550 + aa, 100 + bb, 480 + aa, 200 + bb, white)
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
end p2_highkick

proc p1_highkick
    drawline (50 + a, 100 + b, 70 + a, 50 + b, white)
    drawline (50 + a, 100 + b, 120 + a, 200 + b, black)
    delay (100)
    drawline (50 + a, 100 + b, 120 + a, 200 + b, white)
    drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
end p1_highkick

loop
    delay (10)
    if E1 = 20 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 19 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 5, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 18 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 10, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 17 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 15, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 16 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 20, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 15 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 25, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 14 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 30, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 13 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 35, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 12 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 40, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 11 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 45, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 10 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 50, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 9 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 55, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 8 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 60, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 7 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 65, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 6 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 70, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 5 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 75, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 4 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 80, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 3 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 85, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 2 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 90, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 1 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 95, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 0 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    end if


    if E2 = 20 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 19 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 5, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 18 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 10, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 17 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 15, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 16 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 20, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 15 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 25, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 14 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 30, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 13 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 35, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 12 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 40, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 11 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 45, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 10 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 50, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 9 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 55, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 8 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 60, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 7 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 65, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 6 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 70, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 5 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 75, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 4 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 80, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 3 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 85, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 2 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 90, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 1 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 95, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 0 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    end if

    var chars : array char of boolean
    Input.KeyDown (chars)
    if chars ('f') then
        p1_right
    elsif chars ('s') then
        p1_left
    elsif chars (',') then
        p1_punch
        if Math.DistancePointLine (550 + aa, 200 + bb, 50 + a, 140 + b, 130 + a, 200 + b) < 20 then
            E2 := E2 - 1
        end if
    elsif chars ('.') then
        p1_highkick
        if Math.DistancePointLine (550 + aa, 200 + bb, 50 + a, 140 + b, 120 + a, 200 + b) < 20 then
            E2 := E2 - 2
        end if
    end if
    var chars2 : array char of boolean
    Input.KeyDown (chars2)
    if chars2 (KEY_LEFT_ARROW) then
        p2_left
    elsif chars2 (KEY_RIGHT_ARROW) then
        p2_right
    elsif chars2 (KEY_CTRL) then
        p2_punch
        if Math.DistancePointLine (50 + a, 200 + b, 550 + aa, 140 + bb, 470 + aa, 200 + bb) < 20 then
            E1 := E1 - 1
        end if
    elsif chars2 (KEY_SHIFT) then
        p2_highkick
        if Math.DistancePointLine (50 + a, 200 + b, 550 + aa, 140 + bb, 480 + aa, 200 + bb) < 20 then
            E1 := E1 - 2
        end if
    end if
end loop


Well there is the code. Feel free to test it out. I have tried the Input.Flush function, although this really does not change anything. See if you could find another way, that would be greatly apreciated Smile Smile Smile
xHoly-Divinity




PostPosted: Wed Dec 01, 2004 10:43 pm   Post subject: (No subject)

code:

%All credit goes to Ivan c. and all the people at CompSci that have helped me out! =D
var a, b, aa, bb : int := 0

var E1, E2 : int := 20

%head
drawoval (50 + a, 200 + b, 20, 20, black)
%body
drawline (50 + a, 180 + b, 50 + a, 100 + b, black)
%left leg
drawline (50 + a, 100 + b, 30 + a, 50 + b, black)
%right leg
drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
%left arm
drawline (50 + a, 140 + b, 10 + a, 160 + b, black)
%right arm
drawline (50 + a, 140 + b, 90 + a, 120 + b, black)

%head
drawoval (550 + aa, 200 + bb, 20, 20, black)
%body
drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, black)
%left leg
drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
%right leg
drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, black)
%left arm
drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, black)
%right arm
drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)

proc p1_right
    %head
    drawoval (50 + a, 200 + b, 20, 20, white)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, white)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, white)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, white)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, white)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, white)
    a := a + 1
    %head
    drawoval (50 + a, 200 + b, 20, 20, black)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, black)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, black)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, black)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, black)
end p1_right

proc p1_left
    %head
    drawoval (50 + a, 200 + b, 20, 20, white)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, white)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, white)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, white)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, white)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, white)
    a := a - 1
    %head
    drawoval (50 + a, 200 + b, 20, 20, black)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, black)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, black)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, black)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, black)
end p1_left

proc p2_right
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, white)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, white)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, white)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, white)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, white)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, white)
    aa := aa + 1
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, black)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, black)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, black)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, black)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)
end p2_right

proc p2_left
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, white)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, white)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, white)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, white)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, white)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, white)
    aa := aa - 1
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, black)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, black)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, black)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, black)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)
end p2_left

proc p2_punch
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, white)
    drawline (550 + aa, 140 + bb, 470 + aa, 200 + bb, black)
    delay (100)
    drawline (550 + aa, 140 + bb, 470 + aa, 200 + bb, white)
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)
end p2_punch

proc p1_punch
    drawline (50 + a, 140 + b, 90 + a, 120 + b, white)
    drawline (50 + a, 140 + b, 130 + a, 200 + b, black)
    delay (100)
    drawline (50 + a, 140 + b, 130 + a, 200 + b, white)
    drawline (50 + a, 140 + b, 90 + a, 120 + b, black)
end p1_punch

proc p2_highkick
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, white)
    drawline (550 + aa, 100 + bb, 480 + aa, 200 + bb, black)
    delay (100)
    drawline (550 + aa, 100 + bb, 480 + aa, 200 + bb, white)
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
end p2_highkick

proc p1_highkick
    drawline (50 + a, 100 + b, 70 + a, 50 + b, white)
    drawline (50 + a, 100 + b, 120 + a, 200 + b, black)
    delay (100)
    drawline (50 + a, 100 + b, 120 + a, 200 + b, white)
    drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
end p1_highkick

loop
    delay (10)
    if E1 = 20 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 19 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 5, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 18 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 10, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 17 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 15, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 16 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 20, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 15 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 25, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 14 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 30, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 13 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 35, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 12 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 40, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 11 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 45, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 10 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 50, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 9 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 55, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 8 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 60, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 7 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 65, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 6 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 70, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 5 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 75, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 4 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 80, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 3 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 85, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 2 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 90, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 1 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 95, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 0 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    end if


    if E2 = 20 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 19 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 5, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 18 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 10, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 17 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 15, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 16 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 20, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 15 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 25, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 14 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 30, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 13 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 35, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 12 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 40, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 11 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 45, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 10 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 50, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 9 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 55, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 8 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 60, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 7 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 65, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 6 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 70, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 5 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 75, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 4 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 80, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 3 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 85, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 2 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 90, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 1 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 95, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 0 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    end if

    var chars : array char of boolean
    Input.KeyDown (chars)
    if chars ('f') then
        p1_right
    elsif chars ('s') then
        p1_left
    elsif chars (',') then
        p1_punch
        if Math.DistancePointLine (550 + aa, 200 + bb, 50 + a, 140 + b, 130 + a, 200 + b) < 20 then
            E2 := E2 - 1
        end if
    elsif chars ('.') then
        p1_highkick
        if Math.DistancePointLine (550 + aa, 200 + bb, 50 + a, 140 + b, 120 + a, 200 + b) < 20 then
            E2 := E2 - 2
        end if
    end if
    var chars2 : array char of boolean
    Input.KeyDown (chars2)
    if chars2 (KEY_LEFT_ARROW) then
        p2_left
    elsif chars2 (KEY_RIGHT_ARROW) then
        p2_right
    elsif chars2 (KEY_CTRL) then
        p2_punch
        if Math.DistancePointLine (50 + a, 200 + b, 550 + aa, 140 + bb, 470 + aa, 200 + bb) < 20 then
            E1 := E1 - 1
        end if
    elsif chars2 (KEY_SHIFT) then
        p2_highkick
        if Math.DistancePointLine (50 + a, 200 + b, 550 + aa, 140 + bb, 480 + aa, 200 + bb) < 20 then
            E1 := E1 - 2
        end if
    end if
end loop


Well there is the code so far. Fell free to test it out. Please see if you can fix the problem. I have tried to use Input.Flush although it does not help. It would be greatly appreciated if you could help out!
xHoly-Divinity




PostPosted: Wed Dec 01, 2004 11:03 pm   Post subject: (No subject)

code:

%All credit goes to Ivan c. and all the people at CompSci that have helped me out! =D
var a, b, aa, bb : int := 0

var E1, E2 : int := 20

%head
drawoval (50 + a, 200 + b, 20, 20, black)
%body
drawline (50 + a, 180 + b, 50 + a, 100 + b, black)
%left leg
drawline (50 + a, 100 + b, 30 + a, 50 + b, black)
%right leg
drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
%left arm
drawline (50 + a, 140 + b, 10 + a, 160 + b, black)
%right arm
drawline (50 + a, 140 + b, 90 + a, 120 + b, black)

%head
drawoval (550 + aa, 200 + bb, 20, 20, black)
%body
drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, black)
%left leg
drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
%right leg
drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, black)
%left arm
drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, black)
%right arm
drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)

proc p1_right
    %head
    drawoval (50 + a, 200 + b, 20, 20, white)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, white)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, white)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, white)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, white)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, white)
    a := a + 1
    %head
    drawoval (50 + a, 200 + b, 20, 20, black)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, black)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, black)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, black)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, black)
end p1_right

proc p1_left
    %head
    drawoval (50 + a, 200 + b, 20, 20, white)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, white)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, white)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, white)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, white)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, white)
    a := a - 1
    %head
    drawoval (50 + a, 200 + b, 20, 20, black)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, black)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, black)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, black)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, black)
end p1_left

proc p2_right
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, white)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, white)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, white)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, white)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, white)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, white)
    aa := aa + 1
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, black)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, black)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, black)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, black)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)
end p2_right

proc p2_left
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, white)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, white)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, white)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, white)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, white)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, white)
    aa := aa - 1
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, black)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, black)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, black)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, black)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)
end p2_left

proc p2_punch
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, white)
    drawline (550 + aa, 140 + bb, 470 + aa, 200 + bb, black)
    delay (100)
    drawline (550 + aa, 140 + bb, 470 + aa, 200 + bb, white)
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)
end p2_punch

proc p1_punch
    drawline (50 + a, 140 + b, 90 + a, 120 + b, white)
    drawline (50 + a, 140 + b, 130 + a, 200 + b, black)
    delay (100)
    drawline (50 + a, 140 + b, 130 + a, 200 + b, white)
    drawline (50 + a, 140 + b, 90 + a, 120 + b, black)
end p1_punch

proc p2_highkick
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, white)
    drawline (550 + aa, 100 + bb, 480 + aa, 200 + bb, black)
    delay (100)
    drawline (550 + aa, 100 + bb, 480 + aa, 200 + bb, white)
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
end p2_highkick

proc p1_highkick
    drawline (50 + a, 100 + b, 70 + a, 50 + b, white)
    drawline (50 + a, 100 + b, 120 + a, 200 + b, black)
    delay (100)
    drawline (50 + a, 100 + b, 120 + a, 200 + b, white)
    drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
end p1_highkick

loop
    delay (10)
    if E1 = 20 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 19 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 5, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 18 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 10, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 17 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 15, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 16 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 20, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 15 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 25, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 14 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 30, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 13 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 35, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 12 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 40, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 11 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 45, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 10 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 50, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 9 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 55, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 8 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 60, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 7 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 65, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 6 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 70, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 5 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 75, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 4 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 80, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 3 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 85, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 2 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 90, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 1 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 95, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 0 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    end if


    if E2 = 20 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 19 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 5, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 18 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 10, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 17 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 15, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 16 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 20, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 15 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 25, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 14 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 30, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 13 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 35, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 12 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 40, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 11 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 45, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 10 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 50, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 9 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 55, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 8 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 60, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 7 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 65, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 6 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 70, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 5 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 75, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 4 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 80, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 3 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 85, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 2 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 90, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 1 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 95, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 0 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    end if

    var chars : array char of boolean
    Input.KeyDown (chars)
    if chars ('f') then
        p1_right
    elsif chars ('s') then
        p1_left
    elsif chars (',') then
        p1_punch
        if Math.DistancePointLine (550 + aa, 200 + bb, 50 + a, 140 + b, 130 + a, 200 + b) < 20 then
            E2 := E2 - 1
        end if
    elsif chars ('.') then
        p1_highkick
        if Math.DistancePointLine (550 + aa, 200 + bb, 50 + a, 140 + b, 120 + a, 200 + b) < 20 then
            E2 := E2 - 2
        end if
    end if
    var chars2 : array char of boolean
    Input.KeyDown (chars2)
    if chars2 (KEY_LEFT_ARROW) then
        p2_left
    elsif chars2 (KEY_RIGHT_ARROW) then
        p2_right
    elsif chars2 (KEY_CTRL) then
        p2_punch
        if Math.DistancePointLine (50 + a, 200 + b, 550 + aa, 140 + bb, 470 + aa, 200 + bb) < 20 then
            E1 := E1 - 1
        end if
    elsif chars2 (KEY_SHIFT) then
        p2_highkick
        if Math.DistancePointLine (50 + a, 200 + b, 550 + aa, 140 + bb, 480 + aa, 200 + bb) < 20 then
            E1 := E1 - 2
        end if
    end if
end loop


Well there is the code so far. Fell free to test it out. Please see if you can fix the problem. I have tried to use Input.Flush although it does not help. It would be greatly appreciated if you could help out!
xHoly-Divinity




PostPosted: Wed Dec 01, 2004 11:04 pm   Post subject: (No subject)

code:

%All credit goes to Ivan c. and all the people at CompSci that have helped me out! =D
var a, b, aa, bb : int := 0

var E1, E2 : int := 20

%head
drawoval (50 + a, 200 + b, 20, 20, black)
%body
drawline (50 + a, 180 + b, 50 + a, 100 + b, black)
%left leg
drawline (50 + a, 100 + b, 30 + a, 50 + b, black)
%right leg
drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
%left arm
drawline (50 + a, 140 + b, 10 + a, 160 + b, black)
%right arm
drawline (50 + a, 140 + b, 90 + a, 120 + b, black)

%head
drawoval (550 + aa, 200 + bb, 20, 20, black)
%body
drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, black)
%left leg
drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
%right leg
drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, black)
%left arm
drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, black)
%right arm
drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)

proc p1_right
    %head
    drawoval (50 + a, 200 + b, 20, 20, white)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, white)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, white)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, white)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, white)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, white)
    a := a + 1
    %head
    drawoval (50 + a, 200 + b, 20, 20, black)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, black)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, black)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, black)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, black)
end p1_right

proc p1_left
    %head
    drawoval (50 + a, 200 + b, 20, 20, white)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, white)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, white)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, white)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, white)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, white)
    a := a - 1
    %head
    drawoval (50 + a, 200 + b, 20, 20, black)
    %body
    drawline (50 + a, 180 + b, 50 + a, 100 + b, black)
    %left leg
    drawline (50 + a, 100 + b, 30 + a, 50 + b, black)
    %right leg
    drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
    %left arm
    drawline (50 + a, 140 + b, 10 + a, 160 + b, black)
    %right arm
    drawline (50 + a, 140 + b, 90 + a, 120 + b, black)
end p1_left

proc p2_right
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, white)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, white)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, white)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, white)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, white)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, white)
    aa := aa + 1
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, black)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, black)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, black)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, black)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)
end p2_right

proc p2_left
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, white)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, white)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, white)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, white)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, white)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, white)
    aa := aa - 1
    %head
    drawoval (550 + aa, 200 + bb, 20, 20, black)
    %body
    drawline (550 + aa, 180 + bb, 550 + aa, 100 + bb, black)
    %left leg
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
    %right leg
    drawline (550 + aa, 100 + bb, 570 + aa, 50 + bb, black)
    %left arm
    drawline (550 + aa, 140 + bb, 590 + aa, 160 + bb, black)
    %right arm
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)
end p2_left

proc p2_punch
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, white)
    drawline (550 + aa, 140 + bb, 470 + aa, 200 + bb, black)
    delay (100)
    drawline (550 + aa, 140 + bb, 470 + aa, 200 + bb, white)
    drawline (550 + aa, 140 + bb, 510 + aa, 120 + bb, black)
end p2_punch

proc p1_punch
    drawline (50 + a, 140 + b, 90 + a, 120 + b, white)
    drawline (50 + a, 140 + b, 130 + a, 200 + b, black)
    delay (100)
    drawline (50 + a, 140 + b, 130 + a, 200 + b, white)
    drawline (50 + a, 140 + b, 90 + a, 120 + b, black)
end p1_punch

proc p2_highkick
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, white)
    drawline (550 + aa, 100 + bb, 480 + aa, 200 + bb, black)
    delay (100)
    drawline (550 + aa, 100 + bb, 480 + aa, 200 + bb, white)
    drawline (550 + aa, 100 + bb, 530 + aa, 50 + bb, black)
end p2_highkick

proc p1_highkick
    drawline (50 + a, 100 + b, 70 + a, 50 + b, white)
    drawline (50 + a, 100 + b, 120 + a, 200 + b, black)
    delay (100)
    drawline (50 + a, 100 + b, 120 + a, 200 + b, white)
    drawline (50 + a, 100 + b, 70 + a, 50 + b, black)
end p1_highkick

loop
    delay (10)
    if E1 = 20 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 19 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 5, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 18 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 10, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 17 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 15, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 16 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 20, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 15 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 25, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 14 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 30, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 13 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 35, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 12 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 40, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 11 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 45, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 10 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 50, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 9 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 55, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 8 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 60, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 7 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 65, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 6 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 70, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 5 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 75, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 4 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 80, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 3 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 85, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 2 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 90, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 1 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawfillbox (10, maxy - 50, 110 - 95, maxy - 60, green)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    elsif E1 = 0 then
        drawfillbox (10, maxy - 50, 110, maxy - 60, white)
        drawbox (10, maxy - 50, 110, maxy - 60, black)
    end if


    if E2 = 20 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 19 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 5, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 18 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 10, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 17 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 15, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 16 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 20, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 15 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 25, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 14 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 30, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 13 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 35, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 12 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 40, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 11 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 45, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 10 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 50, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 9 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 55, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 8 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 60, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 7 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 65, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 6 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 70, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 5 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 75, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 4 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 80, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 3 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 85, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 2 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 90, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 1 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawfillbox (500, maxy - 50, 600 - 95, maxy - 60, green)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    elsif E2 = 0 then
        drawfillbox (500, maxy - 50, 600, maxy - 60, white)
        drawbox (500, maxy - 50, 600, maxy - 60, black)
    end if

    var chars : array char of boolean
    Input.KeyDown (chars)
    if chars ('f') then
        p1_right
    elsif chars ('s') then
        p1_left
    elsif chars (',') then
        p1_punch
        if Math.DistancePointLine (550 + aa, 200 + bb, 50 + a, 140 + b, 130 + a, 200 + b) < 20 then
            E2 := E2 - 1
        end if
    elsif chars ('.') then
        p1_highkick
        if Math.DistancePointLine (550 + aa, 200 + bb, 50 + a, 140 + b, 120 + a, 200 + b) < 20 then
            E2 := E2 - 2
        end if
    end if
    var chars2 : array char of boolean
    Input.KeyDown (chars2)
    if chars2 (KEY_LEFT_ARROW) then
        p2_left
    elsif chars2 (KEY_RIGHT_ARROW) then
        p2_right
    elsif chars2 (KEY_CTRL) then
        p2_punch
        if Math.DistancePointLine (50 + a, 200 + b, 550 + aa, 140 + bb, 470 + aa, 200 + bb) < 20 then
            E1 := E1 - 1
        end if
    elsif chars2 (KEY_SHIFT) then
        p2_highkick
        if Math.DistancePointLine (50 + a, 200 + b, 550 + aa, 140 + bb, 480 + aa, 200 + bb) < 20 then
            E1 := E1 - 2
        end if
    end if
end loop


Well there is the code so far. Fell free to test it out. Please see if you can fix the problem. I have tried to use Input.Flush although it does not help. It would be greatly appreciated if you could help out!
Delos




PostPosted: Thu Dec 02, 2004 12:31 am   Post subject: (No subject)

Dude, you just quadruple posted! And your last 2 posts were the same thing!
Viper




PostPosted: Thu Dec 02, 2004 2:12 pm   Post subject: (No subject)

y dont you just use 2 or 5 as your delay bc then a total delay of 10 or 4 would happen
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 14 Posts ]
Jump to:   


Style:  
Search: