Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Newbie Programs pacman... Round One...
#1
Alright. Since I'm not afraid of you guys now, and know how supportive you really are... I have a question. Once again, I've read tons of tutorials, but it's something that goes over my head.

I have a graphical movement engine already built that could EASILY be used as the skeleton for a pacman type game. To make my programming a little more professional, though, and a little cleaner, I need to know how I would do a subroutine. I tried it, and my pacman picture just sat there, and wouldn't move.

I also need to know how to do bsave and bload (I did it once before, but It's been a long time.. and I need a quick referesher.)

Let me post my engine. Critique it. Love it. Hate it. I've used minimal reference to write this. Most of it has been trial and error.
There are still GLARING NEON BRIGHT bugs in it. As a matter of fact, I am having an error in my logic. The way I'm doing my map, it's all printing graphics 10 down and 10 over, and i can't find a way to bypass it. Just take a look and give me advice. Thanks...
Smile
hrono Trigger Fanboy Forever
Reply
#2
Here it is: Be Gentle, it's my first time :lol:
Recoded some stuff, added subroutines, fixed some glaring errors, all thanks to Z!re. I know theres more, it'll come with time.
Code:
DECLARE SUB movement (x%, y%)
DECLARE SUB redrawmap (checkformovex%, checkformovey%, x%, y%)
DIM SHARED map(32, 20)
DIM SHARED pacman(10, 10)
DIM SHARED charmask(10, 10)
DIM SHARED blank(10, 10)
DIM SHARED WallLR(10, 10)
DIM SHARED wallUD(10, 10)
DIM SHARED cornerUL(10, 10)
DIM SHARED cornerUR(10, 10)
DIM SHARED cornerDL(10, 10)
DIM SHARED cornerDR(10, 10)
DIM SHARED x AS INTEGER
DIM SHARED y AS INTEGER
DIM SHARED checkformovex AS INTEGER
DIM SHARED checkformovey AS INTEGER

SCREEN 13
GOSUB testgraph

x = 2
y = 2

CLS

top:

WAIT &H3DA, 8

movement x%, y%
redrawmap checkformovex%, checkformovey%, x%, y%
GOTO top

'=========================================================================
testgraph:

'create Blank tile
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), blank

'create Left2Right Bar tile
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), WallLR

'create Top2Bottom Bar tile
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), wallUD


'create Corner Upper Left
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), cornerUL

'create Corner Upper Right
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), cornerUR

'create Corner Lower Left
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), cornerDL

'create Corner Lower Right
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), cornerDR


'create face
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), pacman

'create mask
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), charmask

CLS

FOR y = 0 TO 19
  FOR x = 0 TO 31
    READ map
  map(x, y) = map
    NEXT: NEXT


FOR mapx = 0 TO 32 - 1
FOR mapy = 0 TO 20 - 1
    SELECT CASE map(mapx, mapy)
    CASE 0
    PUT (mapx * 10, mapy * 10), blank, PSET
    CASE 1
    PUT (mapx * 10, mapy * 10), WallLR, PSET
    CASE 2
    PUT (mapx * 10, mapy * 10), wallUD, PSET
    CASE 3
    PUT (mapx * 10, mapy * 10), cornerUL, PSET
    CASE 4
    PUT (mapx * 10, mapy * 10), cornerUR, PSET
    CASE 5
    PUT (mapx * 10, mapy * 10), cornerDL, PSET
    CASE 6
    PUT (mapx * 10, mapy * 10), cornerDR, PSET

    CASE ELSE
    END SELECT
NEXT: NEXT
CLS
RETURN





'===========================================================================
'Blank
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00

'wall Left2Right(along the top and bottom)
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00

'wall Top2bottom(along left and right sides)
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
'corner Upper Left
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,01,01,01,01,01,01,01
DATA 00,00,00,01,01,01,01,01,01,01
DATA 00,00,00,01,01,01,01,01,01,01
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00


'Corner Upper Right
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 01,01,01,01,01,01,00,00,00,00
DATA 01,01,01,01,01,01,00,00,00,00
DATA 01,01,01,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00

