I made a personality test. Check it out!
RXCQ33J4
As I mentioned, only the #up button works. If you could, review my code to see what's wrong. Let me know how accurate this is!
I recommend the syntax of...
REPEAT:UNTIL BUTTON() AND #A
It is a very simple code snippet that waits until the A button is pressed. If you wish to keep the button's input, you could do something like...
REPEAT
B=BUTTON()
UNTIL B AND (#A OR #B OR #X OR #Y)
Oscar- Thanks! I think I'll display it on the other screen. And the code you gave me for the buttons works, so I'll have to do an update anyways.
Sheepy- I thought so too but don't know how...
Making a pie chart is actually not too hard!
You'll have to draw a circle, and then divide it into segments using lines. The lines can be drawn logically using a bit of trigonometry and a relative sum. You'll have to setup some things first...
TOTAL=RED+BLUE+GREEN+YELLOW 'SUM OF ALL COLORS
SUM=0 'PERCENTAGE SUM
GCIRCLE 200,120,50 'DRAW CIRCLE
GLINE 200,120,200,70 'DRAW 1ST LINE
Afterwards, you'll increase the percentage sum by an amount relative to 2*PI (a circumference) and the color in respect to the total. Afterwards, draw a line from the center of the circle to the percentage of circumference that corresponds to the division. We can get this value using simple trigonometry.
You can also use a similar value to paint in the division.
(Code in next comment)
INC SUM,2*PI()*RED/TOTAL 'INCREMENT THE PERCENTAGE SUM
GLINE 200,120,200+50*SIN(SUM),120-50*COS(SUM) 'DRAW DIVISION LINE
ANG=SUM-PI()*RED/TOTAL 'AUXILIARY ANGLE FOR PAINTING
GPAINT 200+45*SIN(ANG),120-45*COS(ANG),#RED 'PAINT IN DIVISION
You can then simply repeat this above code for every color, replacing RED with the appropriate color.
This code sounds so confusing to me. We never learnt trig in school, the highest level of math was Algebra 1. I would never be able to do it w/o your help!
Being that I didn't understand a word of the code you gave me, I copied it, as you can see in the screenshot. But it's not working.The circle and segments draw, but the color isn't filled in correctly, the yellow just fills the entire screen. Can you please help me out?
What color is the background you're drawing on? If it's white, you might want to write GCOLOR #BLACK before the pie chart code to set the default drawing color to something visible.
Strange thing: I copied the entire thing and pasted it to display on the touch screen while the speech about the personality types are on the touch screen, and after scrolling thru all the colors, the pie finally appears as it should.
You probably had a white background when drawing the pie chart, which meant that the circle and divisions weren't being drawn properly. A background color other than white will make it work. You could also specify <GCOLOR #BLACK> before the pie chart code or append <,#BLACK> to every graphics instruction that doesn't already specify color.
As Xavier said, you must change all center coordinates to that of the touch screen. That includes the circle, as well as all line and paint coordinates/offsets.
Here's the updated version! It's the one that's highlighted. You can check out 'multiplication' too, it's a cute quiz with random multiplication examples I made for my 3'rd grade sis. You'll have too download 'my sprites' to the same file to see the graphics.