-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblinky.pas
124 lines (85 loc) · 2.5 KB
/
blinky.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
{ Simple Sprites Demo }
program simplespritesdemo;
var clock,key,x,direction:integer;
label GameLoop; label ExitLoop;
{$i fabgl.inc} {FabGL Pascal Library}
FUNCTION inkey : integer;
begin
if bios(1) = 255 then inkey := bios(2) else inkey :=0;
end;
{ Main Program }
begin;
{ Set Variables }
x:=0; clock:=0; direction:=0;
{ Set Resolution }
SCREEN('320x200x64'); Apply;
Cursor(0); CLS;
gotoXY(10,5);
writeln('Blinky is on the move!');
gotoXY(10,6);
writeln(' [ESC] to exit');
SPRITECOUNT(2); {Total Sprites}
SPRITEDEFRGB2(0,16,15); {#,XSize,YSize}
SPRITEDATA('0000000000000000');
SPRITEDATA('0000004444000000'); {16 Color Data}
SPRITEDATA('0000444444440000');
SPRITEDATA('0004444444444000');
SPRITEDATA('004FF4444FF44400');
SPRITEDATA('00FFFF44FFFF4400');
SPRITEDATA('00CCFF44CCFF4400');
SPRITEDATA('04CCFF44CCFF4440');
SPRITEDATA('044FF4444FF44440');
SPRITEDATA('0444444444444440');
SPRITEDATA('0444444444444440');
SPRITEDATA('0444444444444440');
SPRITEDATA('0444444444444440');
SPRITEDATA('0440444004440440');
SPRITEDATA('0400044004400040');
SPRITEDATA('$');
SPRITEDEFRGB2(1,16,15);
SPRITEDATA('0000000000000000');
SPRITEDATA('0000004440000000');
SPRITEDATA('0000444444440000');
SPRITEDATA('0004444444444000');
SPRITEDATA('00444FF4444FF400');
SPRITEDATA('0044FFFF44FFFF00');
SPRITEDATA('0044FFCC44FFCC00');
SPRITEDATA('0444FFCC44FFCC40');
SPRITEDATA('04444FF4444FF440');
SPRITEDATA('0444444444444440');
SPRITEDATA('0444444444444440');
SPRITEDATA('0444444444444440');
SPRITEDATA('0444444444444440');
SPRITEDATA('0440444004440440');
SPRITEDATA('0400044004400040');
SPRITEDATA('$');
spriteset(0,0,x,100);
spriteset(1,0,x,100);
{Main Loop}
GameLoop:
key:=inkey;
if key=27 then goto ExitLoop;
{Using SETSPRITE inside a small delay clock. }
{Prevents output commands from overunning }
{the possible input of an ESC key to exit. }
clock:=clock+1;
if clock > 2 then begin
if direction=0 then spriteset(0,1,x,100);
if direction=1 then spriteset(1,1,x,100);
if direction=0 then x:=x-1;
if direction=1 then x:=x+1;
clock:=0
end;
{Determine limits and set movement direction.}
if x > 300 then spriteset(1,0,x+1,100);
if x > 300 then direction:=0;
if x < 1 then spriteset(0,0,x-1,100);
if x < 1 then direction:=1;
goto GameLoop;
{ Reset Cursor & Screen Resolution }
ExitLoop:
cursor(1);
SCREEN('512x384x64');
Apply;
end.