i forgot to mentioned, that i did put a download atachement text file of my pacman source code in prevous post.
how i can i make a "code snippet" link ?.
any way here is my code.
rem set display mode to pixel 800x600 32 bit color
set display mode 800,600,32,1
rem initialize a array of 33 by 16 for the mazed
rem properly i should use 12*12 array, but for now i just using 33*16
dim maze(33,16)
rem ther´s no walls collision detections yet, i have`nt figured out a way, how to do it, in a easy way.
rem blok=24 expand the space between the sprite so it will fit a 800*600 resolution of the screen
blok=24
rem pacman x and y cordinate when the game starts
pacx=320
pacy=200
rem reset data statement pointer to the first element of data in a array.
restore mazedata
rem set the sprite with options sprite no, no backsave, transparency
set sprite 1,0,1
set sprite 2,0,1
set sprite 3,0,0
rem load image for sprite for walls, floor, pacman.
load image "c:\dark basic sprites\pacpills2.bmp",1
load image "c:\dark basic sprites\pacfloor.bmp",2
load image "c:\dark basic sprites\pacman.bmp",3
rem clear screen
cls
rem draw sprite no, x,y cordinate, image no.
sprite 1,x,y,1
sprite 2,x,y,2
rem for next loop, draw maz 16 row height and colum 32 width.
do
gosub maze
gosub control
sync
loop
maze:
for row=0 to 15
for colum=0 to 32
rem read maze array of row,colum (read entire maze)
read maze(colum,row)
rem if maze array contain/finds a 0 (zero digit) then paste the sprite with empty space (the sprite FLOOR is a small black square bitmap picture).
if maze(x,y)=0 then paste sprite 2,colum*blok,row*blok
rem if maze array contain/finds a 1 (one digit ) then paste the sprite with the pac walls sprite.
if maze(colum,row)=1 then paste sprite 1,colum*blok,row*blok
next row
next colum
return
rem pacman movement is zero at the beginning when the game starts.
rem pressing any key,pacman continuously move in that direction, until another key is pressed.
countxleft=0
countxright=0
countyleft=0
countyright=0
control:
pacx=pacx-countxleft
pacx=pacx+countxright
pacy=pacy+countyleft
pacy=pacy-countyright
rem if user pressed the left key, on the keyboard, then move pacman to left (pacx=pacx+1). instead of using pacx=pacx+1 i added PACX=PACX+COUNTERX.
if scancode()=203 then countxleft=1:countxright=0:countyleft=0:countyright=0
rem if user pressed the right on the keyboard, then move pacman to the right.
rem right
if scancode()=205 then countxright=1:countxleft=0:countxleft=0:countyleft=0:countyright=0
rem up
if scancode()=208 then countyleft=1:countyright=0:countxright=0:countxleft=0
rem down
if scancode()=200 then countyright=1:countyleft=0:countxright=0:countxleft=0
rem draw pacman sprite no, x,y,image
sprite 3,pacx,pacy,3
return
mazedata:
data 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,1,1,1
data 1,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,0,1
data 1,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,0,1
data 1,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,0,1
data 1,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,0,1
data 1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1
data 1,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,0,1
data 1,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,0,1
data 1,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,0,1
data 1,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,0,1
data 1,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,0,1
data 1,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,0,1
data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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