![]() |
| TI99 Environment |
| Syntax |
| integer-variable = CALL_POSITIONX(sprite-number) |
| integer-variable = CALL_POSITIONY(sprite-number) |
| Description |
|
The CALL_POSITIONX function returns the x position of sprite sprite-number. The CALL_POSITIONY function returns the y position of sprite sprite-number. The position returned is the upper left corner of the sprite. If the sprite is set in auto-motion, it will continue to move after its position is returned, so that must be allowed for; the distance it moves depends on the sprite's velocity. Valid function values CALL_POSITIONX(): sprite-number: accepts an integer between 1-maxsprites. integer-variable: returns a value between 1 and 256. Valid function values CALL_POSITIONY(): sprite-number: accepts an integer between 1-maxsprites. integer-variable: returns a value between 1 and 256 (positions 193-256 are not visible on the screen). |
| Example Code |
call_screen(15)
mgn = 4 : call_magnify(mgn)
sx = 1 : sy = 1 : dly = 25
a$ = rpt$("f",63)+"e" : call_char(128,a$)
display_at(1,1,"Arrows-Move,ENTER-Chng size",0)
call_sprite(1,128,rnd(12) + 2,sy,sx,0,0) ` Displays sprites
do
cslx = CALL_POSITIONX(1)
csly = CALL_POSITIONY(1)
display_at(23,2,"X:" + str$(cslx) + " Y:" + str$(csly)+ " MAG:" + str$(mgn),0)
tiwait(dly)
if upkey() then dy = -1
if downkey() then dy = 1
if leftkey() then dx = -1
if rightkey() then dx = 1
if inkey$() = chr$(13)
inc mgn : tiwait(dly)
if mgn > 4 then mgn = 1
call_magnify(mgn)
ENDIF
if sx + dx > swidth then sx = 1 : dx = 0
if sx + dx < 1 then sx = swidth : dx =0
if sy + dy > swidth then sy = 1 : dy = 0
if sy + dy < 1 then sy = swidth : dy =0
inc sx,dx : inc sy,dy : dx = 0 : dy = 0
call_locate(1,sy,sx)
loop
Program Explanation:
The above program displays the sprite coordinates as it is moved using the arrow keys.
It also allows the user to cycle through different magnification levels when the Enter key is pressed.
| Go back to ... |
| TI99E Commands Menu |
| Main Menu |
Copyright © Carlos Santiago Lebron - TI99 Environment 2020
![]() |