Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Really strange graphics bug - what am I doing wrong?
Author | Message | ||||
fiziwig Newbie Joined: 09/07/2020 Location: United StatesPosts: 22 |
I'm testing out some code and trying to learn how the system works, so I'm writing a "Depthcharge" game as my coding exercise. I have the ship animated when I use the arrow keys to move it left and right, and I have up to 6 depth charges falling through the water. No submarines yet, and the depth charges are all dropped at once just to test the animation. Problem is, half the time when I run the game it fills the screen with a goofy colors instead of what it's supposed to look like. It seems to happen most often when I go directly from editing to running with F1 and then F2. I figure I must be setting something up wrong to cause this, but I'm at a loss to figure it out. Code and images attached if anyone feels like taking a look and getting me straightened out. Any help would be greatly appreciated. test.zip |
||||
vegipete Guru Joined: 29/01/2013 Location: CanadaPosts: 1082 |
I see strange colours too when I test your program. As you say, often if you run (F2) from the editor, the colour mapping is all messed up. If you stop the program with CTL-C and type RUN, it works fine again. Also, if you use mode 1,8 (instead of mode 1,16) the colours seem to stay correct. But there is something else weird. If you sail your battleship completely off the left or right side of the screen, the saved background image for the sprites is taken from page 1 instead of page 0. In this case, the destination for the blit command is so far off screen that no pixels are copied. Somehow this appears to disturb which page a sprite's background image is take from. Both of these might be bugs that matherp should comment on. Visit Vegipete's *Mite Library for cool programs. |
||||
fiziwig Newbie Joined: 09/07/2020 Location: United StatesPosts: 22 |
I hadn't noticed that running the ship off the screen caused problems. This is just a mock-up for testing, so I hadn't put limits on the battleship movement. I should mention also that the battleship itself is not a sprite, but a blit'd bitmap. I wasn't sure what the size limit was on a sprite. One place manual says one thing, and a different place it says something different (16x16 vs MM.HRES-1,MM.VRES-1) I didn't really see the necessity for using a sprite for the ship anyway. |
||||
fiziwig Newbie Joined: 09/07/2020 Location: United StatesPosts: 22 |
Another odd occurrence I just noticed: I had a comment that included a double quote. Specifically: if ldb = -1 then ldb = 0 ' launch key "debounce" I got the error message "Unexpected text" so I deleted the comment. Now there is no double quote anywhere on the line yet it still gives me the "Unexpected text" error message. Powering down and rebooting still gives me the "unexpected text" message. Removing the line and retyping it still gives me the same error message. That line is poison now. I can't get past it. I finally deleted the whole section and rewrote it a different way to get the error message to go away. |
||||
fiziwig Newbie Joined: 09/07/2020 Location: United StatesPosts: 22 |
Also, I'm not finding the command to position the text cursor to a particular x,y location. In otherwords, the way to set MM.INFO(HPOS) and MM.INFO(VPOS) On edit: Never mind: I'm using text x,y,"" with dummy text to relooate the cursor. That works. Edited 2020-08-03 07:01 by fiziwig |
||||
Atomizer_Zero Senior Member Joined: 04/07/2020 Location: United KingdomPosts: 134 |
I think you can just do ?@(x,y) That will move the cursor to that location, then you can do whatever after that. I'm not sure if it stays there though. |
||||
fiziwig Newbie Joined: 09/07/2020 Location: United StatesPosts: 22 |
Thanks! I didn't see that in the manual. Like whenever I'm dealing with a new system I don't know where to find things in the manual until AFTER I've found them in the manual, but then it's too late to learn the answer because by then I already know the answer. Catch22 (hehe) you can only learn what you already know, so if you don't already know it, you can't learn it. Or so it seems at times. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8573 |
How come you just start using the system and find a bug no-one else has found in weeks of use by dozens of people Thanks for the report - I'll try and fix it |
||||
fiziwig Newbie Joined: 09/07/2020 Location: United StatesPosts: 22 |
How come you just start using the system and find a bug no-one else has found in weeks of use by dozens of people Thanks for the report - I'll try and fix it Sorry about that BTW: I'm using version 5.0504 According to MM.INFO(VERSION) Edited 2020-08-03 08:11 by fiziwig |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8573 |
Found the bug and will fix in the next beta The workround for 5.05.04 is to set the mode to 1,8 and then 1,16 Option Default Integer Option Base 1 Mode 1,8 Mode 1,16 Edited 2020-08-03 21:16 by matherp |
||||
fiziwig Newbie Joined: 09/07/2020 Location: United StatesPosts: 22 |
The workround for 5.05.04 is to set the mode to 1,8 and then 1,16 Option Default Integer Option Base 1 Mode 1,8 Mode 1,16 I found that the program works fine and displays correctly in mode 1,8 so I'm just going to leave it that way. Thanks. |
||||
Print this page |