I'm trying to make a simple game that I had already made in the 80s with the Vic-20. In the initial version the game was created with only text characters and no sound. It was just to test the operation and playability. Then I made the graphic version with sound and some words of digitized speech.
Here, I wanted, with ugBASIC, to redo the same simple version in character mode. I have a bit of everything but I lack the collision control. In the text version in the 80s I checked if the position where I had to write a character was already occupied: if there was something other than space then there was a collision. But in ugBasic how can I check this? I understand that the text mode is actually a graphic mode too. There is the POINT function but in this case it is not useful to me because in the tests it always returns 3.
Probably the way I structured the program (which was meant to be simple, just for testing) is not good, I have to think of everything in a different and more complex philosophy.
Games in text mode and collisions
-
- Site Admin
- Posts: 209
- Joined: Fri Oct 06, 2023 8:25 pm
Re: Games in text mode and collisions
Hi softmosquito, and thank you for your message! 
This is an example:
Note that the command returns not the ASCII code but what is called the SCREEN CODE, which is different from computer to computer. For example, 1 = "A", 2 = "B", and so on. For the same reason, if you use SCREEN$, you will get a string with the character CHR$(1), which is not printable.

If I understand correctly the issue, you need an instruction that identifies which character is contained in a certain position on the text screen. In that case, you could use the SCREEN' function, that allows you to know the content of the text memory at a specific position. There are two versions of this function: one without the dollar ($) symbol, which returns a 'BYTE' with the value, and one with the dollar symbol, which returns a string with that value.softmosquito wrote: ↑Mon Jun 30, 2025 8:35 am Here, I wanted, with ugBASIC, to redo the same simple version in character mode. I have a bit of everything but I lack the collision control. In the text version in the 80s I checked if the position where I had to write a character was already occupied: if there was something other than space then there was a collision. But in ugBasic how can I check this?
This is an example:
Code: Select all
CLS
LOCATE 1,1
PRINT "A"
LOCATE 2,2
PRINT SCREEN(1,1): ' this will print 1
-
- Posts: 2
- Joined: Thu Feb 13, 2025 10:27 pm
Re: Games in text mode and collisions
Wow! That's right! It works! Thank you so much!