i'm giving this to the community ....
i hope it....well... i guess.. it might help.... ????
tell me what you think...
This code is for DBPro ... you probably can change it though to DBC
controls are:
Left Arrow and Right Arrow for the Left Fighter ( player 1)
'A' and 'D' for the right fighter (player 2)
player 1 uses 'p' for punch and 'k' for kick
player 2's attacks are not yet programmed...
remstart
a stick - fight game... lol XD
what was i thinking? ....
remend
type fighter
x as integer `current x pos
y as integer `current y pos
name as string `name of fighter
hp as integer `current hit points
mp as integer `current magic points
action as integer `current action
frame as integer `current frame
c1 as integer `color 1 for fighter
c2 as integer `color 2 for fighter
c3 as integer `color 3 for fighter
null as integer `null variable
endtype
dim player(2) as fighter
hide mouse
sync on
setup()
` title()
` main_menu()
selectchar()
play()
end
function play()
cls
sync
ink rgb(230,230,0),0
box 20,40,122,50
box 600,40,702,50
ink 0,0
box 21,41,121,49
box 601,41,701,49
r=0
p=10
for i=1 to 100
ink rgb(0,r,0),0
line 121-i,41,121-i,49
line 600+i,41,600+i,49
r=r+3
if r>255 then r=255
wait 10
sync
next i
ink rgb(0,0,255),0
text 20,1,player(1).name
text 600,1,player(2).name
sync
action1step=1
action2step=1
do
update()
action1=player(1).action
action2=player(2).action
tick1#=tick1#+0.51
tick2#=tick2#+0.51
if tick1#>=1
tick1#=0
aa=action1step
player(1).frame=player(1).frame+aa
if player(1).action=1 then mxf=4
if player(1).action=2 then mxf=4
if player(1).action=3 then mxf=5
if player(1).action=4 then mxf=4
if player(1).frame>mxf
player(1).frame=mxf-1
action1step=-1
endif
if player(1).frame<1
player(1).frame=1
action1step=1
if player(1).action=3 then player(1).action=1
IF player(1).action=4 then player(1).action=1
endif
update()
endif
if tick2#>=1
tick2#=0
aa=action2step
player(2).frame=player(2).frame+aa
if player(2).action=1 then mxf=4
if player(2).action=2 then mxf=4
if player(2).action=3 then mxf=5
if player(2).action=4 then mxf=4
if player(2).frame>mxf
player(2).frame=mxf-1
action2step=-1
endif
if player(2).frame<1
player(2).frame=1
action2step=1
if player(2).action=4 then player(2).action=2
endif
update()
endif
if keystate(205)=1
if action1=1
player(1).x=player(1).x+3
player(1).action=1
player(1).frame=2
tick1#=0
update()
endif
endif
if keystate(203)=1
if action1=1
player(1).x=player(1).x-3
player(1).action=1
player(1).frame=2
tick1#=0
update()
endif
endif
if keystate(25)=1 and action1<>3
if action1=1
player(1).action=3
player(1).frame=1
tick1#=0
update()
endif
endif
if keystate(37)=1 and action1<>4
if action1=1
player(1).action=4
player(1).frame=1
tick1#=0
update()
endif
endif
if keystate(30)=1
if action2=2
player(2).x=player(2).x-3
player(2).action=2
player(2).frame=1
tick2#=0
update()
endif
endif
if keystate(32)=1
if action2=1
player(2).x=player(1).x+3
player(2).action=2
player(2).frame=1
tick2#=0
update()
endif
endif
if abs(player(1).x-player(2).x)<62
if player(1).x>player(2).x
if player(2).x+63>1020
player(1).x=1020
player(2).x=1020-63
else
player(1).x=player(2).x+63
player(2).x=player(2).x
endif
else
if player(2).x-63<10
player(1).x=10
player(x).x=10+63
else
player(1).x=player(2).x-63
endif
endif
endif
remstart
if player(1).x<player(2).x
player(1).action=1
player(2).action=2
else
player(1).action=2
player(2).action=1
endif
endif
remend
oldq1=q1
oldq2=q2
q1=player(1).x
q2=player(2).x
if oldq1<>q1 or oldq2<>q2
draw to front
ink 0,0
box 50,600,400,650
ink rgb(255,0,0),0
text 50,600,"player(1).x = "+str$(player(1).x)
text 50,615,"player(2).x = "+str$(player(2).x)
text 50,630,"player(1).x - player(2).x = "+str$(player(1).x-player(2).x)
endif
loop
wait key
endfunction
function update()
`draw player 1 and player 2 at the right place with the right animation frame
for i=1 to 2
x=player(i).x
y=player(i).y
c1=player(i).c1
c2=player(i).c2
ink 0,0
box x-35,y-20,x+35,y+200
select player(i).action
case 1 : rem standing - faceing right complete
select player(i).frame
case 1
ink c1,0
circle x,y,15
line x,y+15,x,y+60
line x,y+60,x-5,y+95
line x-5,y+95,x-15,y+115
line x,y+60,x+10,y+95
line x+10,y+95,x,y+115
line x-5,y+18,x+5,y+18
line x-5,y+18,x-15,y+35
line x-15,y+35,x+5,y+55
line x+5,y+18,x+8,y+45
line x+8,y+45,x+20,y+30
ink c2,0
circle x+7,y+55,2
circle x+20,y+28,2
endcase
case 2
ink c1,0
circle x-1,y,15
line x,y+15,x,y+60
line x,y+60,x-4,y+95
line x-4,y+95,x-13,y+115
line x,y+60,x+9,y+95
line x+9,y+95,x-1,y+115
line x-4,y+18,x+4,y+18
line x-5,y+18,x-13,y+35
line x-13,y+35,x+4,y+53
line x+5,y+18,x+7,y+45
line x+7,y+45,x+18,y+31
ink c2,0
circle x+6,y+53,2
circle x+18,y+29,2
endcase
case 3
ink c1,0
circle x,y,15
line x,y+15,x,y+60
line x,y+60,x-3,y+95
line x-3,y+95,x-12,y+115
line x,y+60,x+8,y+95
line x+8,y+95,x-2,y+115
line x-5,y+18,x+5,y+18
line x-4,y+18,x-13,y+35
line x-13,y+35,x+4,y+52
line x+4,y+18,x+7,y+45
line x+7,y+45,x+18,y+33
ink c2,0
circle x+6,y+52,2
circle x+18,y+31,2
endcase
case 4
ink c1,0
circle x+1,y,15
line x,y+15,x,y+60
line x,y+60,x-4,y+95
line x-4,y+95,x-13,y+115
line x,y+60,x+9,y+95
line x+9,y+95,x-1,y+115
line x-4,y+18,x+4,y+18
line x-5,y+18,x-13,y+35
line x-13,y+35,x+4,y+53
line x+5,y+18,x+7,y+45
line x+7,y+45,x+18,y+31
ink c2,0
circle x+6,y+53,2
circle x+18,y+29,2
endcase
endselect
endcase
case 2 : rem standing - facing left
select player(i).frame
case 1
ink c1,0
circle x,y,15
line x,y+15,x,y+60
line x,y+60,x+5,y+95
line x+5,y+95,x+15,y+115
line x,y+60,x-10,y+95
line x-10,y+95,x,y+115
line x+5,y+18,x-5,y+18
line x+5,y+18,x+15,y+35
line x+15,y+35,x-5,y+55
line x-5,y+18,x-8,y+45
line x-8,y+45,x-20,y+30
ink c2,0
circle x-7,y+55,2
circle x-20,y+28,2
endcase
case 2
ink c1,0
circle x-1,y,15
line x,y+15,x,y+60
line x,y+60,x+4,y+95
line x+4,y+95,x+13,y+115
line x,y+60,x-9,y+95
line x-9,y+95,x+1,y+115
line x+4,y+18,x-4,y+18
line x+5,y+18,x+13,y+35
line x+13,y+35,x-4,y+53
line x-5,y+18,x-7,y+45
line x-7,y+45,x-18,y+31
ink c2,0
circle x-6,y+53,2
circle x-18,y+29,2
endcase
case 3
ink c1,0
circle x,y,15
line x,y+15,x,y+60
line x,y+60,x+3,y+95
line x+3,y+95,x+12,y+115
line x,y+60,x-8,y+95
line x-8,y+95,x+2,y+115
line x+5,y+18,x-5,y+18
line x+5,y+18,x+13,y+35
line x+13,y+35,x-4,y+52
line x-4,y+18,x-7,y+45
line x-7,y+45,x-18,y+33
ink c2,0
circle x-6,y+52,2
circle x-18,y+31,2
endcase
case 4
ink c1,0
circle x+1,y,15
line x,y+15,x,y+60
line x,y+60,x+4,y+95
line x+4,y+95,x+13,y+115
line x,y+60,x-9,y+95
line x-9,y+95,x+1,y+115
line x+4,y+18,x-4,y+18
line x+4,y+18,x+13,y+35
line x+13,y+35,x-4,y+53
line x-5,y+18,x-7,y+45
line x-7,y+45,x-18,y+31
ink c2,0
circle x-6,y+53,2
circle x-18,y+29,2
endcase
endselect
endcase
case 3 : rem punch right
select player(i).frame
case 1
ink c1,0
circle x,y,15
line x,y+15,x,y+60
line x,y+60,x-5,y+95
line x-5,y+95,x-15,y+115
line x,y+60,x+10,y+95
line x+10,y+95,x,y+115
line x-5,y+18,x+5,y+18
line x-5,y+18,x-12,y+35
line x-12,y+35,x+7,y+45
line x+5,y+18,x+6,y+43
line x+6,y+43,x+18,y+40
ink c2,0
circle x+5,y+45,2
circle x+18,y+38,2
endcase
case 2
ink c1,0
circle x,y,15
line x,y+15,x,y+60
line x,y+60,x-5,y+95
line x-5,y+95,x-15,y+115
line x,y+60,x+10,y+95
line x+10,y+95,x,y+115
line x-5,y+18,x+5,y+18
line x-5,y+18,x-10,y+32
line x-10,y+32,x+9,y+40
line x+5,y+18,x+2,y+40
line x+2,y+40,x+15,y+45
ink c2,0
circle x+7,y+40,2
circle x+15,y+43,2
endcase
case 3
ink c1,0
circle x,y,15
line x,y+15,x,y+60
line x,y+60,x-5,y+95
line x-5,y+95,x-15,y+115
line x,y+60,x+10,y+95
line x+10,y+95,x,y+115
line x-5,y+18,x+5,y+18
line x-5,y+18,x,y+40
line x,y+40,x+15,y+38
line x+5,y+18,x-6,y+35
line x-6,y+35,x+5,y+42
ink c2,0
circle x+13,y+38,2
circle x+7,y+42,2
endcase
case 4
ink c1,0
circle x,y,15
line x,y+15,x,y+60
line x,y+60,x-5,y+95
line x-5,y+95,x-15,y+115
line x,y+60,x+10,y+95
line x+10,y+95,x,y+115
line x-5,y+18,x+5,y+18
line x-5,y+18,x+5,y+23
line x+5,y+23,x+30,y+19
line x+5,y+18,x-8,y+38
line x-8,y+38,x+2,y+42
ink c2,0
circle x+28,y+19,2
circle x,y+42,2
endcase
case 5
ink c1,0
circle x,y,15
line x,y+15,x,y+60
line x,y+60,x-5,y+95
line x-5,y+95,x-15,y+115
line x,y+60,x+10,y+95
line x+10,y+95,x,y+115
line x-5,y+18,x+5,y+18
line x-5,y+18,x+5,y+21
line x+6,y+21,x+32,y+18
line x+5,y+18,x-8,y+38
line x-8,y+38,x+2,y+42
ink c2,0
circle x+32,y+19,2
circle x,y+42,2
endcase
case 6
endcase
endselect
endcase
case 4 : rem kicking right
select player(i).frame
case 1
ink c1,0
circle x,y,15
line x,y+15,x,y+60
line x,y+60,x-5,y+95
line x-5,y+95,x-10,y+115
line x,y+60,x+11,y+90
line x+11,y+90,x+6,y+114
line x-5,y+18,x+5,y+18
line x-5,y+18,x-15,y+35
line x-15,y+35,x+5,y+55
line x+5,y+18,x+8,y+45
line x+8,y+45,x+20,y+30
ink c2,0
circle x+7,y+55,2
circle x+20,y+28,2
endcase
case 2
ink c1,0
circle x,y,15
line x,y+15,x,y+60
line x,y+60,x-4,y+90
line x-4,y+90,x-7,y+115
line x,y+60,x+13,y+85
line x+13,y+85,x+10,y+110
line x-5,y+18,x+5,y+18
line x-5,y+18,x-15,y+35
line x-15,y+35,x+5,y+55
line x+5,y+18,x+8,y+45
line x+8,y+45,x+20,y+30
ink c2,0
circle x+7,y+55,2
circle x+20,y+28,2
endcase
case 3
ink c1,0
circle x,y,15
line x,y+15,x,y+60
line x,y+60,x-4,y+90
line x-4,y+90,x-7,y+115
line x,y+60,x+13,y+75
line x+13,y+75,x+16,y+85
line x-5,y+18,x+5,y+18
line x-5,y+18,x-15,y+35
line x-15,y+35,x+5,y+55
line x+5,y+18,x+8,y+45
line x+8,y+45,x+20,y+30
ink c2,0
circle x+7,y+55,2
circle x+20,y+28,2
endcase
case 4
ink c1,0
circle x,y,15
line x,y+15,x,y+60
line x,y+60,x-4,y+90
line x-4,y+90,x-7,y+115
line x,y+60,x+12,y+65
line x+12,y+65,x+30,y+45
line x-5,y+18,x+5,y+18
line x-5,y+18,x-15,y+35
line x-15,y+35,x+5,y+55
line x+5,y+18,x+8,y+45
line x+8,y+45,x+20,y+30
ink c2,0
circle x+7,y+55,2
circle x+20,y+28,2
endcase
case 5
endcase
case 6
endcase
endselect
endcase
endselect
next i
sync
endfunction
function selectchar()
print "(1) Scripoc"
print "(2) Master X"
print "(3) LionHeart"
print "(4) Sigma"
print "(5) Killer T"
set cursor 50,150
print "Select fighter ... player 1: ";
sync
input player(1).null
set cursor 50,200
print "Select fighter ... player 2: ";
sync
input player(2).null
player(1).x=256
player(1).y=200
player(1).hp=100
player(1).mp=100
player(1).action=1
player(1).frame=1
player(2).x=768
player(2).y=200
player(2).hp=100
player(2).mp=100
player(2).action=2
player(2).frame=1
for i=1 to 2
if player(i).null=1 then player(i).name="Scripoc":player(i).c1=rgb(240,240,0):player(i).c2=rgb(250,0,0)
if player(i).null=2 then player(i).name="Master X":player(i).c1=rgb(200,200,200):player(i).c2=rgb(255,255,255)
if player(i).null=3 then player(i).name="LionHeart":player(i).c1=rgb(0,0,250):player(i).c2=rgb(220,125,60)
if player(i).null=4 then player(i).name="Sigma":player(i).c1=rgb(240,0,0):player(i).c2=rgb(0,0,255)
if player(i).null=5 then player(i).name="Killer T":player(i).c1=rgb(255,255,255):player(i).c2=rgb(240,240,0)
next i
endfunction
function setup()
if check display mode(1024,768,32)=1 then set display mode 1024,768,32 else set display mode 1024,768,16
endfunction
