Jump to content

Photo

call motion ?


3 replies to this topic

#1 1980gamer OFFLINE  

1980gamer

    Dragonstomper

  • 973 posts
  • Location:Charlton, MA

Posted Mon Jul 16, 2018 8:22 PM

I am trying to place 24 sprite on the screen.

And in a random sequence, have them start moving. 

 

My question is...  Can you use a variable to start a sprite moving in a call motion?

 

LET #VAR=3

CALL MOTION(#VAR,20,0)

 

I could swear I have done this in the past?  Maybe it was in a Sprite command?  Though that will not work for me without a rewrite......

 

Hmmm..?



#2 Tursi OFFLINE  

Tursi

    Quadrunner

  • 5,496 posts
  • HarmlessLion
  • Location:BUR

Posted Mon Jul 16, 2018 8:45 PM

Yes, you can do that. But variables don't start with a '#', only the sprite functions require that. :)

VAR=3
CALL MOTION(#VAR,20,0)

#3 mizapf ONLINE  

mizapf

    River Patroller

  • 3,506 posts
  • Location:Germany

Posted Tue Jul 17, 2018 2:01 AM

TI (Extended) Basic surely has some syntactic sugar here and there ...



#4 1980gamer OFFLINE  

1980gamer

    Dragonstomper

  • Topic Starter
  • 973 posts
  • Location:Charlton, MA

Posted Tue Jul 17, 2018 2:47 AM

Thanks for verifying it should work.

 

The LET #VAR was a typo...  But maybe I had the same typo while testing?  #VAR would be a local TEMP TABLE in SQL...  So it may have looked correct to me?

 

Sample proof of it working...

1 CALL SCREEN(2)
10 CALL CLEAR
20 RANDOMIZE
30 CALL SPRITE(#1,42,12,120,120)
40 CALL SPRITE(#2,42,13,128,128)
50 CALL SPRITE(#3,42,14,112,112)
60 R=INT(RND*3)+1
70 CALL MOTION(#R,10,10)
80 FOR D=1 TO 500 :: NEXT D
90 CALL MOTION(#R,0,0)
100 GOTO 60
 






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users