Calculator Community > The Axe Parser Project

Flickering Text (and collision?)

(1/2) > >>

Joey H.:
Hello!
I am new here on this Forum and hope to learn a thing or two sooner or later about Axe Parser!
Call me Joey.
Since I'm new here, this may be a rather dumb question, because I cannot seem to find anyone else with the same problem here...
Anyway, my very first question to ask is as follows: The Text in my game displaying the score to the player is flickering and really lagging up the game...
This is what loops every frame:

--- Code: ---ClrDraw
.Text(1,0,"SCORE:")
.Text(32,0,D►Dec)
Pt-On(X,Y,Pic1)
Pt-On(A,B,Pic2)
DispGraph
--- End code ---
It's pretty clear that this would flicker the text, but I do not know how to fix it...
How might I go about making this issue stop? (Thanks in advance)

Xeda112358:
If that is your loop then it shouldn't be flickering as far as I can tell. Can you post the rest of the code? It'll only be flickering of there is another DispGraph between the ClrDraw and DispGraph (or of course if the text is changing :P )

Also, if you only draw the text and update the screen (DispGraph) when something changes, then you'll get a significant speed-up.

EDIT: Ooohhh, I know the issue. At the start of your program (not in the loop), use Fix 5 and before you exit, run Fix 4.
The default behavior of Text( is to draw directly to the LCD and not the graphics buffer (this is what TI-OS expects when your program is finished). Fix 5 switches it to draw to the buffer and not the LCD.

So you would draw the text, and then when DispGraph, the text isn't drawn to the buffer and so it gets erased.

Joey H.:
The entirety of my code:

It is a tad shaky, but here it is!

When I add the Fixes it does the same thing, same issue...:

--- Code: ---.DODGEB2 Dodge Da Blocks!

[3C42A5A581BD423C]→Pic1
[FF81A5A581BD81FF]→Pic2

DiagnosticOff
ClrHome

48→X
52→Y
0→B
rand/745→A
1→C
0→D
Fix 0
Fix 5

Repeat getKey(15)
Pause 5
If getKey(2) and (X≠0
X-1→X
End
If getKey(3) and (X≠88
X+1→X
End
!If B≥64
B+C→B
Else
D+1→D
0→B
rand/745→A
End

ClrDraw
Text(1,0,"DODGED:")
Text(32,0,DDec)
Pt-On(X,Y,Pic1)
Pt-On(A,B,Pic2)
DispGraph

Lbl B
Fix 4
End
--- End code ---

Oh. Wait!!!!
It works when I do it now! Where do I put the Fix 4 Recovery line of code now?

--- Code: ---.DODGEB2 Dodge Da Blocks!

[3C42A5A581BD423C]→Pic1
[FF81A5A581BD81FF]→Pic2

DiagnosticOff
ClrHome

48→X
52→Y
0→B
rand/745→A
1→C
0→D
Fix 0
Fix 5

Repeat getKey(15)
Pause 5
If getKey(2) and (X≠0
X-1→X
End
If getKey(3) and (X≠88
X+1→X
End
!If B≥64
B+C→B
Else
D+1→D
0→B
rand/745→A
End

ClrDraw
Text(1,0,"DODGED:")
Text(32,0,DDec)
Pt-On(X,Y,Pic1)
Pt-On(A,B,Pic2)
DispGraph

Lbl B
End

--- End code ---
EDIT: (Zeda) Merged double-posts.

Xeda112358:
You have the Fix 4 inside the loop so after the first iteration, it starts drawing directly to the LCD again. If you move it outside the loop (after the End), then it should work.

Also as general forum etiquette, you can Modify your post instead of double- (or triple-) posting :P (Double posting is when you post twice in a row. General rule of thumb is that after a day since the last post it is okay to double-post.)

Joey H.:
All right!
That seems to work now!
One last look:

--- Code: ---.DODGEB2 Dodge Da Blocks!

[3C42A5A581BD423C]→Pic1
[FF81A5A581BD81FF]→Pic2

DiagnosticOff
ClrHome

48→X
52→Y
0→B
rand/745→A
1→C
0→D
Fix 0
Fix 5

Repeat getKey(15)
Pause 5
If getKey(2) and (X≠0
X-1→X
End
If getKey(3) and (X≠88
X+1→X
End
!If B≥64
B+C→B
Else
D+1→D
0→B
rand/745→A
End

ClrDraw
Text(1,0,"DODGED:")
Text(32,0,DDec)
Pt-On(X,Y,Pic1)
Pt-On(A,B,Pic2)
DispGraph

Lbl B
End

Fix 4
--- End code ---

Thank you very much!
But my apologies about the double (or triple) posting... I was a bit confused with myself; and also, I had a feeling already that it wasn't polite, but thank you for confirming it!

Navigation

[0] Message Index

[#] Next page

Go to full version