colourback (black)
colour (black)
cls
setscreen ("graphics : 600 ; 300")
var Ax, Ay, Astep, radius, Vx, Vy, By, score : int
var key, wep : string (1)
key := ""
wep := ""
radius := 5
Vx := 5
Vy := 5
By := Vy
Ax := 5
Ay := 388
Astep := 5
score := 0
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%Moster
%%%%%%%%%%%%%%%%%%%%%%%%%%
loop
color(yellow)
locate(5,30)
put "Score : " , score
color(black)
%%%Vertico%%%
drawfilloval (Vx, Vy, radius, radius, blue)
%%%Moster%%%
drawfilloval (Ax, Ay, radius+10, radius+10, white)
delay (10)
%%%Vertico%%%
drawfilloval (Vx, Vy, radius, radius, black)
%%%Moster%%%
drawfilloval (Ax, Ay, radius+10, radius+10, black)
%%%Aliens movment. back and foreth at the top of screen
Ax := Ax + Astep
if Ax > 630 - radius then
Astep := -Astep
elsif Ax <= 2 then
Astep := 2
end if
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%Vertico%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%Moving the character
if hasch then
getch (key)
if key = "a" or key = "A" then
Vx := Vx - 10
elsif key = "d" or key = "D" then
Vx := Vx + 10
elsif key = "w" or key = "W" then
Vy := Vy + 10
elsif key = "s" or key = "S" then
Vy := Vy - 10
%%%if z or Z is pushed the wepon is activated. by := Vy makes the wepon apear above the
%%%character. So werever the character is. the wepon will show up there.
elsif key = "z" or key = "Z" then
By := Vy
loop
%%%the alien can move when attacking. (more of a challenge)
Ax := Ax + Astep
if Ax > 630 - radius then
Astep := -Astep
elsif Ax <= 2 then
Astep := 2
end if
%%%When in the wepon loop the man can move and move the wepon
if hasch then
getch (key)
if key = "a" or key = "A" then
Vx := Vx - 10
elsif key = "d" or key = "D" then
Vx := Vx + 10
elsif key = "w" or key = "W" then
Vy := Vy + 10
elsif key = "s" or key = "S" then
Vy := Vy - 10
elsif key = "z" or key = "Z" then
end if
end if
%%%Vertico%%%
drawfilloval (Vx, Vy, radius, radius, blue)
%%%Moster%%%
drawfilloval (Ax, Ay, radius+10, radius+10, white)
%%%wepon%%%
drawfilloval (Vx, By, radius, radius, brightgreen)
delay (10)
%%%wepon%%%
drawfilloval (Vx, By, radius, radius, black)
%%%Vertico%%%
drawfilloval (Vx, Vy, radius, radius, black)
%%%Moster%%%
drawfilloval (Ax, Ay, radius+10, radius+10, black)
%%%exit the loop when the wepon gets off the screen
exit when By > 600
By := By + 5
if whatdotcolor (Vx, By) = white then
score := score + 1
end if
end loop
end if
if Vx <= 1 - radius then
Vx := 1 + radius
elsif Vx >= 630 then
Vx := 630 + radius
end if
if Vy <= 1 - radius then
Vy := 1 + radius
elsif Vy >= 390 then
Vy := 390 + radius
end if
end if
end loop |