Continued. For the beginning, see N1.
-== TEMPLATE THOUGHTS ==-
At the dawn of video game creation, programmers
faced serious problems
buoy to place dots on the screen. They were happy
regarding the successful imitation of battle tactics and
writing a set of algorithms that control
creatures. They thought they could umutupo-
to create the mind using patterns, i.e., to describe
throwing a row of numbers along the trajectory of movement. K
for example, in the game Galaxians small kocmu-
American ships make several circles,
shoot at you for a while and come back
return to their original place.
When they perform these movements, they
just follow the commands written in advance
sleep templates.
Designing templates is easy
easy task and they found a use
in many scenarios. All this can still
it becomes much more difficult to pursue and get away with
loneliness, but only at first glance. Easier
saying:
√ We randomly select some
template;
√ Movement of creatures in each passage
cycle changes according to hanpab-
line specified in the template;
√ Move on to the next elementshab-
womb. Each template can consist of
arbitrary number of elements.
One thing is important - when the set is exhausted
commands specified by the template - go to
to another.
To demonstrate the use of templates
I wrote an analogue from PC-based C to native
spectrum-BASIC.
The enemy approaches the player, depending on
from distance, or simply being followed
blows, or chooses to move according to a pattern
well.
Listing 1 (Fly):
1 LET px=100: LET py=100: LET ex=2: LET
ey=2: LET dp=0: DIM x (3, 20): DIM y(3,
20): REM dp template execution flag
2 FOR f=1 TO 3: FOR g=1 TO 20 : READ
x(f, g): NEXT g: NEXT f
3 FOR f=1 TO 3: FOR g=1 TO 20 : READ
y(f, g): NEXT g: NEXT f
4 LET e1=ex: LET e2=ey: LET e 3=px: LET
e4=py
5 BORDER dp
9 REM Player movement
10 IF INKEY$="q" THEN LET py=py+2
11 IF INKEY$="a" THEN LET py=py-2
12 IF INKEY$="p" THEN LET px=px+2
13 IF INKEY$="o" THEN LET px=px-2
14 IF dp<>0 THEN GO TO 23: REM If you-
moving around the Template is completed, go around
Pursuit algorithm.
15 IF px>ex THEN LET ex=ex+1
16 IF pxey THEN LET ey=ey+1
18 IF py 105 RETURN
9980 REM x- and y-components of templates
9990 DATA 1, 1, 1, 1, 1, 2, 2, -1, -2,
-3 , -1, 0, 0, 1, 2, 2, -2, -2, -1, 0, 0,
0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 3, 3, 3, 3,
2, 1, -2, -2 , -1, 0, -1, -2, -3, -3, -2,
-2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1
9991 DATA 0, 0, 0, 0,-1,-1, -1, -1, -1,
0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 1, 1, 1,
1, 1 , 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 0,
0, 0, 0, 1 , 1, 1, 2, 2, -1, -1, -1, -2,
-2, -1, -1, 0, 0, 0, 1, 1, 1, 1, 1
When you run this program, you will understand
why is it called Mukha. Dot crawling
on the screen and really resembles a fly.
She approaches you and suddenly starts
fly around. This character behavior
embodied in just a few lines of prog-
frameworks using the algorithm described above
rhythm.
Continue reading in the next issue -
re.
Share your thoughts about the article