'corner Lower Left
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,01,01,01,01
DATA 00,00,00,01,01,01,01,01,01,01
DATA 00,00,00,01,01,01,01,01,01,01
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00


'Corner Lower Right
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 01,01,01,01,01,01,00,00,00,00
DATA 01,01,01,01,01,01,00,00,00,00
DATA 01,01,01,01,01,01,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00


'pacman
DATA 00,00,00,14,14,14,14,00,00,00
DATA 00,00,14,14,14,14,14,14,00,00
DATA 00,14,14,14,14,14,14,14,14,00
DATA 00,14,14,14,14,14,14,14,14,00
DATA 14,14,14,14,14,14,14,14,14,14
DATA 14,14,14,14,14,14,14,14,14,14
DATA 00,14,14,14,00,00,00,00,00,00
DATA 00,14,14,14,14,00,00,00,00,00
DATA 00,00,14,14,14,14,14,14,00,00
DATA 00,00,00,14,14,14,14,00,00,00
'mask
DATA 255,255,255,000,000,000,000,255,255,255
DATA 255,255,000,000,000,000,000,000,255,255
DATA 255,000,000,000,000,000,000,000,000,255
DATA 255,000,000,000,000,000,000,000,000,255
DATA 000,000,000,000,000,000,000,000,000,000
DATA 000,000,000,000,000,000,000,000,000,000
DATA 255,000,000,000,000,000,000,000,000,255
DATA 255,000,000,000,000,000,000,000,000,255
DATA 255,255,000,000,000,000,000,000,255,255
DATA 255,255,255,000,000,000,000,255,255,255
'==================================================================
'map data
DATA 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,6

SUB movement (x%, y%)
SELECT CASE INKEY$

CASE CHR$(0) + "H"
'up
IF map(x, y - 1) <> 2 AND (y * 10) - 10 > 1 THEN
y = y - 1
END IF

CASE CHR$(0) + "P"
'down
IF map(x, y + 1) <> 2 AND (y * 10) + 10 < 190 THEN
y = y + 1
END IF

CASE CHR$(0) + "K"
'left
IF map(x - 1, y) <> 2 AND (x * 10) - 10 > 1 THEN
x = x - 1
END IF

CASE CHR$(0) + "M"
'right
IF map(x + 1, y) <> 2 AND (x * 10) + 10 < 310 THEN
x = x + 1
END IF

CASE CHR$(27)
END
END SELECT

END SUB

SUB redrawmap (checkformovex%, checkformovey%, x%, y%)
IF checkformovex <> x OR checkformovey <> y THEN
checkformovex = x
checkformovey = y
'redraw screen
FOR mapx = 0 TO 32 - 1
FOR mapy = 0 TO 20 - 1
    SELECT CASE map(mapx, mapy)
    CASE 0
    PUT (mapx * 10, mapy * 10), blank, PSET
    CASE 1
    PUT (mapx * 10, mapy * 10), WallLR, PSET
    CASE 2
    PUT (mapx * 10, mapy * 10), wallUD, PSET
    CASE 3
    PUT (mapx * 10, mapy * 10), cornerUL, PSET
    CASE 4
    PUT (mapx * 10, mapy * 10), cornerUR, PSET
    CASE 5
    PUT (mapx * 10, mapy * 10), cornerDL, PSET
    CASE 6
    PUT (mapx * 10, mapy * 10), cornerDR, PSET

    CASE ELSE
    END SELECT
NEXT: NEXT

'put character in new location
PUT (x * 10, y * 10), charmask, AND
PUT (x * 10, y * 10), pacman, OR
END IF
END SUB

I also thought I should note that the "Blank" sprite will eventually be replaced by the "pellet" sprite that I haven't made yet, but until then, I'm making it blank cause looking at about 70 pellets gets annoying.
hrono Trigger Fanboy Forever
Reply
#3
Sorry, I don't have time now to load thoroughly at your code now, but I can give you some links about BSAVE and BLOAD.

BLOAD, BSAVE.
Reply
#4
I suppose I ought to give a whirl at showing what I've learned
about BSAVE so far.

