.exe file

I 've wrote a program to move a snake of characters around the screen, but I dont know how to get the .exe file, I tried the make and biuld option thinking that was it but it didn't do it. I runs fine when I execute it from the compiler, but I would like it to execute independantly.

Comments

  • : I 've wrote a program to move a snake of characters around the
    : screen, but I dont know how to get the .exe file, I tried the make
    : and biuld option thinking that was it but it didn't do it. I runs
    : fine when I execute it from the compiler, but I would like it to
    : execute independantly.
    :
    Make sure the build output goes to the disk instead of the memory. There's an option for that. Check the help files for where.
  • its working now, thanks


  • : I 've wrote a program to move a snake of characters around the
    : screen, but I dont know how to get the .exe file, I tried the make
    : and biuld option thinking that was it but it didn't do it. I runs
    : fine when I execute it from the compiler, but I would like it to
    : execute independantly.
    :

    [code]
    repeat
    key := readkey;
    if key = '2' then
    moveDown;
    if key = '8' then
    moveUp;
    if key = '4' then
    moveLeft;
    if key = '6' then
    moveRight;
    until key = 'e';
    [/code]

    Thought you might want this code. It'll let you use either arrow keys
    [code]
    repeat
    key := readkey;
    Case key Of
    #0 : Begin
    key := Readkey;
    Case key Of
    #72 : moveUp;
    #75 : moveLeft;
    #77 : moveRight;
    #80 : moveDown;
    End;

    key := #1;
    { I set key to #1 so that if you use
    'If Keypressed Then Key := Readkey;' it won't get some
    extended key that matches 'e' or something else you
    don't want it to. Good for when you want user input,
    but don't want a game to stop moving while waiting }
    End;
    '2' : moveDown;
    '8' : moveUp;
    '4' : moveLeft;
    '6' : moveRight;
    End;
    until Upcase(key) = 'E';
    [/code]


    Also, the following two lines do the same thing, although DEC() is shorter and more commonly used:
    [code]
    num := Pred(num); { num := num - 1; }
    Dec(num); { num := num - 1; }
    [/code]

    Phat Nat
  • thanks man thats really cool.

    I was going to shorten the code a little as well, in that version I have a seperate procedure for each movement, although they all do pretty much the same thing, so I am just going to write a move proccedure which takes in a string, to identify if its to be moved left right etc and a number of if statements to move the xy coordinates of the head of the snake dependanding on whats called.

    Also do you know what the code is for the escape key, that would probably be better than the letter E. Thanks for the help

    Gerard
  • : thanks man thats really cool.
    :
    : I was going to shorten the code a little as well, in that version I
    : have a seperate procedure for each movement, although they all do
    : pretty much the same thing, so I am just going to write a move
    : proccedure which takes in a string, to identify if its to be moved
    : left right etc and a number of if statements to move the xy
    : coordinates of the head of the snake dependanding on whats called.
    :
    : Also do you know what the code is for the escape key, that would
    : probably be better than the letter E. Thanks for the help
    :
    : Gerard
    :
    Here's a very handy code to see the key presses:
    [code]
    begin
    write('Press a key: ');
    ch = ReadKey;
    if ch = 0 then begin
    ch = ReadKey;
    writeln('Extended key: ', byte(ch));
    end else begin
    writeln('Simple key: ', byte(ch));
    end;
    readln;
    end.
    [/code]
    It gives you the number of the key. To enter the key into the code, prefix a # before the number.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories