문제

I want to find the code of a character printed...

This is the code:

10 Print AT 2,2; "T"
20 Let C=Peek(Peek 16398+256*Peek 16399)
30 Print Peek(C)

It should just print the Code value of T

I could later use:

40 Print Peek (Code C) 

Or something.

But the 10-30 bit doesnt work. It always returns '0' -With different letters too: G,T 'black graphic' and M,

What am I doing wrong?

-Will be used for collision detection.

도움이 되었습니까?

해결책

jdehaan's right, printing the T without a trailing ; will move the cursor down to the next line after printing. (With ;, it's be one position to the right.)

To read the character you'd just written you'd have to move back a position again:

PRINT AT 2,2;"T";AT 2,2;
PRINT PEEK(PEEK 16398+PEEK 16399*256)

gives me 57, which is the character code for T.

다른 팁

According to this it is the right address to peek, but maybe the cursor is not at the right position? If I remember well (man, what are you doing with that old thing :-) ! ) the PRINT AT might move the cursor one position after the printed char (or one line under).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top