var X, Y : int
var X2, Y2 : int
var bloodx, bloody : int
var YesNo : string (3)
var xm, ym, button : int
const Midx := maxx div 2
var LegAngle : int
var Stop, Stop2 : boolean := false
var StopCount, StopCount2 : int := 0
var LegAngle2 : int
loop
LegAngle2 := 5
LegAngle := 10
X2 := Midx + 100
X := Midx - 10
Y2 := 50
Y := 50
Stop := false
Stop2 := false
StopCount := 0
StopCount2 := 0
var Shot1, Shot2 : boolean := false
setscreen ("graphics:max,200,position:center;center,nobuttonbar,offscreenonly,title:..." +
repeat (" ", maxcol div 2) + "SNIPER" + repeat (" ", 40))
colorback (black)
loop
cls
if Stop = false and Stop2 = false then
X := X - 1
LegAngle := LegAngle + 1
X2 := X2 + 1
LegAngle2 := LegAngle + 1
end if
if LegAngle > 10 then
LegAngle := -LegAngle
end if
if X + 20 <= -20 then
X := maxx + 20
end if
if LegAngle2 > 10 then
LegAngle2 := -LegAngle2
end if
if X2 - 20 >= maxx + 20 then
X2 := -20
end if
drawdot (X, Y, 0)
drawoval (X, Y + 50, 5, 5, 0)
drawline (X, Y + 45, X, Y + 25, 0)
drawdot (X - 2, Y + 52, 0)
drawline (X, Y + 40, X - LegAngle, Y + 20, 0)
drawline (X, Y + 40, X + LegAngle, Y + 20, 0)
drawline (X, Y + 25, X - LegAngle, Y, 0)
drawline (X, Y + 25, X + LegAngle, Y, 0)
drawfilloval (X - LegAngle + 2, Y, 2, 1, 0)
drawfilloval (X + LegAngle - 2, Y, 2, 1, 0)
drawline (1, 45, maxx, 45, 0)
drawdot (X2, Y2, 0)
drawoval (X2, Y2 + 50, 5, 5, 15)
drawdot (X2 + 2, Y2 + 52, 0)
drawline (X2, Y2 + 45, X2, Y2 + 25, 15)
drawline (X2, Y2 + 40, X2 - LegAngle2, Y2 + 20, 15)
drawline (X2, Y2 + 40, X2 + LegAngle2, Y2 + 20, 15)
drawline (X2, Y2 + 25, X2 - LegAngle2, Y2, 15)
drawline (X2, Y2 + 25, X2 + LegAngle2, Y2, 15)
drawfillbox (X2 - 7, Y2 + 54, X2 + 7, Y2 + 55, brown)
drawfillbox (X2 - 3, Y2 + 56, X2 + 3, Y2 + 64, brown)
drawfilloval (X2 - LegAngle2 + 2, Y2, 2, 1, brown)
drawfilloval (X2 + LegAngle2 - 2, Y2, 2, 1, brown)
Mouse.Where (xm, ym, button)
if xm >= X - 5 and xm <= X + 5 and ym >= Y + 45 and ym <= Y + 50 and button = 1 then
drawfilloval (xm, ym, 2, 2, 12)
Shot1 := true
elsif xm >= X2 - 5 and xm <= X2 + 5 and ym >= Y2 + 45 and ym <= Y2 + 50 and button = 1 then
Shot2 := true
elsif button = 1 then
exit
end if
if X2 + 30 = X then
Stop := true
end if
if X + 100 = X2 then
Stop2 := true
end if
if StopCount >= 100 and StopCount < 200 then
locatexy (X + 10, Y + 100)
color (0)
put "Hello "
elsif
StopCount >= 300 and StopCount <= 400 then
locatexy (X2 + 10, Y2 + 100)
put "Hi"
end if
if StopCount2 >= 100 and StopCount2 < 200 then
locatexy (X + 10, Y + 100)
color (0)
put "Bye "
elsif
StopCount2 >= 300 and StopCount2 <= 400 then
locatexy (X2 + 10, Y2 + 100)
put "See ya later"
end if
drawoval (xm, ym, 40, 20, 10)
drawline (xm + 40, ym, xm - 40, ym, 10)
drawline (xm, ym + 20, xm, ym - 20, 10)
drawfilloval (xm, ym, 2, 2, 12)
if StopCount >= 401 then
Stop := false
StopCount := 0
end if
if StopCount2 >= 401 then
Stop := false
Stop2 := false
StopCount2 := 0
end if
View.Update
delay (15)
exit when Shot1 = true or Shot2 = true
if Stop = true then
StopCount := StopCount + 1
end if
if Stop2 = true then
StopCount2 := StopCount2 + 1
end if
color (10)
end loop
if Shot1 = false and Shot2 = false then
color (10)
locate (1, 1)
put "You Missed"
sound (200, 100)
elsif Shot1 = true then
for Blood : 1 .. 50
randint (bloodx, xm - 10, xm + 10)
randint (bloody, ym - 10, ym + 10)
drawdot (bloodx, bloody, 12)
end for
drawfilloval (xm, ym, 3, 3, 12)
drawfilloval (xm, ym, 1, 1, 7)
sound (200, 100)
color (0)
locate (1, 1)
put "You shot the white guy"
elsif Shot2 = true then
drawfilloval (xm, ym, 3, 3, 12)
drawfilloval (xm, ym, 1, 1, 7)
for Blood : 1 .. 50
randint (bloodx, xm - 10, xm + 10)
randint (bloody, ym - 10, ym + 10)
drawdot (bloodx, bloody, 12)
end for
sound (200, 100)
color (15)
locate (1, 1)
put "You shot the grey guy"
end if
locate (2, 1)
put "Would You like to try again? (y/n) "
View.Update
get YesNo
exit when YesNo = "n"
end loop
|