| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|||
|
Screensaver program
I'm having a bit of trouble.
Legend: A="Change String from last time?" H="Starting Direction" V="Length of String" D="Down" O="Over" R="Right" L="Left" T="Top" B="Bottom" M="Movement Direction" Str1="Text that flys" If M = 72, it will go to the upperleft If M = 74, it will go to the upperright If M = 92, it will go to the lowerleft If M = 94, it will go to the lowerright Code:
:Input A :If A=1:Input Str1 :length(Str1)*6→V #length in pixels of text :AxesOff :ClrDraw :0→Xmin :94→Xmax :0→Ymin :62→Ymax : :1→T :62-8→B #Minus amount of pixels from bottom :92-V→R #Minus amount of pixels from right side :1→L : :Horizontal 1 :Vertical 1 :Horizontal 61 :Vertical 93 : :randInt(2,B)→D #Starting :randInt(2,R)→O #Coordinates : :Text(‾1,D,O,Str1) #Displays text for first time : :randInt(1,4)→H #Starting Direction :If H=1:92→M :If H=2:74→M :If H=3:72→M :If H=4:94→M : :While 1 :¦ # Those four lines add or subtract pixels :¦ # and make the movement work :¦ D-(M=92)→D:O-(M=92)→O :¦ D+(M=74)→D:O+(M=74)→O :¦ D-(M=72)→D:O+(M=72)→O :¦ D+(M=94)→D:O-(M=94)→O :¦ :¦ If M=72:Then: #if going up and left :¦ ¦ If D=T:92→M #if hit top bar, go down and left :¦ ¦ If O=L:94→M #if hit left bar, go up and right :¦ End :¦ If M=74:Then: #if going up and right :¦ ¦ If D=T:94→M #if hit top bar, go down and right :¦ ¦ If O=R:72→M #if hit right bar, go up and to the left :¦ End :¦ If M=92:Then: #if going down and left :¦ ¦ If D=B:72→M #if hit bottom bar, go up and right :¦ ¦ If O=L:94→M #if hit left bar, go down and right :¦ End :¦ If M=94:Then: #if going down and right :¦ ¦ If D=B:74→M #if hit bottom bar, go up and right :¦ ¦ If O=R:92→M #if hit right bar, go down and left :¦ End :¦ :¦ Text(‾1,D,O,Str1) #displays text :¦ :¦ If 1:Then: #debug info :¦ ¦ Text(9,1,"D") :¦ ¦ Text(9,5,D) :¦ ¦ Text(15,1,"O") :¦ ¦ Text(15,5,O) :¦ End :End The problem is that the text isn't "bouncing" off the walls like it should when it reaches one of the sides. The only thing that I can think is wrong is that I have some variables mixed up, or a syntax error. I don't see it. |
|
|||
|
I think I've solved it, but I haven't fixed it yet. The directions don't go the way I meant for them to go. Added "Text(3,1,"M",M" to debug. I'll post later when I've gotten around to fixing it.
|
|
|||
|
Finished.
Code:
:Input "Change?: ",A :If A=1:Input Str1 :Input "Big?: ",Q :AxesOff :ClrDraw :0→Xmin :94→Xmax :0→Ymin :62→Ymax : :2→L :2→T :If Q=1:Then: :¦ length(Str1)*6→V :¦ 61-8→B :¦ 93-V→R :End :If Q≠1:Then: :¦ length(Str1)*4→V :¦ 61-7→B :¦ 93-V→R :End :If V>91:Then: :¦ Disp " "," NO." :¦ Stop :End :Horizontal(1 :Vertical 1 :Horizontal(61 :Vertical 93 : :randInt(T,B)→D :randInt(L,R)→O :If Q=1:Text(‾1,D,O,Str1) :If Q≠1:Text(D,O,Str1) :randInt(1,4)→H :If H=1:92→M :If H=2:74→M :If H=3:72→M :If H=4:94→M : :While 1 :¦ :¦ D-(M=72)→D:O-(M=72)→O :¦ D+(M=94)→D:O+(M=94)→O :¦ D-(M=74)→D:O+(M=74)→O :¦ D+(M=92)→D:O-(M=92)→O :¦ :¦ If M=72:Then: :¦ ¦ If D=T:92→M :¦ ¦ If O=L:74→M :¦ End :¦ If M=74:Then: :¦ ¦ If D=T:94→M :¦ ¦ If O=R:72→M :¦ End :¦ If M=92:Then: :¦ ¦ If D=B:72→M :¦ ¦ If O=L:94→M :¦ End :¦ If M=94:Then: :¦ ¦ If D=B:74→M :¦ ¦ If O=R:92→M :¦ End :¦ If Q=1:Text(‾1,D,O,Str1) :¦ If Q≠1:Text(D,O,Str1) :¦ :¦ If O<L or O>R or D<T or D>B:Then: :¦ ¦ randInt(T,B)→D :¦ ¦ randInt(L,R)→O :¦ ¦ Horizontal(1 :¦ ¦ Horizontal(61 :¦ ¦ Vertical 1 :¦ ¦ Vertical 93 :¦ End :¦ :¦ :¦ If 0:Then: :¦ ¦ Text(3,1,"M",M) :¦ ¦ Text(9,1,"D") :¦ ¦ Text(9,5,D) :¦ ¦ Text(15,1,"O") :¦ ¦ Text(15,5,O) :¦ End :End |
![]() |
| Viewing: Dev Hardware Forums > SOFTWARE > TI 83/84 > Screensaver program |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|