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 / Fully documented Pac Man game writing tutorial - DBPro

Author
Message
Scouseknight
20
Years of Service
User Offline
Joined: 15th Mar 2004
Location: Bootle, Merseyside, UK
Posted: 30th Mar 2004 17:35 Edited at: 30th Mar 2004 18:59
First of all I would like to thank everyone on this board that has helped me with Dark Basic Professional - and I thought I would give something back.

I've been secretly beavering away making a tutorial for writing a Pac Man game - I've seen a few people asking for one, have followed the excellent advice offered in response to such questions, and have managed to get a working Pac Man game out of it.

The tutorial is lengthly and should be easy enough for an absolute beginner to understand (if I can, anyone can springs to mind) so I hope it at least helps new people to get into the mechanics of how a game loop works e.t.c. if nothing else.

http://skgpl.co.uk/DBPro/PacManTutorial.exe

You'll need Adobe Acrobat to view this tutorial, and all source code and media is included.

The game will end up like this :



The tutorial without supporting media can be viewed here : http://skgpl.co.uk/DBPro/pacmantut.pdf

Good Luck!

DarkSin
21
Years of Service
User Offline
Joined: 23rd Jul 2003
Location: Under your bed
Posted: 31st Mar 2004 03:47
Holy crap... I just skimmed over it and it looks very nice... this would be usefull to anyone new to this language for sure Very nice sir .


Spaceman Spiff
20
Years of Service
User Offline
Joined: 27th Jan 2004
Location: Smacking my head on your keyboard.
Posted: 31st Mar 2004 06:27
Sweet,TTTTTHHHHHHHAAAANNNKKKK YYYYYYOOOOOUUUUUU I've been looking for a pac-man tut for a long time.Can't wait to use it when DBPro finaly gets to my house.
Scouseknight
20
Years of Service
User Offline
Joined: 15th Mar 2004
Location: Bootle, Merseyside, UK
Posted: 1st Apr 2004 04:05
Thanks a lot fellas - appreciated

diablo fan
20
Years of Service
User Offline
Joined: 7th Jan 2004
Location: michigan usa
Posted: 3rd Apr 2004 00:10
you beat me too it but thanks im happy for all of us.

please dont make fun of my spelling,or sentence structure.Id rather study math or programming
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 3rd Apr 2004 00:16
can I ask why the download is an exe?
is that the game and nothing else?

just curious.