Code:
'DIM SHARED pacman(10, 10)
'DIM SHARED charmask(10, 10)
'DIM SHARED blank(10, 10)
'DIM SHARED WallLR(10, 10)
'DIM SHARED wallUD(10, 10)
'DIM SHARED cornerUL(10, 10)
'DIM SHARED cornerUR(10, 10)
'DIM SHARED cornerDL(10, 10)
'DIM SHARED cornerDR(10, 10)

Screen 13 = 320x200x8x1
8 bit color
1 page

You made 10x10 graphics(or Sprites)

First you will need to DIM your Graphics:
Code:
NumSprites = 9
GraphicSizeX = 10
GraphicSizeY = 10
You can DIM SHARE this DIM also.
Code:
DIM Graphics(GraphicSizeX * GraphicSizeY \ 2 + 1, NumSprites - 1)
      ' Graphics(10 * 10 \ 2 + 1, 9 - 1)
      ' Graphics(51, 8)
      ' This is a 2-Dimensional Array called:  Graphics()
      ' 51 is the size of all your graphics for Screen 13
      ' 8 is the number of graphics that can be saved in this array
      ' In this case it is 9 graphics.  Don't forget that zero is part of
      ' this DIM statement such as Graphics(0, 0), Graphics(0, 1), etc.
Next, use your program to PSET the graphics onto the screen and
use the GET statement to save the graphics into memory under the
Graphics() Array.
Code:
testgraph:


'GRAPHIC #1
'create Blank tile
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y

'Instead of using this:

GET (1, 1)-(10, 10), blank

'Use this instead:

GET (1, 1)-(10, 10), Graphics(0, 0)
The next GET statement will use Graphics(0, 1) as the next setting.

Where did the 51 go?
Code:
'The DIM was DIMed to be DIM(51, 8) which means that 52 is the
'max for the first and 9 is the max for the second.  The first one can
'be set from 0 to 51 which is a total of 52.  The second one can be
'set from 0 to 8 which is a total of 9.

'From here on the place where 51 was can be set to any number
'exept 51.  Whatever number you choose must remain that number
'throughout and not change.  Unless you want to code more for
'every individual number(that you set for that part of the array).


'GRAPHIC #2
'create Left2Right Bar tile
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 1)



'GRAPHIC #3
'create Top2Bottom Bar tile
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 2)


'GRAPHIC #4
'create Corner Upper Left
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 3)


'GRAPHIC #5
'create Corner Upper Right
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 4)


'GRAPHIC#6
'create Corner Lower Left
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 5)


'GRAPHIC #7
'create Corner Lower Right
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 6)


'GRAPHIC #8
'create face
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 7)


'GRAPHIC #9
'create mask
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 8)
Now that the graphics are saved in memory by using the GET
statement, the BSAVE can be done.
Code:
DEF SEG = VARSEG(Graphics(0, 0))
BSAVE "c:\Graphic.Bsv", VARPTR(Graphics(0, 0)), (GraphicSizeX * GraphicSizeY + 4) * NumSprites
       ' .............VARPTR(Graphics(0, 0)), (10 * 10 + 4) * 9
       ' .............VARPTR(Graphics(0, 0)), 936
DEF SEG

'DEF SEG means Define Segment
'VARSEG means Variable Segment
Here, in the first line, the Graphics Array is being set and defined.
This makes ready for the computer to save the graphics to a File.

The second like is the BSAVE in which you can save the graphics as
anything you want to call it.

Example:

c:\pacman.eat

a:\ghosts.kill


The reason the Graphics(0, 0) is still set to (0, 0) is because the
computer has the Graphis Array, which is stored in memory, to rely
on. It will then get all the individual graphics from there.

DEF SEG is the last line and sets the Segment back to where it was
before it was used.

The others can show you how to BLOAD and also include your MAP
data statement into the BSAVE file.
Thanks to Plasma for helping me to understand this. :bounce:
I'm your Huckleberry; that's just my game."

Doc Holiday, TOMBSTONE
Reply
#5
The following is everything you need to BSAVE your 9 Graphics:

Just be sure to Name the File what you want and place it in a
directory(folder) so that you can easily find the file later.

