Qbasicnews.com
April 07, 2020, 11:25:10 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Graphics For Someone to figure out  (Read 1318 times)
tinytim365
New Member

Posts: 11


« on: October 07, 2004, 05:17:02 PM »

My problem is that my moveable sprite canot go to the end of the map on a couple sides.  The map is 21,15 tiles big.  The sprite can goto 1 side on the x axis of the screen and can goto the 1 side on the y axis.  He cant go to the other sides witch are the right and bottom sides of the screen.  Here is the code (good luck).  Oh by the way if you notice in the code that i have it set up 1 tile to short on each of the sides im talking about is because that is the only way it will work without getting a supscrition out of range error.  I wanted it to be able to go to the 21 and 15 sides but it will not so i had to make it 20 , 14 instead.  Anyway here is the code hope you can help.


Code:



DIM tile(195), grass(195), dirt(195)

DIM map1(21, 15)

DIM martian(195), martianshadow(195)

SCREEN 13



xlength = 15      'X size of pic

 ylength = 13      'Y size of pic


guyx = 5
guyy = 5



'-----------------------------------------------------


FOR y = 1 TO ylength

 FOR x = 1 TO xlength

  READ z
 
 PSET (x, y), z

NEXT: NEXT

GET (1, 1)-(15, 13), tile

'-----------------------------------------------------

FOR y = 1 TO ylength

 FOR x = 1 TO xlength

  READ z

 PSET (x, y), z

NEXT: NEXT

GET (1, 1)-(15, 13), grass

'-----------------------------------------------------

FOR y = 1 TO ylength

 FOR x = 1 TO xlength

  READ z

 PSET (x, y), z

NEXT: NEXT

GET (1, 1)-(15, 13), dirt

'-----------------------------------------------------

FOR y = 1 TO 15
 
 FOR x = 1 TO 21

 READ map1(x, y)

NEXT: NEXT

'-----------------------------------------------------

FOR y = 1 TO ylength

 FOR x = 1 TO xlength

  READ z
 
 PSET (x, y), z

NEXT: NEXT

GET (1, 1)-(15, 13), martian

'-----------------------------------------------------

FOR y = 1 TO ylength

 FOR x = 1 TO xlength

  READ z

 PSET (x, y), z

NEXT: NEXT

GET (1, 1)-(15, 13), martianshadow

CLS

'-----------------------------------------------------

CLS

FOR y = 1 TO 15

 FOR x = 1 TO 21

  IF map1(x, y) = 1 THEN PUT (x * 15 - 15, y * 13 - 13), tile
  IF map1(x, y) = 2 THEN PUT (x * 15 - 15, y * 13 - 13), grass
  IF map1(x, y) = 3 THEN PUT (x * 15 - 15, y * 13 - 13), dirt
   
NEXT: NEXT


PUT (guyx * 15 - 15, guyy * 13 - 13), martianshadow, AND
PUT (guyx * 15 - 15, guyy * 13 - 13), martian, OR



DO

 press$ = INKEY$


     IF press$ = CHR$(0) + CHR$(75) AND map1(guyx - 1, guyy) <> 1 THEN

        IF guyx > 1 THEN guyx = guyx - 1

     END IF


     IF press$ = CHR$(0) + CHR$(77) AND map1(guyx + 1, guyy) <> 1 THEN
     
       IF guyx < 20 THEN guyx = guyx + 1

     END IF


     IF press$ = CHR$(0) + CHR$(72) AND map1(guyx, guyy - 1) <> 1 THEN

        IF guyy > 1 THEN guyy = guyy - 1

     END IF


     IF press$ = CHR$(0) + CHR$(80) AND map1(guyx, guyy + 1) <> 1 THEN

        IF guyy < 14 THEN guyy = guyy + 1

     END IF



IF oldguyx <> guyx OR oldguyy <> guyy THEN


  oldguyx = guyx
  oldguyy = guyy


        FOR y = 1 TO 15

         FOR x = 1 TO 21

        IF map1(x, y) = 1 THEN PUT (x * 15 - 15, y * 13 - 13), tile, PSET
        IF map1(x, y) = 2 THEN PUT (x * 15 - 15, y * 13 - 13), grass, PSET
        IF map1(x, y) = 3 THEN PUT (x * 15 - 15, y * 13 - 13), dirt, PSET

    NEXT: NEXT

        PUT (guyx * 15 - 15, guyy * 13 - 13), martianshadow, AND
        PUT (guyx * 15 - 15, guyy * 13 - 13), martian, OR


 END IF

LOOP UNTIL press$ = CHR$(27)



'-----------------------------------------------------------





'Tile Sprite

DATA 07,08,08,08,08,08,08,08,08,08,08,08,08,08,00
DATA 08,07,07,07,07,07,07,07,07,07,07,07,07,07,00
DATA 08,07,07,07,07,07,07,07,07,07,07,07,07,07,00
DATA 08,07,07,07,07,07,07,07,07,07,07,07,07,07,00
DATA 08,07,07,07,07,07,07,07,07,07,07,07,07,07,00
DATA 08,07,07,07,07,07,07,07,07,07,07,07,07,07,00
DATA 08,07,07,07,07,07,07,07,07,07,07,07,07,07,00
DATA 08,07,07,07,07,07,07,07,07,07,07,07,07,07,00
DATA 08,07,07,07,07,07,07,07,07,07,07,07,07,07,00
DATA 08,07,07,07,07,07,07,07,07,07,07,07,07,07,00
DATA 08,07,07,07,07,07,07,07,07,07,07,07,07,07,00
DATA 08,07,07,07,07,07,07,07,07,07,07,07,07,07,00
DATA 08,00,00,00,00,00,00,00,00,00,00,00,00,00,07



