A83: Re: Snake Game


[Prev][Next][Index][Thread]

A83: Re: Snake Game



the problem with the code was the fact that direct input (which you used)
needs a small delay. Your key handling routines were not slow enough to keep
the DI from repeating. I've solved it by including two halt statements
before the DI was read from the keyboard. The only problem at this time is
that when you press a key that changes direction, the snake goes a bit
faster. I've tried solving it (with succes) using a djnz loop. Instead of
the two halt statements, you should include this code: (this code will
adjust the keypress-speed with the current gamespeed @ addres bcle)

previous:

    halt
    halt

new:

    push bc
keydelay:
    halt
    djnz keydelay
    pop bc

This should help you get the game fixed. Any comments and or replies are
welcome @ dsfs98@concepts.nl

c u 183r,

Frank
-----Oorspronkelijk bericht-----
    Van: ti-83 <ti-83@libertysurf.fr>
    Aan: Assembly-83 <assembly-83@lists.ticalc.org>
    Datum: dinsdag 18 juli 2000 19:32
    Onderwerp: A83: Snake Game


    I'm making a snake game, but the code for the snake move has a problem.
At the beginning, when the game start, the snake has the good speed, but
when I press a key, the snake go faster and the game become unplayable.
Could someone say me why ?
    The code is in the attached file.

    Ti-83
    Le monde de la TI-83
    http://www.ti-83.fr.st
    ti-83@fr.st

serpent.z80