procedure fade
View.Set ("offscreenonly,nobuttonbar,title:TGiC - By: Wolf_Destiny,graphics:400,400,position:center,center")
var font : int := Font.New ("Courier New:12")
var line1 : string := " T.G.i.C. "
var line2 : string := "By: Wolf_Destiny"
var line3 : string := " }-Remake-{ "
var line4 : string := " V:0.0.4:Alpha "
for a : 1..length (line1)
Font.Draw (line1 (1..a),120,round (maxy/2),font,black)
View.Update
delay (100)
end for
for a : 1..length (line2)
Font.Draw (line2 (1..a),120,round (maxy/2)-20,font,black)
View.Update
delay (100)
end for
for a : 1..length (line3)
Font.Draw (line3 (1..a),120,round (maxy/2)-40,font,black)
View.Update
delay (100)
end for
for a : 1..length (line4)
Font.Draw (line4 (1..a),120,round (maxy/2)-80,font,black)
View.Update
delay (100)
end for
delay (1000)
for decreasing a : 31..16
drawfillbox (0,0,maxx,maxy,a)
Font.Draw (line1,120,round (maxy/2),font,black)
Font.Draw (line2,120,round (maxy/2)-20,font,black)
Font.Draw (line3,120,round (maxy/2)-40,font,black)
View.Update
delay (100)
end for
line1 := " Get Ready! "
for a : 1..length (line1)
Font.Draw (line1 (1..a),120,round (maxy/2),font,white)
View.Update
delay (100)
end for
delay (1000)
line2 := "3...2...1..."
for a : 1..length (line2)
Font.Draw (line2 (1..a),120,round (maxy/2)-20,font,white)
View.Update
delay (250)
end for
end fade
fade
View.Set ("offscreenonly,nobuttonbar,title:TGiC - By: Wolf_Destiny,graphics:400,max,position:center,center")
var Exit : boolean := false
procedure End_Game
Exit := true
end End_Game
var Upper : int := 300
var Lower : int := 100
var chars : array char of boolean
var Score : real := 0
var arrows : int := 25
var wall : int := 50
var size : int := 25
var minincr : int := 5
var maxincr : int := 25
var p : array 1.. arrows of record
_hit : boolean
_x : int
_y : real
_yvel : real
_dir : int
end record
procedure create (i : int, New : boolean)
p (i)._hit := false
p (i)._x := round (Rand.Int (wall,maxx-wall-size)/size)
p (i)._y := maxy+Rand.Int (100,1000)
if not New then
p (i)._yvel := p (i)._yvel + Rand.Int (minincr,maxincr)/100
else
p (i)._yvel := Rand.Int (1,5)/10
end if
p (i)._dir := Rand.Int (1,4)
end create
for a : 1..arrows
create (a,true)
end for
procedure draw_arrow (i : int, highlight : boolean)
drawfillbox (p (i)._x*size-size,round (p (i)._y),
p (i)._x*size-1,round (p (i)._y)+size,p (i)._dir)
var ac : int := p (i)._dir + 8
if highlight then
ac := 0
end if
if p (i)._dir = 1 or p (i)._dir = 3 then
Draw.ThickLine (round (p (i)._x*size - size/2),round (p (i)._y + 4),
round (p (i)._x*size - size/2),round (p (i)._y + size - 4), 3, ac)
else
Draw.ThickLine (round (p (i)._x*size - size + 4),round (p (i)._y + size/2),
round (p (i)._x * size - 4),round (p (i)._y + size/2),3,ac)
end if
case p(i)._dir of
label 1:
Draw.ThickLine (round (p (i)._x*size - size+4),round (p (i)._y + size/2),
round (p (i)._x*size - size/2),round (p (i)._y + size - 4), 3, ac)
Draw.ThickLine (round (p (i)._x*size - 4),round (p (i)._y + size/2),
round (p (i)._x*size - size/2),round (p (i)._y + size - 4), 3, ac)
label 2:
Draw.ThickLine (round (p (i)._x*size - size/2),round (p (i)._y + size-4),
round (p (i)._x * size - size + 4),round (p (i)._y + size/2),3,ac)
Draw.ThickLine (round (p (i)._x*size - size/2),round (p (i)._y + 4),
round (p (i)._x * size - size + 4),round (p (i)._y + size/2),3,ac)
label 3:
Draw.ThickLine (round (p (i)._x*size - size+4),round (p (i)._y + size/2),
round (p (i)._x*size - size/2),round (p (i)._y + 4), 3, ac)
Draw.ThickLine (round (p (i)._x*size - 4),round (p (i)._y + size/2),
round (p (i)._x*size - size/2),round (p (i)._y + 4), 3, ac)
label 4:
Draw.ThickLine (round (p (i)._x*size - size/2),round (p (i)._y + size-4),
round (p (i)._x * size - 4),round (p (i)._y + size/2),3,ac)
Draw.ThickLine (round (p (i)._x*size - size/2),round (p (i)._y + 4),
round (p (i)._x * size - 4),round (p (i)._y + size/2),3,ac)
label :
end case
end draw_arrow
var Reset : array 1..4 of boolean := init (true,true,true,true,)
var Key_Hit : array 1..4 of boolean := init (false,false,false,false,)
var Keys : array 1..4 of char := init (
KEY_UP_ARROW,KEY_LEFT_ARROW,KEY_DOWN_ARROW,KEY_RIGHT_ARROW,)
procedure all_keys
for a : 1..4
exit when Exit
if ~chars (Keys (a)) then
Reset (a) := true
Key_Hit (a) := false
end if
exit when Exit
end for
end all_keys
procedure check_keys (i : int)
for a : 1..4
exit when Exit
if chars (Keys (a)) and Reset (a) and p (i)._dir = a then
Key_Hit (a) := true
Reset (a) := false
p (i)._hit := true
exit
end if
exit when Exit
end for
end check_keys
procedure varify
for a : 1..4
exit when Exit
if chars (Keys (a)) and ~Key_Hit (a) then
End_Game
end if
exit when Exit
end for
end varify
procedure score (y : real)
Score += (((Upper - Lower)/2)-abs(((Upper+Lower)/2)-y))*2
end score
var Lowest : array 1..4 of record
_y : real
_i : int
end record
Lowest (1)._y := 9999
Lowest (2)._y := 9999
Lowest (3)._y := 9999
Lowest (4)._y := 9999
procedure move_arrow (i : int)
if p (i)._hit then
score (p (i)._y + size/2)
create (i,false)
else
p (i)._y -= p (i)._yvel
if p (i)._y < -size-5 then
create (i,false)
End_Game
elsif p (i)._y + size >= Lower and p (i)._y <= Upper then
draw_arrow (i,true)
/*check_keys (i)*/
if p (i)._y < Lowest (p (i)._dir)._y then
Lowest (p (i)._dir)._y := p (i)._y
Lowest (p (i)._dir)._i := i
end if
else
draw_arrow (i,false)
end if
end if
end move_arrow
procedure update
Input.KeyDown (chars)
all_keys
for a : 1..arrows
move_arrow (a)
end for
for a : 1..4
if Lowest (a)._y not= 9999 then
check_keys (Lowest (a)._i)
Lowest (a)._y := 9999
end if
end for
varify
drawline (0,Upper,maxx,Upper,2)
drawline (0,round ((Upper+Lower)/2),maxx,round ((Upper+Lower)/2),1)
drawline (0,Lower,maxx,Lower,2)
end update
loop
exit when Exit
update
locate (1,1)
put "Score: ", round (Score)
View.Update
Time.DelaySinceLast (5)
exit when Exit
cls
end loop |