Posted: Mon May 09, 2011 8:20 pm Post subject: my attempt at shooting
Here is what I have done to recreate shooting(not done this is just an image of shooting, I will make a game)
Turing:
setscreen("offscreenonly") var bullet :flexiblearray1.. 0ofint var direction :string:="up" var pastx, pasty :int var recoil :boolean:=false var chars :arraycharofboolean var x1, y1 :int:=100 process fire
if recoil =falsethen
pastx := x1
pasty := y1
recoil :=true if direction ="up"then for i : y1 .. upper(bullet) drawfilloval(pastx, i, 1, 1, 2) delay(3) endfor elsif direction ="right"then for i : x1 .. upper(bullet) drawfilloval(i, pasty, 1, 1, 2) delay(3) endfor elsif direction ="left"then for decreasing i : x1 .. upper(bullet) drawfilloval(i, pasty, 1, 1, 2) delay(3) endfor elsif direction ="down"then for decreasing i : y1 .. upper(bullet) drawfilloval(pastx, i, 1, 1, 2) delay(3) endfor endif
recoil :=false endif end fire
loop drawbox(0, 0, maxx, maxy, 1) Input.KeyDown(chars) if chars (KEY_UP_ARROW)then
direction :="up"
y1 +=1 elsif chars (KEY_RIGHT_ARROW)then
direction :="right"
x1 +=1 elsif chars (KEY_LEFT_ARROW)then
direction :="left"
x1 -=1 elsif chars (KEY_DOWN_ARROW)then
direction :="down"
y1 -=1 endif if y1 + 6 >= maxythen
y1 -=1 endif if y1 - 6 <= 0then
y1 +=1 endif if x1 + 6 >= maxxthen
x1 -=1 endif if x1 - 6 <= 0then
x1 +=1 endif drawfilloval(x1, y1, 5, 5, 3) if chars (' ')then if direction ="up"then for i : y1 .. maxy ifwhatdotcolor(x1, i)=1then new bullet, i
exit endif new bullet, 0 endfor elsif direction ="right"then for i : x1 .. maxx ifwhatdotcolor(i, y1)=1then new bullet, i
exit endif new bullet, 0 endfor elsif direction ="left"then for decreasing i : x1 .. 0 ifwhatdotcolor(i, y1)=1then new bullet, i
exit endif new bullet, 0 endfor elsif direction ="down"then for decreasing i : y1 .. 0 ifwhatdotcolor(x1, i)=1then new bullet, i
exit endif new bullet, 0 endfor endif fork fire
endif delay(3) View.Update cls endloop
Sponsor Sponsor
apython1992
Posted: Mon May 09, 2011 8:47 pm Post subject: RE:my attempt at shooting
Why the process and fork? It's unnecessary and hazardous. Can you think of another solution?
goroyoshi
Posted: Mon May 09, 2011 9:21 pm Post subject: RE:my attempt at shooting
for some reason processes like me and they work in this case
except for the double delay but that makes sense when you slow down to aim
here is v2 (now a game with two people)
Turing:
setscreen("offscreenonly,graphics:600;600,nobuttonbar") var bullet, bullet2 :flexiblearray1.. 0ofint var direction, direction2 :string:="up" var pastx, pasty, pastx2, pasty2 :int var recoil, recoil2 :boolean:=false var win :int:=0 var chars :arraycharofboolean var x1, y1 :int:=100 var x2, y2 :int:=399 process recharge
delay(600)
recoil :=false end recharge
process recharge2
delay(600)
recoil2 :=false end recharge2
process fire
if recoil =falsethen
pastx := x1
pasty := y1
recoil :=true fork recharge
if direction ="up"then for i : y1 .. upper(bullet) drawfilloval(pastx, i, 1, 1, red) ifwhatdotcolour(pastx, i + 2)=3then
win :=1 endif delay(1) endfor elsif direction ="right"then for i : x1 .. upper(bullet) drawfilloval(i, pasty, 1, 1, red) ifwhatdotcolour(i + 2, pasty)=3then
win :=1 endif delay(1) endfor elsif direction ="left"then for decreasing i : x1 .. upper(bullet) drawfilloval(i - 2, pasty, 1, 1, red) ifwhatdotcolour(i, pasty)=3then
win :=1 endif delay(1) endfor elsif direction ="down"then for decreasing i : y1 .. upper(bullet) drawfilloval(pastx, i, 1, 1, red) ifwhatdotcolour(pastx, i - 2)=3then
win :=1 endif delay(1) endfor endif endif end fire
process fire2
if recoil2 =falsethen
pastx2 := x2
pasty2 := y2
recoil2 :=true fork recharge2
if direction2 ="up"then for i : y2 .. upper(bullet2) drawfilloval(pastx2, i, 1, 1, red) ifwhatdotcolour(pastx2, i + 2)=2then
win :=2 endif delay(1) endfor elsif direction2 ="right"then for i : x2 .. upper(bullet2) drawfilloval(i, pasty2, 1, 1, red) ifwhatdotcolour(i + 2, pasty2)=2then
win :=2 endif delay(1) endfor elsif direction2 ="left"then for decreasing i : x2 .. upper(bullet2) drawfilloval(i, pasty2, 1, 1, red) ifwhatdotcolour(i - 2, pasty2)=2then
win :=2 endif delay(1) endfor elsif direction2 ="down"then for decreasing i : y2 .. upper(bullet2) drawfilloval(pastx2, i, 1, 1, red) ifwhatdotcolour(pastx2, i - 2)=2then
win :=2 endif delay(1) endfor endif
recoil2 :=false endif end fire2
loop drawbox(0, 0, maxx, maxy, 1) Input.KeyDown(chars) if chars (KEY_UP_ARROW)then
direction :="up"
y1 +=1 elsif chars (KEY_RIGHT_ARROW)then
direction :="right"
x1 +=1 elsif chars (KEY_LEFT_ARROW)then
direction :="left"
x1 -=1 elsif chars (KEY_DOWN_ARROW)then
direction :="down"
y1 -=1 endif if chars ('w')then
direction2 :="up"
y2 +=1 elsif chars ('d')then
direction2 :="right"
x2 +=1 elsif chars ('a')then
direction2 :="left"
x2 -=1 elsif chars ('s')then
direction2 :="down"
y2 -=1 endif if y1 + 6 >= maxythen%p1 boundaries
y1 -=1 endif if y1 - 6 <= 0then
y1 +=1 endif if x1 + 6 >= maxxthen
x1 -=1 endif if x1 - 6 <= 0then
x1 +=1 endif if y2 + 6 >= maxythen%p2 boundaries
y2 -=1 endif if y2 - 6 <= 0then
y2 +=1 endif if x2 + 6 >= maxxthen
x2 -=1 endif if x2 - 6 <= 0then
x2 +=1 endif drawfilloval(x1, y1, 5, 5, 2) drawfilloval(x2, y2, 5, 5, 3) if chars ('/')then if direction ="up"then for i : y1 .. maxy ifwhatdotcolor(x1, i)=1then new bullet, i
exit endif new bullet, 0 endfor elsif direction ="right"then for i : x1 .. maxx ifwhatdotcolor(i, y1)=1then new bullet, i
exit endif new bullet, 0 endfor elsif direction ="left"then for decreasing i : x1 .. 0 ifwhatdotcolor(i, y1)=1then new bullet, i
exit endif new bullet, 0 endfor elsif direction ="down"then for decreasing i : y1 .. 0 ifwhatdotcolor(x1, i)=1then new bullet, i
exit endif new bullet, 0 endfor endif fork fire
endif if chars (' ')then if direction2 ="up"then for i : y2 .. maxy ifwhatdotcolor(x2, i)=1then new bullet2, i
exit endif new bullet2, 0 endfor elsif direction2 ="right"then for i : x2 .. maxx ifwhatdotcolor(i, y2)=1then new bullet2, i
exit endif new bullet2, 0 endfor elsif direction2 ="left"then for decreasing i : x2 .. 0 ifwhatdotcolor(i, y2)=1then new bullet2, i
exit endif new bullet2, 0 endfor elsif direction2 ="down"then for decreasing i : y2 .. 0 ifwhatdotcolor(x2, i)=1then new bullet2, i
exit endif new bullet2, 0 endfor endif fork fire2
endif delay(3) View.Update cls exitwhen win > 0 endloop if win =1then put"Player one has won." else put"Player two has won." endif
goroyoshi
Posted: Mon May 09, 2011 10:08 pm Post subject: Re: my attempt at shooting
v3 with no glitches and bullets are fired at same rate every time
Turing:
setscreen("offscreenonly,graphics:600;600,nobuttonbar") var bullet, bullet2 :flexiblearray1.. 0ofint var direction, direction2 :string:="up" var pastx, pasty, pastx2, pasty2 :int var recoil, recoil2 :boolean:=false var win :int:=0 var chars :arraycharofboolean var x1, y1 :int:=100 var x2, y2 :int:=399 process recharge
delay(600)
recoil :=false end recharge
process recharge2
delay(600)
recoil2 :=false end recharge2
process fire
if recoil =falsethen
pastx := x1
pasty := y1
recoil :=true fork recharge
if direction ="up"then for i : y1 .. upper(bullet) drawfilloval(pastx, i, 1, 1, red) ifwhatdotcolour(pastx, i + 2)=3then
win :=1 endif delay(1) endfor elsif direction ="right"then for i : x1 .. upper(bullet) drawfilloval(i, pasty, 1, 1, red) ifwhatdotcolour(i + 2, pasty)=3then
win :=1 endif delay(1) endfor elsif direction ="left"then for decreasing i : x1 .. upper(bullet) drawfilloval(i - 2, pasty, 1, 1, red) ifwhatdotcolour(i, pasty)=3then
win :=1 endif delay(1) endfor elsif direction ="down"then for decreasing i : y1 .. upper(bullet) drawfilloval(pastx, i, 1, 1, red) ifwhatdotcolour(pastx, i - 2)=3then
win :=1 endif delay(1) endfor endif endif end fire
process fire2
if recoil2 =falsethen
pastx2 := x2
pasty2 := y2
recoil2 :=true fork recharge2
if direction2 ="up"then for i : y2 .. upper(bullet2) drawfilloval(pastx2, i, 1, 1, red) ifwhatdotcolour(pastx2, i + 2)=2then
win :=2 endif delay(1) endfor elsif direction2 ="right"then for i : x2 .. upper(bullet2) drawfilloval(i, pasty2, 1, 1, red) ifwhatdotcolour(i + 2, pasty2)=2then
win :=2 endif delay(1) endfor elsif direction2 ="left"then for decreasing i : x2 .. upper(bullet2) drawfilloval(i, pasty2, 1, 1, red) ifwhatdotcolour(i - 2, pasty2)=2then
win :=2 endif delay(1) endfor elsif direction2 ="down"then for decreasing i : y2 .. upper(bullet2) drawfilloval(pastx2, i, 1, 1, red) ifwhatdotcolour(pastx2, i - 2)=2then
win :=2 endif delay(1) endfor endif endif end fire2
loop drawbox(0, 0, maxx, maxy, 1) Input.KeyDown(chars) if chars (KEY_UP_ARROW)then
direction :="up"
y1 +=1 elsif chars (KEY_RIGHT_ARROW)then
direction :="right"
x1 +=1 elsif chars (KEY_LEFT_ARROW)then
direction :="left"
x1 -=1 elsif chars (KEY_DOWN_ARROW)then
direction :="down"
y1 -=1 endif if chars ('w')then
direction2 :="up"
y2 +=1 elsif chars ('d')then
direction2 :="right"
x2 +=1 elsif chars ('a')then
direction2 :="left"
x2 -=1 elsif chars ('s')then
direction2 :="down"
y2 -=1 endif if y1 + 6 >= maxythen%p1 boundaries
y1 -=1 endif if y1 - 6 <= 0then
y1 +=1 endif if x1 + 6 >= maxxthen
x1 -=1 endif if x1 - 6 <= 0then
x1 +=1 endif if y2 + 6 >= maxythen%p2 boundaries
y2 -=1 endif if y2 - 6 <= 0then
y2 +=1 endif if x2 + 6 >= maxxthen
x2 -=1 endif if x2 - 6 <= 0then
x2 +=1 endif drawfilloval(x1, y1, 5, 5, 2) drawfilloval(x2, y2, 5, 5, 3) if chars ('/')then if direction ="up"then for i : y1 .. maxy ifwhatdotcolor(x1, i)=1then new bullet, i
exit endif new bullet, 0 endfor elsif direction ="right"then for i : x1 .. maxx ifwhatdotcolor(i, y1)=1then new bullet, i
exit endif new bullet, 0 endfor elsif direction ="left"then for decreasing i : x1 .. 0 ifwhatdotcolor(i, y1)=1then new bullet, i
exit endif new bullet, 0 endfor elsif direction ="down"then for decreasing i : y1 .. 0 ifwhatdotcolor(x1, i)=1then new bullet, i
exit endif new bullet, 0 endfor endif fork fire
endif if chars (' ')then if direction2 ="up"then for i : y2 .. maxy ifwhatdotcolor(x2, i)=1then new bullet2, i
exit endif new bullet2, 0 endfor elsif direction2 ="right"then for i : x2 .. maxx ifwhatdotcolor(i, y2)=1then new bullet2, i
exit endif new bullet2, 0 endfor elsif direction2 ="left"then for decreasing i : x2 .. 0 ifwhatdotcolor(i, y2)=1then new bullet2, i
exit endif new bullet2, 0 endfor elsif direction2 ="down"then for decreasing i : y2 .. 0 ifwhatdotcolor(x2, i)=1then new bullet2, i
exit endif new bullet2, 0 endfor endif fork fire2
endif delay(3) View.Update cls exitwhen win > 0 endloop if win =1then put"Player one has won." else put"Player two has won." endif
apython1992
Posted: Tue May 10, 2011 7:27 am Post subject: RE:my attempt at shooting
I realize that it works, but processes are a bad way to go about something as simple as game animation. For some more insight about why they are a bad idea here, read this topic.
goroyoshi
Posted: Tue May 10, 2011 5:08 pm Post subject: RE:my attempt at shooting
I know they are bad but this case works because of the slowdown when you want to fire
klutzedufus
Posted: Tue May 17, 2011 4:45 pm Post subject: RE:my attempt at shooting
I would suggest taking the delays out of the if statements and putting one delay at the end, otherwise everything slows down if the if statement is being executed.
goroyoshi
Posted: Tue May 17, 2011 5:54 pm Post subject: RE:my attempt at shooting
it has to be in the for loop
Sponsor Sponsor
goroyoshi
Posted: Wed Jun 08, 2011 7:08 pm Post subject: RE:my attempt at shooting
Turing:
var mainWin :int:=Window.Open("nooffscreenonly,graphics:600;600,nobuttonbar,position:center;center") var bullet, bullet2 :flexiblearray1.. 0ofint var direction, direction2 :string:="up" var reply, map :string(1) var pastx, pasty, pastx2, pasty2, count, count2 :int:=1 var recoil, recoil2, flag, flag2, cap, cap2, spawn, spawn2 :boolean:=false var win :int:=0 var chars :arraycharofboolean var x1, y1 :int:=80 var x2, y2 :int:=520 process secure
if cap =falsethen
cap :=true for x :1.. 10000 delay(1)
count +=1 if x2 >= 250and x2 <= 350and y2 >= 250and y2 <= 350then
cap :=false
count :=1 exit endif if x1 < 250or x1 > 350or y1 < 250or y1 > 350then
cap :=false
count :=1 exit endif if count =10000then
win :=1 endif endfor endif end secure
process secure2
if cap2 =falsethen
cap2 :=true for x :1.. 10000 delay(1)
count2 +=1 if x1 >= 250and x1 <= 350and y1 >= 250and y1 <= 350then
cap2 :=false
count2 :=1 exit endif if x2 < 250or x2 > 350or y2 < 250or y2 > 350then
cap2 :=false
count2 :=1 exit endif if count2 =10000then
win :=2 endif endfor endif end secure2
process recharge
delay(600)
recoil :=false end recharge
process recharge2
delay(600)
recoil2 :=false end recharge2
process spawner
spawn :=true delay(1000)
spawn :=false end spawner
process spawner2
spawn2 :=true delay(1000)
spawn2 :=false end spawner2
process fire
if recoil =falsethen
pastx := x1
pasty := y1
recoil :=true fork recharge
if direction ="up"then for i : y1 .. upper(bullet) drawfilloval(pastx, i, 1, 1, red) ifwhatdotcolour(pastx, i + 2)=3then if map not= "1"and map not= "4"then
win :=1 else if flag =truethen
flag :=false endif
x2 :=520
y2 :=520 fork spawner2
endif endif delay(1) endfor elsif direction ="right"then for i : x1 .. upper(bullet) drawfilloval(i, pasty, 1, 1, red) ifwhatdotcolour(i + 2, pasty)=3then if map not= "1"and map not= "4"then
win :=1 else if flag =truethen
flag :=false endif
x2 :=520
y2 :=520 fork spawner2
endif endif delay(1) endfor elsif direction ="left"then for decreasing i : x1 .. upper(bullet) drawfilloval(i - 2, pasty, 1, 1, red) ifwhatdotcolour(i, pasty)=3then if map not= "1"and map not= "4"then
win :=1 else if flag =truethen
flag :=false endif
x2 :=520
y2 :=520 fork spawner2
endif endif delay(1) endfor elsif direction ="down"then for decreasing i : y1 .. upper(bullet) drawfilloval(pastx, i, 1, 1, red) ifwhatdotcolour(pastx, i - 2)=3then if map not= "1"and map not= "4"then
win :=1 else if flag =truethen
flag :=false endif
x2 :=520
y2 :=520 fork spawner2
endif endif delay(1) endfor endif endif end fire
process fire2
if recoil2 =falsethen
pastx2 := x2
pasty2 := y2
recoil2 :=true fork recharge2
if direction2 ="up"then for i : y2 .. upper(bullet2) drawfilloval(pastx2, i, 1, 1, red) ifwhatdotcolour(pastx2, i + 2)=2then if map not= "1"and map not= "4"then
win :=2 else if flag2 =truethen
flag2 :=false endif
x1 :=80
y1 :=80 fork spawner
endif endif delay(1) endfor elsif direction2 ="right"then for i : x2 .. upper(bullet2) drawfilloval(i, pasty2, 1, 1, red) ifwhatdotcolour(i + 2, pasty2)=2then if map not= "1"and map not= "4"then
win :=2 else if flag2 =truethen
flag2 :=false endif
x1 :=80
y1 :=80 fork spawner
endif endif delay(1) endfor elsif direction2 ="left"then for decreasing i : x2 .. upper(bullet2) drawfilloval(i, pasty2, 1, 1, red) ifwhatdotcolour(i - 2, pasty2)=2then if map not= "1"and map not= "4"then
win :=2 else if flag2 =truethen
flag2 :=false endif
x1 :=80
y1 :=80 fork spawner
endif endif delay(1) endfor elsif direction2 ="down"then for decreasing i : y2 .. upper(bullet2) drawfilloval(pastx2, i, 1, 1, red) ifwhatdotcolour(pastx2, i - 2)=2then if map not= "1"and map not= "4"then
win :=2 else if flag2 =truethen
flag2 :=false endif
x1 :=80
y1 :=80 fork spawner
endif endif delay(1) endfor endif endif end fire2
proc map1
drawbox(50, 50, 275, 275, 1) drawbox(50, 550, 275, 325, 1) drawbox(550, 50, 325, 275, 1) drawbox(550, 550, 325, 325, 1) drawfillbox(51, 51, 149, 124, yellow) drawline(150, 275, 175, 275, 0) drawline(150, 275, 150, 50, 1) drawline(175, 275, 175, 50, 1) for x :1.. 2 drawline(50, 50 + x *75, 150, 50 + x *75, 1) drawline(275, 50 + x *75, 175, 50 + x *75, 1) endfor for x :1.. 3 drawline(150, 0 + x *75, 150, 25 + x *75, 0) drawline(175, 0 + x *75, 175, 25 + x *75, 0) endfor drawline(275, 425, 275, 450, 0) drawline(275, 425, 50, 425, 1) drawline(275, 450, 50, 450, 1) for x :1.. 2 drawline(50 + x *75, 450, 50 + x *75, 550, 1) drawline(50 + x *75, 425, 50 + x *75, 325, 1) endfor for x :1.. 3 drawline(25 + x *75, 425, x *75, 425, 0) drawline(25 + x *75, 450, x *75, 450, 0) endfor drawline(425, 325, 450, 325, 0) drawline(425, 325, 425, 550, 1) drawline(450, 325, 450, 550, 1) drawfillbox(549, 549, 451, 476, black) for x :1.. 2 drawline(325, 325 + x *75, 425, 325 + x *75, 1) drawline(450, 325 + x *75, 550, 325 + x *75, 1) endfor for x :1.. 3 drawline(425, 275 + x *75, 425, 300 + x *75, 0) drawline(450, 275 + x *75, 450, 300 + x *75, 0) endfor drawline(325, 150, 325, 175, 0) drawline(325, 150, 550, 150, 1) drawline(325, 175, 550, 175, 1) for x :1.. 2 drawline(325 + x *75, 150, 325 + x *75, 50, 1) drawline(325 + x *75, 175, 325 + x *75, 275, 1) endfor for x :1.. 3 drawline(275 + x *75, 150, 300 + x *75, 150, 0) drawline(275 + x *75, 175, 300 + x *75, 175, 0) endfor end map1
proc map2
drawbox(100, 100, 500, 500, 1) drawline(275, 100, 325, 100, 0) drawline(275, 500, 325, 500, 0) drawline(100, 275, 100, 325, 0) drawline(500, 275, 500, 325, 0) drawline(200, 300, 400, 300, 1) drawline(300, 200, 300, 400, 1) end map2
proc map3
for x :1.. 9 drawline(0 + x *60, 0, 0 + x *60, 600, 1) drawline(0, 0 + x *60, 600, 0 + x *60, 1) endfor for x :0.. 9 for y :0.. 9 drawline(20 + y *60, 60 + x *60, 40 + y *60, 60 + x *60, 0) drawline(60 + x *60, 40 + y *60, 60 + x *60, 20 + y *60, 0) endfor endfor drawfillbox(181, 181, 419, 419, 0) end map3
proc map4
drawbox(250, 250, 350, 350, black) drawline(0, 100, 100, 100, 1) drawline(100, 0, 100, 80, 1) drawbox(30, 150, 130, 400, 1) drawbox(130, 0, 250, 145, 1) drawbox(570, 450, 470, 200, 1) drawbox(470, 600, 350, 455, 1) drawline(500, 600, 500, 520, 1) drawline(600, 500, 500, 500, 1) end map4
loop put"Map 1 is Office Buildings (CTF), Map 2 is Arena, Map 3 is Grids, ",skip, "Map 4 is King of the Hill." put"Which map would you like to play?"..
loop getch(map) exitwhen map ="1"or map ="2"or map ="3"or map ="4" endloop setscreen("offscreenonly") loop drawbox(0, 0, maxx, maxy, 1) if map ="1"then
map1
elsif map ="2"then
map2
elsif map ="3"then
map3
else
map4
endif Input.KeyDown(chars) if spawn =falsethen if chars (KEY_UP_ARROW)then
direction :="up"
y1 +=1 elsif chars (KEY_RIGHT_ARROW)then
direction :="right"
x1 +=1 elsif chars (KEY_LEFT_ARROW)then
direction :="left"
x1 -=1 elsif chars (KEY_DOWN_ARROW)then
direction :="down"
y1 -=1 endif endif if spawn2 =falsethen if chars ('w')then
direction2 :="up"
y2 +=1 elsif chars ('d')then
direction2 :="right"
x2 +=1 elsif chars ('a')then
direction2 :="left"
x2 -=1 elsif chars ('s')then
direction2 :="down"
y2 -=1 endif endif if y1 + 6 >= maxythen
y1 -=1 endif if y1 - 6 <= 0then
y1 +=1 endif if x1 + 6 >= maxxthen
x1 -=1 endif if x1 - 6 <= 0then
x1 +=1 endif ifwhatdotcolor(x1 + 6, y1)=1then
x1 -=1 endif ifwhatdotcolor(x1 - 6, y1)=1then
x1 +=1 endif ifwhatdotcolor(x1, y1 + 6)=1then
y1 -=1 endif ifwhatdotcolor(x1, y1 - 6)=1then
y1 +=1 endif ifwhatdotcolor(x1 + 6, y1 + 6)=1then
x1 -=1
y1 -=1 endif ifwhatdotcolor(x1 - 6, y1 + 6)=1then
x1 +=1
y1 -=1 endif ifwhatdotcolor(x1 + 6, y1 - 6)=1then
x1 -=1
y1 +=1 endif ifwhatdotcolor(x1 - 6, y1 - 6)=1then
x1 +=1
y1 -=1 endif if y2 + 6 >= maxythen
y2 -=1 endif if y2 - 6 <= 0then
y2 +=1 endif if x2 + 6 >= maxxthen
x2 -=1 endif if x2 - 6 <= 0then
x2 +=1 endif ifwhatdotcolor(x2 + 6, y2)=1then
x2 -=1 endif ifwhatdotcolor(x2 - 6, y2)=1then
x2 +=1 endif ifwhatdotcolor(x2, y2 + 6)=1then
y2 -=1 endif ifwhatdotcolor(x2, y2 - 6)=1then
y2 +=1 endif ifwhatdotcolor(x2 + 6, y2 + 6)=1then
x2 -=1
y2 -=1 endif ifwhatdotcolor(x2 - 6, y2 + 6)=1then
x2 +=1
y2 -=1 endif ifwhatdotcolor(x2 + 6, y2 - 6)=1then
x2 -=1
y2 +=1 endif ifwhatdotcolor(x2 - 6, y2 - 6)=1then
x2 +=1
y2 -=1 endif if map ="1"then if x2 >= 51and x2 <= 149and y2 >= 51and y2 <= 124then
flag :=true endif if x1 >= 451and x1 <= 599and y1 >= 476and y1 <= 599then
flag2 :=true endif endif if map ="4"then if x1 >= 250and x1 <= 350and y1 >= 250and y1 <= 350then if x2 < 250or x2 > 350or y2 < 250or y2 > 350then fork secure
drawfillbox(251, 251, 349, 349, yellow) endif endif if x2 >= 250and x2 <= 350and y2 >= 250and y2 <= 350then if x1 < 250or x1 > 350or y1 < 250or y1 > 350then fork secure2
drawfillbox(251, 251, 349, 349, black) endif endif endif drawfilloval(x1, y1, 5, 5, 2) if flag2 =truethen drawfilloval(x1, y1, 3, 3, black) endif drawfilloval(x2, y2, 5, 5, 3) if flag =truethen drawfilloval(x2, y2, 3, 3, yellow) endif if spawn =falsethen if chars ('/')then if direction ="up"then for i : y1 .. maxy ifwhatdotcolor(x1, i)=1then new bullet, i
exit endif new bullet, 0 endfor elsif direction ="right"then for i : x1 .. maxx ifwhatdotcolor(i, y1)=1then new bullet, i
exit endif new bullet, 0 endfor elsif direction ="left"then for decreasing i : x1 .. 0 ifwhatdotcolor(i, y1)=1then new bullet, i
exit endif new bullet, 0 endfor elsif direction ="down"then for decreasing i : y1 .. 0 ifwhatdotcolor(x1, i)=1then new bullet, i
exit endif new bullet, 0 endfor endif fork fire
endif endif if spawn2 =falsethen if chars (' ')then if direction2 ="up"then for i : y2 .. maxy ifwhatdotcolor(x2, i)=1then new bullet2, i
exit endif new bullet2, 0 endfor elsif direction2 ="right"then for i : x2 .. maxx ifwhatdotcolor(i, y2)=1then new bullet2, i
exit endif new bullet2, 0 endfor elsif direction2 ="left"then for decreasing i : x2 .. 0 ifwhatdotcolor(i, y2)=1then new bullet2, i
exit endif new bullet2, 0 endfor elsif direction2 ="down"then for decreasing i : y2 .. 0 ifwhatdotcolor(x2, i)=1then new bullet2, i
exit endif new bullet2, 0 endfor endif fork fire2
endif endif if flag2 =trueand flag =falseand x1 >= 51and x1 <= 149and y1 >= 51and y1 <= 124then
cap :=true endif if flag =trueand flag2 =falseand x2 >= 451and x2 <= 549and y2 >= 476and y2 <= 549then
cap2 :=true endif delay(3) View.Update cls if map not= "1"then exitwhen win > 0 else exitwhen cap =trueor cap2 =true endif endloop setscreen("nooffscreenonly") if cap =truethen
win :=1 else
win :=2 endif if win =1then put"Player one has won." else put"Player two has won." endif put"Would you like to continue (y/n) " loop getch(reply) exitwhen reply ="y"or reply ="n" endloop if reply ="y"then
x1 :=80
y1 :=80
x2 :=520
y2 :=520
flag :=false
flag2 :=false
cap :=false
cap2 :=false
win :=0 else exit endif endloop locate(17, 18) put"Created by: Bruno Maillette 2011." locate(18, 18) put"Press any key to Exit"..
getch(reply) Window.Close(mainWin)
Now exits when done, has CTF, king of the hill and deathmatch
COMMENT ON PROCESSES AND I WILL GET ANGRY, i just want an opinion on the game and suggestions on what to add
Raknarg
Posted: Wed Jun 08, 2011 8:14 pm Post subject: RE:my attempt at shooting
Found a glitch: If you run the guy perpendicular to an open line, it goes along with the line and then you can pass through the wall in either direction.
There's a simple way to fix this that'll also shorten your code. You put the blocking statements with your movement statement. Ex:
Posted: Wed Jun 08, 2011 8:17 pm Post subject: RE:my attempt at shooting
Also, although it's probably not worth mentioning, your guys cant get hit if they haven't moved. Don't know if that was on purpose.
goroyoshi
Posted: Wed Jun 08, 2011 8:26 pm Post subject: RE:my attempt at shooting
where did you notice that, i haven't seen that yet
Raknarg
Posted: Wed Jun 08, 2011 8:39 pm Post subject: RE:my attempt at shooting
Which one? Because I noticed both of those on every map.
goroyoshi
Posted: Wed Jun 08, 2011 8:43 pm Post subject: RE:my attempt at shooting
wtf, i do that all the time for testing, move one player across then shoot down
UPDATE: i just tried that out with all maps and it works, they get hit even without movement
you trolling me?
Raknarg
Posted: Wed Jun 08, 2011 9:37 pm Post subject: RE:my attempt at shooting
Why the hell would I troll you? I'm just telling you what I saw. Maybe it works most of the time, it just didn't work for me.