• wcCODE Snippet of the Day - Animated Text

    From Robert Wolfe@1:116/18 to All on Wed Feb 11 22:04:06 2015
    wcBASIC Code Snippet of the Day: "Animated Text"

    DISCLAIMER: I know this can be applied to regular BASIC as well, and it
    has no special features that are Wildcat! specific, but I am going to
    share this wcBASIC code anyway for those that are new to wcBASIC and
    don't have an ounce of BASIC programming knowledge. so please don't bust
    my chops about this.

    Someone new to wcBASIC was having an issue with trying to get lines of
    text to move down one line at a time on the screen (sorta "animated")
    So, in my usual kind way, I decided to give him a small piece of working sample code to help him get started and thought I would share it with
    the Wildcat! community at large:

    dim idx as integer
    dim txt as string = "This is a demonstration."
    dim blk as string = " "
    dim dly as integer = 1
    dim y as integer
    dim x as integer = 15

    cls
    for y = 1 to 15
    locate y, x
    print txt
    delay dly
    locate y, x
    print blk
    delay dly
    next y
    print
    waitenter

    Enjoy!!!!

    ... Air pollution is a mist demeanor.
    --- Wildcat! v6.4.454.2 (Nov 17 2011), Editor Mod v1.7
    * Origin: Wildcat! Wiki - http://wiki.winserver.us (1:116/18)
  • From Robert Wolfe@1:116/18 to All on Wed Feb 11 22:17:38 2015
    Actually, this version is a little bit better (and sorta formats better
    in FaceBook, too *smiles*):

    dim idx as integer
    dim txt as string = "This is a demonstration."
    dim blk as string = string(len(txt), " ")
    dim dly as integer = 1
    dim y as integer
    dim x as integer = 15

    cls
    for y = 1 to 15
    locate y, x
    print txt
    delay dly
    locate y, x
    print blk
    delay dly
    next y
    print
    waitenter

    In this version, no matter how long txt is, the blk (blank line) will
    always be the same length.

    ... All animals are equal, some more than others.
    --- Wildcat! v6.4.454.2 (Nov 17 2011), Editor Mod v1.7
    * Origin: Wildcat! Wiki - http://wiki.winserver.us (1:116/18)