Ok, this is really annoying me now. I've searched the boards here and found a few threads with this query. Sadly, none of them were able to help me
I am following the ScouseKnight Pacman tutorial as part of the games development course I am on. I have reached a part I have spent the last 3 hours trying to fix and I really can't see what's wrong.
The Error: Error 105: Illegal Number at Line 202
Line 202:
Function _Draw_Cast()
Local n
For n = 1 to 5
Sprite n, Cast(n,1), Cast(n,2), Cast(n,3)
Set Sprite n, 0, 1
Next n
Endfunction
What is wrong with that? That's exactly what the tutorial tells me to do, but it just will not work.
The whole code so far:
REM Project: Pacman
REM Created: 09/10/2008 13:19:28
REM
REM ***** Main Source File *****
REM
Sync on
Sync Rate 60
Set Display Mode 1024,768,32
Ink RGB(255,255,255),0
cls
Global ImageNumber
Global Dim Maze(21,22)
Global PenX, PenY, Pills
Global MazeCount = 1
Global ThisMaze
Global Dim MazeInventory$(MazeCount)
Global Dim Cast(5,3)
Global PlayerX, PlayerY
Rem Set Initial Maze
ThisMaze = 0
Rem Declare out Maze inventory
_Declare_Mazes()
Rem Load Media
_Load_Media()
Rem Load Maze
_Load_Maze()
Rem Initialise Cast
_Initialise_Cast()
Rem Draw Maze
_Draw_Maze()
Rem Main Program Loop
Do
_Draw_Cast()
Sync
Loop
Function _Load_Media
Load Bitmap "Graphics\Mazeparts.bmp",1
Global PenX, PenY, Pills
ImageNumber = 2
For Row = 0 To 90 Step 30
For Col = 0 To 90 Step 30
ImageNumber = ImageNumber + 1
Get Image ImageNumber, Col, Row, Col + 30, Row + 30, 1
Next Col
Next Row
Delete Bitmap 1
Rem
Rem Get Ghosts and additional maze pieces from Bitmap
Rem
Load Bitmap "Graphics\Ghosts.bmp",1
ImageNumber = 89
For Row = 0 To 60 Step 30
For Col = 0 To 90 Step 30
ImageNumber = ImageNumber + 1
If ImageNumber <= 89
Get Image ImageNumber, Col, Row, Col + 30, Row + 30, 1
Endif
Next Col
Next Row
Get Image 2, 60, 60, 90, 90, 1
Get Image 1, 90, 60, 120, 90, 1
Delete Bitmap 1
Rem
Rem Ghost Pen
Rem
Load Bitmap "Graphics\Ghostpen.bmp",1
Get Image 19, 0, 0, 150, 120, 1
Delete Bitmap 1
Rem Load Player
Load Bitmap "Graphics\Player.bmp",1
ImageNumber = 19
For Row = 0 To 90 Step 30
For col = 0 To 270 Step 30
Inc ImageNumber
Get Image ImageNumber, Col, Row, Col + 30, Row +30, 1
Next Col
Next Row
Delete Bitmap 1
Endfunction
Function _load_Maze()
Local TheFile$, TheCell, X, Y
Local TheLine$
Local LinesRead, C, TheChar$, ThePart$
Rem Determine Filename of Maze to Load
Inc ThisMaze
If ThisMaze > MazeCount
ThisMaze = 1
Endif
TheFile$ = MazeInventory$(ThisMaze)
Rem Reset Pills Counter
Pills = 0
Rem Open Maze File
Open To Read 1, "Mazes\" + TheFile$
LinesRead = 0
Repeat
Inc LinesRead
Read String 1, TheLine$
Rem Player Cell
If LinesRead = 1
PlayerX = Val(Left$(TheLine$,2))
PlayerY = Val(Right$(TheLine$,2))
Endif
Rem Pen Cell
If LinesRead = 2
PenX = Val(Left$(TheLine$,2))
PenY = Val(Right$(TheLine$,2))
Endif
Rem Rest of Maze
If LinesRead >=3
Y = LinesRead - 2
X = 0
ThePart$ = ""
For C = 1 To Len(TheLine$)
TheChar$ = Mid$(TheLine$,C)
If TheChar$ = ","
Inc X
TheCell = Val(ThePart$)
Maze(Y,X) = TheCell
If TheCell = 1
Inc Pills
Endif
ThePart$ = ""
Else
ThePart$ = ThePart$ + TheChar$
Endif
Next C
Inc X
TheCell = Val(ThePart$)
Maze(Y,X) = TheCell
If TheCell = 1
Inc Pills
Endif
Endif
Until File End(1)
Endfunction
Function _Initialise_Cast()
Rem Player
Cast(1,1) = 197 + (PlayerX - 1) * 30
Cast(1,2) = 25 + (PlayerY - 1) * 30
Cast(1,3) = 30
Rem Red Ghost
Cast(2,1) = 197 + (PenX * 30)
Cast(2,2) = 25 + (PenY * 30)
Cast(2,3) = 60
Rem Blue Ghost
Cast(3,1) = 197 + (PenX + 1) * 30
Cast(3,2) = 25 + (PenY * 30)
Cast(3,3) = 61
Rem Green Ghost
Cast(4,1) = 197 + (PenX + 2) * 30
Cast(4,2) = 25 + (PenY * 30)
Cast(4,3) = 62
Rem Pink Ghost
Cast(5,1) = 197 + (PenX + 1) * 30
Cast(5,2) = 25 + (PenY + 1) * 30
Cast(5,3) = 63
Endfunction
Function _Draw_Cast()
Local n
For n = 1 to 5
Sprite n, Cast(n,1), Cast(n,2), Cast(n,3)
Set Sprite n, 0, 1
Next n
For n = 6 to 9
Sprite n, Cast(n-4,1), Cast(n-4,2), 64
Set Sprite n, 0, 1
Next n
Endfunction
Function _Draw_Maze()
Local TheCell, X, Y
Local ThisX, ThisY
ThisY = 25
For Y = 1 To 22
ThisX = 197
For X = 1 to 21
TheCell = Maze(Y, X)
If TheCell >= 1 And TheCell <=18
Paste Image TheCell, ThisX, ThisY,0
Endif
ThisX = ThisX + 30
Next X
ThisY = ThisY + 30
Next Y
Rem Paste Pen
Paste Image 19,197 + (PenX - 1) * 30, 25 + (PenY - 1) * 30, 0
Paste Image 18, 197 + (PenX + 1) * 30,25 + (PenY - 1) * 30, 0
Endfunction
Function _Declare_Mazes
MazeInventory$(1) = "0001.Maz"
Endfunction
P.S. Yes I've updated DBPro to 6.9, that didn't help.
P.S.S. Updating on Vista 64bit was a pain, the updater will only recognize the program is installed if it is installed to "\Program Files\The Game Creators", Vista 64 bit likes to install things to "Program Files(x86)"