Since the graphics are the same size(10x10), it won't matter
if you don't CLS the Screen after every FOR and NEXT statement.
Code:
SCREEN 13

NumSprites = 9
GraphicSizeX = 10
GraphicSizeY = 10
DIM Graphics(GraphicSizeX * GraphicSizeY \ 2 + 1, NumSprites - 1)

'GRAPHIC #1
'create Blank tile
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y

GET (1, 1)-(10, 10), Graphics(0, 0) ' Will be used for Pellet

'GRAPHIC #2
'create Left2Right Bar tile
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 1)' Left2Right Bar tile


'GRAPHIC #3
'create Top2Bottom Bar tile
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 2)' Top2Bottom Bar tile


'GRAPHIC #4
'create Corner Upper Left
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 3)' Corner Upper Left


'GRAPHIC #5
'create Corner Upper Right
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 4)' Corner Upper Right


'GRAPHIC#6
'create Corner Lower Left
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 5)' Corner Lower Left


'GRAPHIC #7
'create Corner Lower Right
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 6)' Corner Lower Right


'GRAPHIC #8
'create face
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 7)' face


'GRAPHIC #9
'create mask
FOR y = 1 TO 10
  FOR x = 1 TO 10
   READ colr
   PSET (x, y), colr
  NEXT x
NEXT y
GET (1, 1)-(10, 10), Graphics(0, 8)' mask


DEF SEG = VARSEG(Graphics(0, 0))
BSAVE "c:\Graphic.Bsv", VARPTR(Graphics(0, 0)), (GraphicSizeX * GraphicSizeY + 4) * NumSprites
       ' .............VARPTR(Graphics(0, 0)), (10 * 10 + 4) * 9
       ' .............VARPTR(Graphics(0, 0)), 936
DEF SEG


' Blank
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
' wall Left2Right(along the top and bottom)
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
' wall Top2bottom(along left and right sides)
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
' corner Upper Left
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,01,01,01,01,01,01,01
DATA 00,00,00,01,01,01,01,01,01,01
DATA 00,00,00,01,01,01,01,01,01,01
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
' Corner Upper Right
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 01,01,01,01,01,01,00,00,00,00
DATA 01,01,01,01,01,01,00,00,00,00
DATA 01,01,01,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
' corner Lower Left
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,01,01,01,01
DATA 00,00,00,01,01,01,01,01,01,01
DATA 00,00,00,01,01,01,01,01,01,01
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
' Corner Lower Right
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 00,00,00,01,01,01,00,00,00,00
DATA 01,01,01,01,01,01,00,00,00,00
DATA 01,01,01,01,01,01,00,00,00,00
DATA 01,01,01,01,01,01,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
DATA 00,00,00,00,00,00,00,00,00,00
' pacman
DATA 00,00,00,14,14,14,14,00,00,00
DATA 00,00,14,14,14,14,14,14,00,00
DATA 00,14,14,14,14,14,14,14,14,00
DATA 00,14,14,14,14,14,14,14,14,00
DATA 14,14,14,14,14,14,14,14,14,14
DATA 14,14,14,14,14,14,14,14,14,14
DATA 00,14,14,14,00,00,00,00,00,00
DATA 00,14,14,14,14,00,00,00,00,00
DATA 00,00,14,14,14,14,14,14,00,00
DATA 00,00,00,14,14,14,14,00,00,00
' mask
DATA 255,255,255,000,000,000,000,255,255,255
DATA 255,255,000,000,000,000,000,000,255,255
DATA 255,000,000,000,000,000,000,000,000,255
DATA 255,000,000,000,000,000,000,000,000,255
DATA 000,000,000,000,000,000,000,000,000,000
DATA 000,000,000,000,000,000,000,000,000,000
DATA 255,000,000,000,000,000,000,000,000,255
DATA 255,000,000,000,000,000,000,000,000,255
DATA 255,255,000,000,000,000,000,000,255,255
DATA 255,255,255,000,000,000,000,255,255,255
I'm your Huckleberry; that's just my game."

