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 / can anyone explain this script? (DB)

Author
Message
Sqwerty
19
Years of Service
User Offline
Joined: 8th Oct 2004
Location:
Posted: 31st Oct 2004 10:11 Edited at: 31st Oct 2004 10:31
found it in the 2D section.. was wondering if anyoen could explain this script cause this is what i need.. also.. can DarkBasic Pro read DarkBasic script (DB regular i mean...)

BTW explaining this would really help me alot cause its how i think and work.. like when i used flash MX i didnt understand anything till someoen explained one of their game scripts..

` This code was downloaded from The Game Creators
` It is reproduced here with full permission
` http://www.thegamecreators.com

` 2D GTA
` Created By Ryan & Alex
sync on
sync
px=50
py=25
dx=px+1
do
cls
` boundaries
if x <10
x=150
endif
if y <10
y=150
endif
if x >625
x=625
endif
if px >625
px=625
endif
if y >450
y=450
endif
if py >450
py=450
endif
if py=y
print "your dead"
wait 1500
end
endif
` end of boundaries
` have pedestrian follow you
if px+1 >x+1
px=x
endif
if px-2 >x-2
px=x
endif
if py-1 >y+1
py=y-11
endif
if py+1 >y-0
py=y-1
endif
if py+0 >y+11
py=y
endif
if py=y
py=y-24
endif
if py=y
py=y-0
endif
` end have pedestrian follow you
if upkey()=1 then y=y-3
if downkey()=1 then y=y+3
if leftkey()=1 then x=x-3
if rightkey()=1 then x=x+3
if spacekey()=1
ink rgb(254,0,0),1
circle x,y,5
circle x,y,4.5
circle x,y,4
circle x,y,3.5
circle x,y,3
circle x,y,2.5
circle x,y,2
circle x,y,1.5
dot x,y
ink rgb(254,0,0),1
line x+9.5,y-5,x+4,y+5
endif
` guy
ink rgb(254,0,0),1
circle x,y,3
circle x,y,2.5
circle x,y,2
circle x,y,1.5
circle x,y,1
` eyes
dot x,y
ink rgb(0,0,0),2
dot x+1,y-2
dot x-1,y-2
` end eyes
` arm
ink rgb(254,0,0),1
line x+7.5,y-3,x+3,y+3
` end arm
` sheild
ink rgb(0,511,0),3
line x-13,y-4,x-3,y-4
` end shield
ink rgb(254,0,0),1
line x-7.5,y-3,x+4,y+3
ink rgb(254,0,0),1
line x-2,y+7,x+0,y+3
` pitch fork
ink rgb(254,254,254),2
line x+7,y-10,x+7,y
line x+2,y-10,x+7,y-10
line x+12,y-10,x+8,y-10
line x+12,y-17,x+12,y-10
line x+2,y-17,x+2,y-10
line x+7,y-20,x+7,y-10
if x=pxy
x=pxy
endif
` end pitch fork
` end guy
` pedestrian
ink rgb(0,254,0),2
circle px,py,3
circle px,py,2.5
circle px,py,2
circle px,py,1.5
circle px,py,1
circle px,py,0.5
circle px,py,0
ink rgb(0,0,0),2
dot px+2,py+1
dot px+2,py-1
` end pedestrian
` pedestrian gun
ink rgb(254,254,254),1
line px+7.5,py--3,px+3,py--3
px=px+1
py=py+1
` end pedestrian gun
sync
return
loop
1tg46
20
Years of Service
User Offline
Joined: 1st Feb 2004
Location: I dont know!
Posted: 31st Oct 2004 20:39
Can you use code tags next time?

It seem like it is a complicated mess. The first two parts deal with finding the correct mouse coordinates, and the rest is for drawing on the screen. Have you already tried compiling it?


Click the sig
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 31st Oct 2004 21:23
it is a mess, try finding more useable code to work from, the game doesn`t even do anything intelligible, just a imp thing that goes left right and a falling thing, you die if it misses or hits you and then it ends, not well written and not something to learn from if you want to write good code, there is a pong tutorial, you might want to look at that, some of the DB example code is pretty simple to follow as well, try the snippets thread.

Mentor.

PC1: P4 3ghz, 1gig mem, 3x160gig hd`s, Radeon 9800pro w cooler (3rd gfx card), 6 way speakers.
PC2: AMD 2ghz, 512mb ram, FX5200 ultra, 16 bit SB.
Mini ATX cases suck.
Sqwerty
19
Years of Service
User Offline
Joined: 8th Oct 2004
Location:
Posted: 31st Oct 2004 21:47
well.. it said GTA2.. oh well.. im lookin for soemthing like that..

Login to post a reply

Server time is: 2024-09-23 04:22:43
Your offset time is: 2024-09-23 04:22:43