at the beg. of the prog. i put
:0->X
:10->Y
which should make the "V", go to the top middle of the graph right?
but its appearing in the top left, help please :(
no, actually the width of the screen is 96 pixels (only 95 pixels in basic)
this would be closer...
:48->X
:0->Y
also to note, the routine is actually, text(y,x,"text"
Deleted the duplicate topic, just for reference.
The above post will start the text at the centre of the screen, it won't centre the text.
The graph coordinate and the text( command are separate. The only time you want to set the graph coordinates to 0-95 for x and 0-64 for y, is when you use "Horizontal," "Vertical" and "Line(" if I recall correctly, as they do use the graph coordinates rather than pixel coordinates.
No comicidiot, tex(t uses 0-95 for x and 0-56 for y.
joshie75 wrote:
at the beg. of the prog. i put
:0->X
:10->Y
which should make the "V", go to the top middle of the graph right?
but its appearing in the top left, help please
It goes Text(Y,X,String[,more strings]). Notice the Y and X flip.
For things like circles and lines, it depends what your zoom and window are set to. Although the window is made up of pixels (95x63 in BASIC), it has different dimensions in coordinates for drawing functions. For a 1-to-1 pixel-to-coordinate ratio, you can use Xmin=0, Ymax=0, Xmax=94, Ymin=-62.
Oh, it's 56 for y? I thought it was 64. But everything else is correct, yes?
Oh, I see why you say 56, because text won't fit on screen below that. That's right. But Pxl-On/Off will still work to 64.
the max y coordinate for the text( command is 56 yes, but the screen is 64 pixels high.
alright, thanks.. but it still won't let my piece move. heres my code..
:ClrHome
:ClrDraw
:AxesOff
:45->X
:0->Y
:Line(-4,12,-4,-10
:Line(4,10,4,-10
:While -4<X<4
:Text(Y,X,"V
:If X=-4 or X=4
:Then
:Goto 1
:Getkey->K
:If K=24
:Then
:Text(Y,X," " [there is a space here]
:X-1->X
:Else
:If K=26
:Then
:Text(Y.X," " [there is a space here]
:X+1->X
:End:End:End
after the endendend..
there's to lbl 1 section just showing what happens when you hit the walls. but help please and thanks
When you first view the graph screen after a Clrdraw (or anything else that marks the graph screen as needing a redraw), the Y variable is set to 0. Silly, I know, but that's TI-OS for you.
try this instead...
Code: :ClrHome
:ClrDraw
:AxesOff
:Input
:45->X
:0->A
:Line(-4,12,-4,-10
:Line(4,10,4,-10
:While -4<X4
:Text(A,X,"V
:If X=-4 or X=4
:Goto 1
:Getkey
:If sum({K=24,K=26
:Text(A,X," " [there is a space here]
:X+(Ans==26)-(Ans=24->X
:End
as optimizations go, you can reduce the while loop condition to "-1<X" because dividing both sides by 4 would be equivalent, and for the "If X=-4 or X=4" you can say "If 4=abs(X" because you can plug in 4 or -4 and get the same truth value
If you're trying to make a game of some kind, try this main loop...
Code: :Repeat sum(X=LXACT) and sum(Y=LYACT
:getKey->K
:If Ans
:Text(Y,X,"[three spaces here]
:X+(Ans=26 and X<4)-(Ans=24 and X>-4 ->X
:Y+(K=34)-(K=25 ->Y
:Text(Y,X,"V
:End
in the list LXACT, put all x's for the event collisions.do the same for the y's with LYACT.So if there was an action to do (like talk to someone) if you are at x=4 and y=6 you'd add 4 to list LXACT and 6 to list LXACT...
Code: :augment(LXACT,{4 -> LXACT
:augment(LYACT,{6 -> LYACT
If you collide with these, the Repeat loop ends and you code can continue from there. By the way, try not to use labels if possible, the slow down programs exponentially
This is with my suggestions and Anakclusmos's code:
:ClrHome
:ClrDraw
:AxesOff
:Input
:45->X
:0->A
:Line(-4,12,-4,-10
:Line(4,10,4,-10
:While -1<X
:Text(A,X,"V
:If 4=abs(X
:Goto 1
:Getkey
:If K=24 or K=26
:Text(A,X," " [there is a space here]
:X+(Ans=26)-(Ans=24->X
:End
why does the first line have 12 in it?
and as for the lxact and lyact commands..
so that means if i have enemy cars or whatever coming towards me and they hit me.. i would use those commands for that? if so i don't get how to incorporate them
edit:
changed -12 to 12
You mean -4? So that 0 is at the top of the screen and -62 is at the bottom (in pixels it's 0 at the top and 62 at the bottom).
Im afraid i'll have to explain it tomorrow, i gotta get off now, so be expecting
Anakclusmos wrote:
Im afraid i'll have to explain it tomorrow, i gotta get off now, so be expecting
I and the rest of Cemetech are still here to help, though.