TI99 Environment

# CALL_CREATEANIMATION

Syntax

CALL_CREATEANIMATION(AnimNum,BegFrame,NumofFrames,FrameSize)

Description

This function defines the sprite animation sequence. AnimNum is a unique number (integer) that identifies your animation. BegFrame is the begininning ASCII character image for the animation. For double-sized sprites (size 3 or 4) BegFrame must be an ASCII number divisible by four. NumofFrames is the number of animation frames in the animation. This is NOT the same as the number of characters that comprise the animation. For example, a double sized sprite with 2 animation frames consists of 8 ASCII characters, however, NumofFrames = 2. FrameSize is the number of characters used per frame. Enter 1 for sprites with size 1 or 2. Enter 4 for sprites with size 3 or 4. The function will calculate the ending ASCII character based on NumofFrames and FrameSize. Example 1: CALL_CREATEANIMATION(1,127,5,1) Creates an animation sequence (Animation Number 1) of 5 frames consisting of 1 character each, for a total of 5 characters. This is a typical definition for single sized sprites (sprites magnified at 1 or 2). In this example, the function will set 127 as the beginning ASCII character in the animation sequence and 131 as the ending character (127 + 5 -1). Animation frame 1: character 127 Animation frame 2: character 128 Animation frame 3: character 129 Animation frame 4: character 130 Animation frame 5: character 131 Example 2: CALL_CREATEANIMATION(1,132,4,4) Creates an animation sequence of 4 frames consisting of 4 characters each, for a total of 16 characters. This is a typical definition for double sized sprites (sprites magnified at 3 or 4). The function will set 132 as the beginning ASCII character in the animation sequence (an ASCII number divisible by 4) and 147 as the ending character (132 + 16 -1). Animation frame 1: character 132 (ending character 135) Animation frame 2: character 136 (ending character 139) Animation frame 3: character 140 (ending character 143) Animation frame 4: character 144 (ending character 147) During program execution, every time TI_SYNC() is called, the animation frames will be displayed sequentially, starting at frame 1, in a constant loop until paused, stopped, or deleted by the program. For single sized sprites, the program automatically increments one character after every frame during the animation sequence. For double sized sprites, the program automatically increments 4 characters after every frame. This increment is based on the FrameSize parameter. If you have single and double sized sprites mixed in the program, make sure to use the call_magnifysprite() function to set the size of individual sprites and to set the correct FrameSize (1 or 4) in this function. The Call_CreateAnimation() function has no visible animation effect by itself. It has to be used in conjunction with Call_Sprite() and Call_CreateAnimatedSprite() to reveal its intended effect.

Example Code

    call_screen(2)
    randomize hitimer()
    call_char(128,"38181D8FC2A3B7AF6F5F17070302040A383070E2868ADAEAECF4D0C0808040A0")
    call_char(132,"38181D0F82C3A7B7AF6F5F170302040A383070E08286CADAEAECF4D0808040A0")
    call_char(136,"38181D0F0283C7A7B7AF6F5F1302040A383070E08082C6CADAEAECF4908040A0")
    Call_CreateAnimation(1,128,3,4)
    Call_CreateAnimation(2,128,3,4)
    call_magnify(3)
    call_sprite(999,128,6,100,100,-2,2)
    call_sprite(1,128,4,100,100,-2,-2)
    Call_CreateAnimatedSprite(999,2,200) ` Start animation sprite 999
    Call_CreateAnimatedSprite(1,1,200)   ` Start animation sprite 1
    tiwaitkey()
    call_colorsprite(1,rnd(13)+3)
    call_colorsprite(999,rnd(13)+3)
    tiwaitkey()
    CALL_DELETEANIMATION(1)  ` Stop and delete animation 1 (sprite 1)
    tiwaitkey()
    call_sprite(1,128,4,100,100,-2,-2)   `Build Sprite 1 again - not animated
    tiwaitkey()
    end

Go back to ...

TI99E Commands Menu
Main Menu

Copyright © Carlos Santiago Lebron - TI99 Environment 2020