Grpahics issue

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Frosty480
Coder
Posts: 17
Joined: Mon Aug 27, 2007 11:59 am
Contact:

Grpahics issue

Post by Frosty480 »

Im working on a Mario clone as my second real game, and I'm currently just testing out the graphics, and whenever I PUT the image of Mario's mask, and then Mario on a blue background, the colors are fine, but half the picture has a black outline. Its the same for a prototype of a platform. Both have masks, as I don't know any other way of keeping the colors intact on a colored background. So does anyone know how I could get rid of the outlines?

Heres the link to the .bas file -

http://www.mediafire.com/?bptggticue1

And don't laugh at the Mario I came up with. For some reason, Its the best I can do :) But If anyone can make a better mario with DATA statements, then can you give me the source? PLEASE?!?!?!?
User avatar
Stoves
Veteran
Posts: 101
Joined: Fri Feb 10, 2006 12:24 am
Location: Nashville, TN

Post by Stoves »

This should work. I'll post an explanation if I get a chance. You may be able to tell what was wrong by just comparing the code to the original.

Code: Select all

'My clone of Mario
'Cris Mihalache
'Started 08, 28, 07

DECLARE SUB xpset (x%, y%, c%)
DECLARE SUB MarioP (x%, y%)
DECLARE SUB PlatformP (x%, y%)

DIM SHARED Mario(10, 10)
DIM SHARED Platform(40, 3)
DIM SHARED MarioM(10, 10)
DIM SHARED PlatformM(40, 3)

CLS
SCREEN 7, 0, 1, 0

FOR y = 0 TO 9
  FOR x = 0 TO 9
    READ z
    Mario(x, y) = z
    PSET (x, y), z
  NEXT
NEXT

GET (0, 0)-(9, 9), Mario
CLS

FOR y = 0 TO 2
  FOR x = 0 TO 39
    READ z
    Platform(x, y) = z
    PSET (x, y), z
  NEXT
NEXT

GET (0, 0)-(39, 2), Platform
CLS

FOR y = 0 TO 2
  FOR x = 0 TO 39
    READ z
    PlatformM(x, y) = z
    PSET (x, y), z
  NEXT
NEXT

GET (0, 0)-(39, 2), PlatformM
CLS

FOR y = 0 TO 9
  FOR x = 0 TO 9
    READ z
    MarioM(x, y) = z
    PSET (x, y), z
  NEXT
NEXT

GET (0, 0)-(9, 9), MarioM
CLS

LINE (0, 0)-(320, 200), 9, BF
CALL MarioP(50, 50)
CALL PlatformP(20, 20)

DATA 00,00,00,04,04,04,04,00,00,00
DATA 00,00,04,00,04,04,00,04,00,00
DATA 00,00,00,04,04,04,04,00,00,00
DATA 00,00,14,14,14,14,14,14,00,00
DATA 00,02,02,14,14,14,14,02,02,00
DATA 00,02,14,14,14,14,14,14,02,00
DATA 02,00,01,01,00,00,01,01,00,02
DATA 00,00,01,00,00,00,00,01,00,00
DATA 00,07,07,00,00,00,00,07,07,00
DATA 00,07,07,00,00,00,00,07,07,00

DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,00
DATA 04,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14
DATA 00,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,00

DATA 255,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,255
DATA 04,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14
DATA 255,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,04,255

DATA 255,255,255,04,04,04,04,255,255,255
DATA 255,255,04,255,04,04,255,04,255,255
DATA 255,255,255,04,04,04,04,255,255,255
DATA 255,255,14,14,14,14,14,14,255,255
DATA 255,02,02,14,14,14,14,02,02,255
DATA 255,02,14,14,14,14,14,14,02,255
DATA 02,255,01,01,255,144,01,01,255,02
DATA 255,255,01,255,255,255,255,01,255,255
DATA 255,07,07,255,255,255,255,07,07,255
DATA 255,07,07,255,255,255,255,07,07,255

PCOPY 1, 0

SUB MarioP (x%, y%)

PUT (x%, y%), MarioM, AND
PUT (x%, y%), Mario, OR

END SUB

SUB PlatformP (x%, y%)

PUT (x%, y%), PlatformM, AND
PUT (x%, y%), Platform, OR

END SUB

SUB xpset (x%, y%, c%)

IF y > 100 THEN

DEF SEG = &HA7D0
POKE ((y% - 100) * 320 + x%), c%

ELSE

DEF SEG = &HA000
POKE (y% * 320 + x%), c%

END IF

END SUB
User avatar
Stoves
Veteran
Posts: 101
Joined: Fri Feb 10, 2006 12:24 am
Location: Nashville, TN

Post by Stoves »

Actually, the quickest fix to your code would be to replace these lines of code:

Code: Select all

GET (0, 0)-(10, 10), Mario
...
GET (0, 0)-(40, 3), Platform
...
GET (0, 0)-(40, 3), PlatformM
...
GET (0, 0)-(10, 10), MarioM
with these:

Code: Select all

GET (1, 1)-(10, 10), Mario
...
GET (1, 1)-(40, 3), Platform
...
GET (1, 1)-(40, 3), PlatformM
...
GET (1, 1)-(10, 10), MarioM
As you can probably tell, the problem was that you were starting your graphics and masks at 1, 1, but GETting from 0, 0, so it would get one extra blank column on the left and one extra blank row on the top.
Frosty480
Coder
Posts: 17
Joined: Mon Aug 27, 2007 11:59 am
Contact:

Post by Frosty480 »

Oh, ok, I get it now!!! Thanks a bunch!!!
User avatar
Stoves
Veteran
Posts: 101
Joined: Fri Feb 10, 2006 12:24 am
Location: Nashville, TN

Post by Stoves »

No problem. Glad to help.
User avatar
Codemss
Veteran
Posts: 124
Joined: Sun Jun 24, 2007 6:49 am
Location: Utrecht, The Netherlands
Contact:

Post by Codemss »

http://www.mfgg.net/
For VERY much mario sprites!
Post Reply