TI99 Environment

# CALL_MOTION

Syntax

CALL_MOTION(sprite-number,yspd,xspd)

Description

This function changes the row-velocity, yspd and column-velocity, xspd of sprite sprite-number and sets (or maintains) the sprite in auto-motion in the direction established by the values in yspd and xspd. sprite-number values range between 1- maxsprites and the sprite must be active. (the Call_Sprite() function can be used to set new sprites in motion). The row and column velocities (yspd, xspd) may be from -128 to 127. If both the row and column velocities are zero, the sprite is stationary. A positive row velocity (yspd) moves the sprite down and a negative value moves it up. A positive column-velocity (xspd) moves the sprite to the right and a negative value moves it to the left. Programs that set sprites in auto-motion require a ti_sync() within the program loop instead of the built-in sync or fastsync statement.

Example Code

    Example 1:
    ` Call_Motion test using joystick
    speed = 10
    CALL_CLEAR()
    call_char(33,"7EA5819981BD817E")
    display_at(1,1,"Use joystick to move around",0)
    CALL_SPRITE(1,33,5,96,128,0,0)
    do
     CALL_JOYST(1,X,Y) : x = joystx : y = joysty
     CALL_MOTION(1,-Y * speed,X * speed)
     ti_sync()
    loop

    Example 2:
    ` Bouncing ball - Call_Motion Test
    call_char(42,"3c7effffffff7e3c")
    call_char(96,"0")
    CALL_SPRITE(1,42,5,92,128,0,0)
    call_hchar(13,1,96,32)
    call_colorchar(96,1,12)
    for xvel = -30 to 30 step 2
       for yvel = -50 to 50 step 2
          display_at(1,11,str$(xvel)+"   "+str$(yvel),0)
          CALL_MOTION(1,yvel,xvel)
          ti_sync()
       next yvel
    next xvel
    CALL_MOTION(1,0,0)
    call_char(42,call_charpat(95))
    tiwaitkey()
    end

Go back to ...

TI99E Commands Menu
Main Menu

Copyright © Carlos Santiago Lebron - TI99 Environment 2020