Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / ScouseKnights Pac Man tutorial

Author
Message
Epsilon
21
Years of Service
User Offline
Joined: 30th Jul 2003
Location: North West, UK
Posted: 23rd Nov 2004 17:47
Hi, i am working my way through this great tutorial by scouseknight and i have come up a cropper at a section.

I get a runtime error, where there is a problem with the array, possibly out of bounds at the line

MazeRight = Maze#(CentreZ, CentreX + 1)

The Maze# array is Maze#(20,16) has 1 to 20 of rows filled with numbers from the data statements and 1 to 16 columns

Row 0 hasnt been filled and isnt used in the loop so 0,0 0,1 0,2 etc. to 16 dont have info in them.

The error occurs when i try to leave the maze from the right, i think MazeRight is trying to look for a number in part of the array that doesnt exist.

When leaving the maze it is set to switch to the other side of the maze when the position PlayerX# is >=150.

Since CentreX# = (PlayerX# -20)/8
and CentreX = int(CentreX#) the above of

CentreX + 1 work out at 16.25 as int of 16 + 1 = 17

So MazeRight is looking for data in column 17 when it hits the PlayerX# position of 150.

This is something i came up with last night after i came off the pc so i havent tried any tests, just wanted to ask how i could fix it cos im not sure.

Thanks for any help
Epsilon
21
Years of Service
User Offline
Joined: 30th Jul 2003
Location: North West, UK
Posted: 23rd Nov 2004 19:01
Sorry havent attached any source code, it is all at
http://www.scouseknight.com

Explained in his .pdf file tutorial
Epsilon
21
Years of Service
User Offline
Joined: 30th Jul 2003
Location: North West, UK
Posted: 23rd Nov 2004 19:14
Realised i might as well change the array to



That way there are blank positions in the array at all sides of the maze.

If anyone else who has completed this tutorial knows that this will cause problems later in please let me know, because ive only just started examining the code for eating the pills

Thanks

Login to post a reply

Server time is: 2024-09-23 05:29:04
Your offset time is: 2024-09-23 05:29:04