帮助:ZX81“基本”窥视功能
我需要一种方法来查找角色(“<”)是否撞到了墙上(黑色像素图形)
-在 ZX81 游戏上。
我一直在看另一个游戏...它使用代码
if peek(peek 16398 +256*peek 16399) = code "blackpixel graph" then ...
这似乎对他们有用.. ?
这是正确的代码吗
我对地址和获取内存之类的东西不太了解。
请帮助我...-
如果你知道更好的方法。请回答:) -有人提到ZX81上的“光标位置”到底是什么? 谢谢,
I need a way to find if the character ('<') has hit a wall (Black pixel Graphic)
-On a ZX81 game.
I'm been looking at another game... which uses code
if peek(peek 16398 +256*peek 16399) = code "blackpixel graphic" then ...
Which seems to work for them...
Is this correct code?
I'm not really knowledgable with addresses and getting memory and stuff.
Please help me...
-If you know a better way. Please answer :)
-Someone mentioned 'cursor position' what the hell is that on a ZX81?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
PEEK(PEEK 16398+256*PEEK 16399)
是一个习语,意思是“获取当前打印位置的字符号”。这是可行的,因为 ZX81 BASIC/ROM 使用 16398 处的两字节字来存储指向屏幕数据块中与 PRINT 位置相对应的内存位置的指针。因此,要进行碰撞检测,您首先必须设置:
>
即将移动的坐标,然后读取,然后就可以打印
>
在屏幕上(覆盖其代码现在在C
中的前一个字符),如果您想在进行检查之前:(我猜您想要的字符是所有-黑色字符 128, █.)
天哪,我感觉自己老了吗?
PEEK(PEEK 16398+256*PEEK 16399)
is an idiom meaning “get the character number at the current PRINT position”. This works because the two-byte word at 16398 is used by the ZX81 BASIC/ROM to store a pointer to the memory location in the screen data block corresponding to the PRINT position.So to do collision detection, you'd first have to set:
co-ordinates to where the
>
is about to move, then readthen you can print the
>
on-screen (overwriting the previous character whose code is now inC
) if you want to before doing the check:(I'm guessing the character you want is the all-black character 128, █.)
Oh boy, do I feel old.
哇,这能回去吗?我没有使用过 ZX81,但我当时确实在 TRS-80 上编写了一些游戏。
内部部分:
基本上就是获取两个内存位置的值(8 位)并从中创建一个 16 位
数字,然后将其用作外部 peek 的地址;你可以将其重写为:
我猜测 'addrToCheck' 值实际上是游戏中的角色位置,表示为屏幕上的地址。因此,如果该值不是墙,那么您将使用新的字符位置更新地址 16398 和 16399 中的值(毫无疑问,使用“戳”)。
希望这有帮助
Wow does this go back. I haven't used a ZX81, but I did write some games on a TRS-80 way back in the day.
The inner part:
is pretty much taking the value of two memory locations (8 bit) and creating a 16 bit
number from them, which is then used as the address of the outer peek; you might rewrite this as:
I'm guessing that the 'addrToCheck' value is actually the character position in the game, expressed as an address on the screen. So if the value is not a wall, then you would update the values in address 16398 and 16399 with a new character position (using a 'poke', no doubt).
Hope this helps