Doc Holiday, TOMBSTONE
Reply
#6
I will get to doing this very soon. Right now, I just implemented a simple pellet counter. I also am getting ready to implement ghosts as well as collision detection of the ghosts. I've got a basic idea of how I'm going to do the ghost AI, but I was wondering if there are any good articles on AI. I've heard about something called A* and how it's the best form of AI, but when I searched it on google, I got over 3 billion hits... :o What is A*? Thanks for the help in advance.
hrono Trigger Fanboy Forever
Reply
#7
Quote:What is A*? Thanks for the help in advance.

http://forum.qbasicnews.com/viewtopic.php?t=5801
Reply
#8
Well, since nobody else has shown anything for BLOAD yet
I suppose I will, now that I have more time to do so.
It took me 4 hours just to work out that BSAVE one and that
was because when I submitted it, I had to retype in my
Username and Password again; I then lost everything I typed
for the last 3 hours.

So I re-typed a less wordy one for BSAVE and that was all I
had time for then.

Luckily that didn't happen this time around.

Here it is:

BLOADing is actually the easiest part of it all.

All you really need to do is remember the setting from
the Array you used when you BSAVEed.

For instance; the Array that was used when BSAVEing, was
called:
Code:
'Graphics(51, 8)
'and it's settings are (51, 8).
Oh, and don't forget what you named your File and the Drive
and the directory you saved it under(if any).

First thing you need to do is make an Array to load your
graphics into. You can name this Array anything you like but
for convenience, I will stick with the Graphics() Array I used
when BSAVEing.

I'll also keep the same Drive letter and File name.
Code:
SCREEN 13

DIM Graphics(51, 8)
It is a good idea to BLOAD your graphics under the same
SCREEN number that you BSAVEed them in. After you BLOAD,
you can PUT them on the screen using another SCREEN
number if you would like to.
Code:
DEF SEG VARSEG(Graphics(0, 0))
BLOAD "c:\Graphic.Bsv", VARPTR(Graphics(0, 0))
DEF SEG
After you have BLOADed the graphics into the Graphics() Array,
you can then PUT them on the screen by doing the following:
Code:
PUT (160, 100), Graphics(0, 1), PSET' Wall Left to Right
You can use the Graphics(0, Graphic#) to specify which graphic
image you would like to use; in this case it is 0 through 8.

Leaving a NOTE behind the PUT statement will help you know
what Graphic you are using.

If you don't know right off, just PUT all of the graphics on the
Screen like this:
Code:
PUT (0, 10), Graphics(0, 0), PSET
PUT (12, 22), Graphics(0, 1), PSET
PUT (24, 34), Graphics(0, 2), PSET
PUT (36, 46), Graphics(0, 3), PSET
'........
'........
'...etc.
The code altogether:
Code:
SCREEN 13

DIM Graphics(51, 8)

DEF SEG VARSEG(Graphics(0, 0))
BLOAD "c:\Graphic.Bsv", VARPTR(Graphics(0, 0))
DEF SEG

' Display or use the PUT statements as you want to.
PUT (0, 10), Graphics(0, 0), PSET
PUT (12, 22), Graphics(0, 1), PSET
PUT (24, 34), Graphics(0, 2), PSET
PUT (36, 46), Graphics(0, 3), PSET
'........
'........
'...etc.
And that's that! :king:
I'm your Huckleberry; that's just my game."

Doc Holiday, TOMBSTONE
Reply
#9
Ok, I kind of get it. A little bit. I will test this out later, as I stated earlier. I have a question though. Can all of this be automated through subroutines? I mean could I have a loadgraphics subroutine? Obviously I could probably write a seperate program to automatically write my graphics for me to not bog down my main program so much.

Sorry I'm asking so many simple questions.
hrono Trigger Fanboy Forever
Reply
#10
You can automate most of teh program thru SUBs.....

ex.
Code:
DECLARE SUB ReDrawScreen ()
DECLARE SUB DrawPlayer(posx as integer, poasy as integer)
DECLARE SUB DrawGhosts ()

The SUB ReDrawScreen () will be called every loop, and it will call DrawPlayer(...) and DrawGhosts ()

Oz~
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)