Home of the VB.NET Class Builder Utility - Demo available now!
Scouseknight
20
Years of Service
User Offline
Joined: 15th Mar 2004
Location: Bootle, Merseyside, UK
Posted: 3rd Apr 2004 00:24
The .exe file has the media, source and pdf in it to allow the game to be run (it's a self-extracting archive).

There is a .pdf only version as well which is just the document.

For diablo fan - this really is a beginners version of a pac man game - it wasn't designed to compete with the other tutorials on the same thing - I'm as keen as anyone to see the other tutorials also and to see where my style of pac man game writing can improve - but the game loop and simple AI concepts in my tutorial will at least help beginners like the tutorials so far have helped me.

Kentaree
21
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 3rd Apr 2004 01:23
Haven't downloaded it yet, wait till I have access to a better connection than this. Looks very nice though, well done, this could be a great help to the community!

Cheers,
Kentaree

Its not a bug, its a feature!
Blue Shadow
20
Years of Service
User Offline
Joined: 6th Feb 2004
Location:
Posted: 11th Apr 2004 21:11
An excellent tutorial. It should definetly be stickied. Well done you!!!!

Cheers,

Michael

Visit the Code Monkey's website at http://www.freewebs.com/codemonkeystudios
Neofish
20
Years of Service
User Offline
Joined: 7th Apr 2004
Location: A swimming pool of coke
Posted: 11th Apr 2004 23:07
great, i'll use it when i get BDP on my birthday (22nd)

N30F15H
Co-CEO of Pulse Productions
www.pulseproductions.tk
Twisted Demon
20
Years of Service
User Offline
Joined: 4th Apr 2004
Location:
Posted: 12th Apr 2004 15:12
all i can say is, without guys like you it would be icredibly hard to start dark basic, thanks alot man, you must of put alot of effort, i dont know how to thank you enough!
Blue Shadow
20
Years of Service
User Offline
Joined: 6th Feb 2004
Location:
Posted: 12th Apr 2004 15:14
Hey mods. This definetly needs to be stickied.

Visit the Code Monkey's website at http://www.freewebs.com/codemonkeystudios
Twisted Demon
20
Years of Service
User Offline
Joined: 4th Apr 2004
Location:
Posted: 12th Apr 2004 16:40
im having a really strange problem, ive been following the program, but when i get to a certain point, when i type, nothing comes up in the editor, heres the code, ill use some astericks, to show you where i mean.

Rem Project: PacMan Tutorial
Rem Created: 12/04/2004 12:21:28

Rem ***** Main Source File *****

`Settings
set display mode 1024, 786, 32
hide mouse
sync on
autocam off
cls

global playerZ#
global playerY#
global playerUp
global playerDown
global playerRight
global playerLeft

`Calls Load Level
Load_Level()

`Create "MaxMan"
make object sphere 1000, 6
color object 1000, rgb(255,255,0)
Start_Level()

`The main Loop
do
Position camera 87, 150, 87
point camera 87,0,87

Player_Move()

Player_Turn()

Player_Show()

sync
loop


Function Load_Level()

mazeWall = 0
mazePill = 200
mazePower = 500

load image "blank.bmp", 1


make matrix 1, 128, 160, 16, 20
prepare matrix texture 1, 1, 1, 1
fill matrix 1,0,1
position matrix 1, 24, 0, 0


groundHeight = get ground height (1, 87, 87)

For MazeY = 1 to 20
for MazeX = 1 to 16

read maze

if maze = 1
inc mazeWall
make object cube mazeWall, 8
color object mazeWall, rgb(0,0,255)
position object mazeWall, (mazeX*8) + 20, groundHeight, (mazeY*8) - 4
endif

if maze = 2
inc mazeWall
make object cube mazeWall,8
color object mazeWall, rgb(255,0,255)
position object mazeWall, (mazeX*8) + 20, gorundHeight, (mazeY*8) - 4
endif

if maze = 3
inc mazePill
inc pills
make object sphere mazePill, 2
color object mazePill, rgb(255,255,0)
position object mazePill, (mazeX*8) + 20, groundHeight, (mazeY*8) - 4
endif

if maze = 4
inc mazePower
make object sphere mazePower, 4
color object mazePower, rgb(255,255,0)
position object mazePower, (mazeX*8) + 20, gorundHeight, (mazeY*8) - 4
endif

next mazeX
next mazeY

Endfunction
function Start_Level()

playerX# = 84
playerZ# = 52
groundHeight = get ground height (1, 87,87)
position object 1000, playerX#, gorundHeight, playerZ#

playerUp = 0
playerDown = 0
playerRight = 0
playerLeft = 0

endfunction

function Player_Move()

if playerUp then playerZ# = playerZ# + 1
if playerDown then playerZ# = playerZ# - 1
if playerRight then playerX# = playerX# + 1
if playerLeft then playerX# = playerX# - 1

endfunction

function Player_Turn()

if upkey()
playerUp = 1
endif

if downkey()
playerDown = 1
endif

if leftkey()
playerLeft = 1
endif

if rightkey()
playerRight = 1
endif

endfunction

function Player_Show


groundHeight = get ground height (1, 87,87)
position object 1000, playerY#, groundHeight, playerZ#

endfunction
********************************************

if i try to type anything here, the cursor moves but i see no text!!

*********************************************
Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
Data 1,3,3,3,3,1,3,3,3,3,1,3,3,3,3,1
Data 1,4,1,1,3,3,3,1,1,3,3,3,1,1,4,1
Data 1,3,1,1,1,1,3,3,3,3,1,1,1,1,3,1
Data 1,3,3,3,3,3,3,1,1,3,3,3,3,3,3,1
Data 1,1,1,3,1,1,1,1,1,1,1,1,3,1,1,1
Data 1,3,3,3,3,3,3,0,0,3,3,3,3,3,3,1
Data 1,3,1,3,1,1,1,1,1,1,1,1,3,1,3,1
Data 1,3,1,3,1,1,1,1,1,1,1,1,3,1,3,1
Data 1,3,1,3,3,3,3,3,3,3,3,3,3,1,3,1
Data 1,3,1,3,1,3,1,1,1,1,3,1,3,1,3,1
Data 1,3,3,3,1,3,1,0,0,1,3,1,3,3,3,1
Data 1,1,1,3,1,3,1,2,2,1,3,1,3,1,1,1
Data 0,0,0,3,3,3,0,0,0,0,3,3,3,0,0,0
Data 1,1,1,3,1,1,1,1,1,1,1,1,3,1,1,1
Data 1,3,3,3,3,3,3,1,1,3,3,3,3,3,3,1
Data 1,3,1,1,1,1,3,3,3,3,1,1,1,1,3,1
Data 1,4,1,1,3,3,3,1,1,3,3,3,1,1,4,1
Data 1,3,3,3,3,1,3,3,3,3,1,3,3,3,3,1
Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
Zone Chicken
20
Years of Service
User Offline
Joined: 25th Jan 2004
Location: `~-..-~`~-..-~`
Posted: 13th Apr 2004 01:47
I have also had this happen to me serveral times while codeing, but only while multitasking with serveral windows. Only thing to do is save the source and reopen it to get the text to show again.
andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 13th Apr 2004 02:03
Sometimes the editor has problems writing in areas below functions, especially if they are folded. Dont fold functions, and place all of your functions BELOW all code. Just as a precaution.

"All programmers are playwrites and all computers are lousy actors" -Anon
Scouseknight
20
Years of Service
User Offline
Joined: 15th Mar 2004
Location: Bootle, Merseyside, UK
Posted: 13th Apr 2004 02:41
Cheers guys - glad this is of some use to people - like I said plaudits go to the people who help other people - I've had a lot of help and it's nice to know help is appreciated

Re : "laggy typing"

I get this problem a lot with the editor - I tend to use a lot of functions - I only tend to have a small main program with lots of functions which makes this problem particularly irksome - but as above there are ways to cope with it.

diablo fan
20
Years of Service
User Offline
Joined: 7th Jan 2004
Location: michigan usa
Posted: 13th Apr 2004 05:29
i have printed the 88 pages and put them in a folder and i have been studing this now for awhile it great.

please dont make fun of my spelling,or sentence structure.Id rather study math or programming
Blue Shadow
20
Years of Service
User Offline
Joined: 6th Feb 2004
Location:
Posted: 16th Apr 2004 20:55
I think indi was looking for this to sticky so. Sticky sticky stick. lol.


Visit the Code Monkey's website at http://www.freewebs.com/codemonkeystudios
Archaegeo
20
Years of Service
User Offline
Joined: 10th Mar 2004
Location:
Posted: 16th Apr 2004 21:28
Probable the perfect DBP tutorial, well well done

The only way i think it could be perfect is if you were able to make it 2 player to demonstrate multiplayer stuff, or maybe make that and advanced tutorial, but still, for a single player game, this is the perfect tutorial. Teaches folks everything they need to know to get started making games.

They always say you should lean by making a tetris game, a breakout game, and then finally a pacman game, but you could skip the first two if you wanted with this tutorial.
BigC
20
Years of Service
User Offline
Joined: 17th Apr 2004
Location:
Posted: 18th Apr 2004 05:19
wow

whatup
Blue Shadow
20
Years of Service
User Offline
Joined: 6th Feb 2004
Location:
Posted: 19th Apr 2004 23:28
bump


Visit the Code Monkey's website at http://www.freewebs.com/codemonkeystudios
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 19th Apr 2004 23:57
nice!


Formerly known as "DarkWing Duck"
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 20th Apr 2004 04:40 Edited at: 20th Apr 2004 18:17
[edit] oh never mind i figured it out...


Formerly known as "DarkWing Duck"
Blue Shadow
20
Years of Service
User Offline
Joined: 6th Feb 2004
Location:
Posted: 24th Apr 2004 17:58
Great Tutorial. Please can one of the mods sticky this postand unticky the "Converting Scouseknight's Tutorial to 2d?" post at the top. That was just a question i had about it. Cheers.


Visit the Code Monkey's website at http://www.codemonkeystudios.tk

Login to post a reply

Server time is: 2024-09-22 06:36:48
Your offset time is: 2024-09-22 06:36:48