'Grass Sprite

DATA 02,02,02,02,02,02,02,02,02,02,02,02,02,02,02
DATA 02,10,10,10,10,02,10,10,10,02,02,10,10,10,02
DATA 02,10,02,10,02,07,10,10,10,10,02,10,02,10,02
DATA 02,10,10,10,10,10,10,10,10,10,10,10,02,10,02
DATA 02,10,10,10,02,10,10,10,02,10,10,10,10,10,02
DATA 02,10,02,02,02,10,10,02,10,02,02,10,10,10,02
DATA 02,10,10,02,10,02,02,10,10,10,02,10,02,10,02
DATA 02,10,10,02,10,02,02,02,10,10,02,10,10,02,02
DATA 02,10,10,02,10,10,10,10,02,10,10,10,10,10,02
DATA 02,10,02,10,02,10,10,10,10,02,10,10,02,10,02
DATA 02,10,02,10,10,02,10,10,10,10,10,10,10,10,02
DATA 02,10,02,10,10,10,10,10,10,10,10,10,10,10,02
DATA 02,02,02,02,02,02,02,02,02,02,02,02,02,02,02



'Dirt Sprite

DATA 114,114,114,114,114,114,114,114,114,114,114,114,114,114,114
DATA 114,114,114,114,114,114,25,114,114,114,114,114,114,114,114
DATA 114,25,114,114,114,114,114,114,114,114,25,114,114,25,114
DATA 114,114,114,114,114,114,114,114,114,114,114,114,114,114,114
DATA 114,114,114,25,114,114,114,114,114,114,114,25,114,114,114
DATA 114,114,114,114,114,114,114,114,114,114,114,114,114,114,114
DATA 114,114,114,114,114,25,114,114,114,114,114,114,114,114,114
DATA 114,114,114,25,114,114,114,114,114,114,114,114,114,114,114
DATA 114,114,114,114,114,114,25,114,114,114,25,114,114,114,114
DATA 114,114,114,114,114,114,114,114,114,114,114,114,114,114,114
DATA 114,114,114,114,114,25,114,114,114,114,25,114,114,114,114
DATA 114,114,114,114,114,114,114,114,114,114,114,114,114,114,114
DATA 114,114,114,114,114,114,114,114,114,114,114,114,114,114,114



'Map1 sprite

DATA 1,1,1,1,1,1,1,1,1,3,3,1,1,1,1,1,1,1,1,1,1
DATA 1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1
DATA 1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1
DATA 1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1
DATA 1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1
DATA 1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1
DATA 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
DATA 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
DATA 1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1
DATA 1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1
DATA 1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1
DATA 1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1
DATA 1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1
DATA 1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1
DATA 1,1,1,1,1,1,1,1,1,3,3,1,1,1,1,1,1,1,1,1,1



'Martian Sprite

DATA 0,0,0,2,0,0,2,2,2,0,0,2,0,0,0
DATA 0,0,0,0,2,2,2,2,2,2,2,0,0,0,0
DATA 0,0,0,2,2,2,2,2,2,2,2,2,0,0,0
DATA 0,0,0,2,2,2,15,2,15,2,2,2,0,0,0
DATA 0,0,0,2,2,2,4,2,4,2,2,2,0,0,0
DATA 0,0,0,0,2,2,2,2,2,2,2,0,0,0,0
DATA 0,0,0,0,0,2,2,0,2,2,0,0,0,0,0
DATA 0,0,0,0,0,0,3,3,3,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0
DATA 0,0,0,0,2,2,15,15,15,2,2,0,0,0,0
DATA 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0
DATA 0,0,0,0,2,2,1,0,1,2,2,0,0,0,0


'Martian Mask Sprite

DATA 255,255,255,2,255,255,2,2,2,255,255,2,255,255,255
DATA 255,255,255,255,2,2,2,2,2,2,2,255,255,255,255
DATA 255,255,255,2,2,2,2,2,2,2,2,2,255,255,255
DATA 255,255,255,2,2,2,15,2,15,2,2,2,255,255,255
DATA 255,255,255,2,2,2,4,2,4,2,2,2,255,255,255
DATA 255,255,255,255,2,2,2,2,2,2,2,255,255,255,255
DATA 255,255,255,255,255,2,2,0,2,2,255,255,255,255,255
DATA 255,255,255,255,255,255,3,3,3,255,255,255,255,255,255
DATA 255,255,255,255,255,255,255,2,255,255,255,255,255,255,255
DATA 255,255,255,255,2,2,15,15,15,2,2,255,255,255,255
DATA 255,255,255,255,255,255,255,1,255,255,255,255,255,255,255
DATA 255,255,255,255,255,255,1,1,1,255,255,255,255,255,255
DATA 255,255,255,255,2,2,1,0,1,2,2,255,255,255,255



Thx for the help guys...
Logged
Oz
I hold this place together
*****
Posts: 923



« Reply #1 on: October 07, 2004, 06:11:05 PM »

http://quickhost.qbtk.com/download.php?id=280

 Tongue

 :rotfl:  :bounce:  :rotfl:  :bounce:
 :bounce:  :rotfl:  :bounce:  :rotfl:
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!