Game Programming With Code Angel 1st Edition Mark Cunningham PDF Download
Game Programming With Code Angel 1st Edition Mark Cunningham PDF Download
https://ebookmeta.com/product/game-programming-with-code-
angel-1st-edition-mark-cunningham/
https://ebookmeta.com/product/game-programming-with-
open-3d-engine-1st-edition-oleksandr-lozitskiy/
https://ebookmeta.com/product/introduction-to-digital-music-with-
python-programming-learning-music-with-code-1st-edition-horn/
https://ebookmeta.com/product/introduction-to-digital-music-with-
python-programming-learning-music-with-code-1st-edition-michael-
horn/
https://ebookmeta.com/product/machine-learning-fundamentals-1st-
edition-hui-jiang/
Miss Prim And The Duke Of Wylde Stephanie Laurens
https://ebookmeta.com/product/miss-prim-and-the-duke-of-wylde-
stephanie-laurens/
https://ebookmeta.com/product/microsoft-excel-power-pivot-power-
query-for-dummies-2nd-edition-michael-alexander/
https://ebookmeta.com/product/what-bad-girls-get-1st-edition-
emily-tilton/
https://ebookmeta.com/product/the-six-power-moves-of-chess-3rd-
edition-the-missing-key-to-finding-good-chess-moves-from-any-
position-william-g-karneges/
https://ebookmeta.com/product/bought-to-carry-his-heir-jane-
porter/
Claude Monet Vol 1 1st Edition Nathalia Brodskaïa
https://ebookmeta.com/product/claude-monet-vol-1-1st-edition-
nathalia-brodskaia/
TECHNOLOGY IN AC TION™
Game
Programming
with Code Angel
Learn how to code in Python on
Raspberry Pi or PC
—
Mark Cunningham
www.allitebooks.com
Game Programming
with Code Angel
Learn how to code in Python
on Raspberry Pi or PC
Mark Cunningham
www.allitebooks.com
Game Programming with Code Angel: Learn how to code in Python on
Raspberry Pi or PC
Mark Cunningham
Edinburgh, Scotland
www.allitebooks.com
To Mum and Dad
For recoginizing that a Space Invaders habit and a ZX81
might eventually lead somewhere in 40 years’ time…
www.allitebooks.com
Table of Contents
About the Author���������������������������������������������������������������������������������xi
About the Technical Reviewer�����������������������������������������������������������xiii
Chapter 1: Introduction������������������������������������������������������������������������1
Coding a game������������������������������������������������������������������������������������������������������3
Python and Pygame����������������������������������������������������������������������������������������������4
Choosing an IDE����������������������������������������������������������������������������������������������������4
Python IDLE�����������������������������������������������������������������������������������������������������4
Thonny�������������������������������������������������������������������������������������������������������������5
PyCharm Edu���������������������������������������������������������������������������������������������������5
Bugs and debugging���������������������������������������������������������������������������������������������5
Common mistakes������������������������������������������������������������������������������������������������6
Indentation������������������������������������������������������������������������������������������������������6
Variable and function names���������������������������������������������������������������������������7
Case�����������������������������������������������������������������������������������������������������������������7
Brackets and quotes����������������������������������������������������������������������������������������7
Missing colons�������������������������������������������������������������������������������������������������8
Comments�������������������������������������������������������������������������������������������������������������8
Time to get started…�������������������������������������������������������������������������������������������8
www.allitebooks.com
Table of Contents
vi
Table of Contents
vii
Table of Contents
viii
Table of Contents
ix
Table of Contents
Step 8: Scoreboard�������������������������������������������������������������������������������������������167
Fixed loops��������������������������������������������������������������������������������������������������������169
Display the scoreboard�������������������������������������������������������������������������������������170
Wrapping up������������������������������������������������������������������������������������������������������171
Index�������������������������������������������������������������������������������������������������173
x
About the Author
Mark Cunningham is the founder of Code Angel and a Computing
Science teacher with over 20 years experience teaching in Scotland.
Working with high school students, Mark has learned which coding
concepts new coders find difficult to understand, learn, and master. He has
recognized that students want to learn to code by writing programs which
will motivate and engage them. His work with Code Angel has allowed
him to take his teaching beyond the classroom and reach a much wider
audience online. Mark is also the co-founder of Hashtag Learning who
develop online resources for schools.
xi
About the Technical Reviewer
Massimo Nardone has more than 22 years of experiences in Security,
Web/Mobile Development, Cloud, and IT Architecture. His true IT
passions are Security and Android.
He has been programming and teaching how to program with Android,
Perl, PHP, Java, VB, Python, C/C++, and MySQL for more than 20 years.
He holds a Master of Science in Computing Science from the
University of Salerno, Italy.
He has worked as a Project Manager, Software Engineer, Research
Engineer, Chief Security Architect, Information Security Manager, PCI/
SCADA Auditor, and Senior Lead IT Security/Cloud/SCADA Architect for
many years.
His technical skills include Security, Android, Cloud, Java, MySQL,
Drupal, Cobol, Perl, Web and Mobile Development, MongoDB, D3,
Joomla, Couchbase, C/C++, WebGL, Python, Pro Rails, Django CMS, Jekyll,
Scratch, and so on.
He currently works as Chief Information Security Officer (CISO) for
Cargotec Oyj.
He worked as Visiting Lecturer and Supervisor for exercises at the
Networking Laboratory of the Helsinki University of Technology (Aalto
University). He holds four international patents (PKI, SIP, SAML, and Proxy
areas).
Massimo has reviewed more than 40 IT books for different publishing
companies, and he is the coauthor of Pro Android Games (Apress, 2015).
xiii
CHAPTER 1
Introduction
Welcome to Python game programming with Code Angel. In this book, you
will write the Python program code required to build four amazing games,
learning how to code as you go along.
The four games you will make are shown in the following.
Figure 1-1 shows the Forest Bomber game.
2
Chapter 1 Introduction
C
oding a game
Each game is built up steadily over several chapters. Take your time
working through each chapter, adding the program code as instructed.
New concepts will be explained as they are introduced.
As you finish each game, you should run your program to check that
it works as expected. If it doesn't, don't worry. It's quite common for a
program to contain errors which are known as bugs. If your program has
a bug, carefully compare your code with the code from this book and try
to spot any differences. Missing out just one single character or typing a
character in the wrong place can prevent a program from running.
Have fun playing your finished game or impress your friends by letting
them play the game that you have programmed!
3
Chapter 1 Introduction
P
ython and Pygame
In order to run any of the code in this book, you will need to install
the Python programming language on your computer. This is a fairly
straightforward process. Follow the installation instructions on the Python
web site: www.python.org.
Once you have installed Python, you need to install the Pygame library
which extends Python and provides many of the functions required to
make games. Visit the web site for information on how to download and
install Pygame: www.pygame.org.
Both Python and Pygame are open source and completely free.
C
hoosing an IDE
Now that you have installed Python and Pygame, you are ready to begin
coding. You are probably wondering where to actually type your Python code.
The best way to do this is by using an IDE. IDE stands for integrated
development environment. It's what programmers use to enter, run, and
debug their code.
There are lots of different IDEs to choose from. At Code Angel, we
recommend one of the following IDEs to get you started. They are all free
and available for Windows, MacOS, and Linux.
P
ython IDLE
Pros: Installed with Python, fine for small projects
Cons: Basic, limited debugging, not great for larger projects
Rating 3/5
4
Chapter 1 Introduction
Thonny
Pros: Easy to use
Cons: Not as polished as PyCharm
Rating 4/5
Windows, Mac, or Linux
PyCharm Edu
Pros: Works well for large projects
Cons: More complex interface and menu options, steep learning curve
Installation: Needs Pygame to be added under Settings ➤ Project
Interpreter
Rating 5/5
Once you install whichever IDE you think best meets your needs, you
are ready to start coding.
5
Chapter 1 Introduction
exactly the same as the code from the book. Also check that the lines
above and below the reported line number are correct.
A logic error is an error which causes a program to run incorrectly but
does not necessarily cause the program to crash. Because there is no error
message, logic errors can be difficult to find.
With logic errors, you need to work out where in the program code
the error might be. For example, imagine a game where the objective is
to shoot a spaceship. Each time that the player hits the spaceship, they
should have ten points added to their score. However, you find when
running the game that ten points are subtracted each time a spaceship is
hit. This would be an example of a logic error.
This logic error must have occurred when the program updated the
game score. It is likely that a minus sign has been used instead of a plus
sign, and that is what has caused the error. The game will not actually
crash, but the player will soon get fed up losing points every time they hit
a spaceship!
Common mistakes
While bugs can be caused in many different ways, there are some common
mistakes you should look out for.
Indentation
In Python, indentation levels are very important. Indentation errors can
cause a program to crash or not work correctly. Each level of indentation
should be either four spaces or a single tab.
while True:
⎵⎵⎵⎵for event in pygame.event.get():
⎵⎵⎵⎵⎵⎵⎵⎵key_pressed = pygame.key.get_pressed()
6
Chapter 1 Introduction
Make sure that you carefully check indentation levels as you enter new
lines of code.
score ✓
csore ×
plane_exploded ✓
plane exploded ×
Case
Python is case sensitive. This applies to Python commands, as well as
function and variable names.
So in a Python program, score, Score, and SCORE are three completely
different things.
7
Chapter 1 Introduction
Missing colons
if statements, for statements, def function declarations, and class
definitions all end in a colon. It’s common for beginners to miss the colon
out by mistake – if you are getting an error, make sure that the colon is not
missing.
Comments
A comment is a note or explanation included in the program code.
In Python, comments begin with the # hash symbol and will often be
displayed in a different color by the IDE.
Comments are ignored by the computer when the program is being run.
All of the programs in this book include comments to help explain what the
program code is doing. These comments don’t affect the program and so do
not actually have to be entered, but it is good practice to include them.
8
CHAPTER 2
G
etting started
We have an idea for a game, Forest Bomber. In Forest Bomber, an airplane
is running out of fuel and has to land safely at the bottom of the screen.
However, there are trees in the forest which will cause the plane to explode
if it crashes into one. So the pilot of the plane – our player – has to try and
bomb the trees to clear a landing strip.
OK, so we have an idea for a game, and it seems simple enough. That’s
a good start. Now what?
Before we even begin writing any of the Forest Bomber code, we need
to design the game in more detail by taking the idea and breaking it down
into smaller steps, covered here and in Chapters 3 to 5 as follows:
I’ve split the steps over four chapters so we could gradually build up
the game. The first two steps might seem a little odd, but the remaining
seven steps should make some sense.
By the end of step 4, we will have designed and coded the layout for the
first level of Forest Bomber.
Let’s begin by sketching out how the game screen will look (Figure 2-1).
The plane should start in the top left-hand area of the screen, and the forest,
which the player must clear in order to land, will run along the bottom of
the screen. As this will be the first level, we will start with four trees in the
forest, but the number of trees will increase in each level making the game
progressively more difficult.
10
Chapter 2 Forest Bomber part 1: A first level
11
Chapter 2 Forest Bomber part 1: A first level
We won’t worry too much about the code at this stage, but if you want
to know more, the following explains what it does:
• Lines 1–3 are called comments. They are ignored by
the computer.
• Lines 5–8 tell the computer that we are going to use
some additional Python code which has to be imported.
• Lines 11–15 are some of the colors we will be using later
in the program.
• Lines 18–32 set up some values which will be used
throughout the program. For example, SCREEN_
WIDTH and SCREEN_HEIGHT will be used to draw the
actual game screen at 640 × 480 pixels, TREE_SPACING
will be used to keep a 40-pixel space between each of
the trees, and PLANE_START_Y will be used to start the
plane 54 pixels down from the top of the screen.
12
Chapter 2 Forest Bomber part 1: A first level
Again, enter the lines of code shown in code listing 2 in Figure 2-3.
S
core and lives
We will begin by gaining an understanding of variables. A variable stores a
piece of information or data to be used in a program. Think of a variable as
being like a box. Each variable must have its own unique name.
13
Chapter 2 Forest Bomber part 1: A first level
We will also need to keep track of the game level. Again, we use a
variable, but this time we will call it level and initialize it with 1, because
the game will begin at level 1 (Figure 2-5).
14
Chapter 2 Forest Bomber part 1: A first level
Variables can store different types of data. Our score and level variables
are both integers. An integer is a whole number which can be positive,
negative, or zero.
Enter the code to initialize all of the game variables, as shown in code
listing 3 in Figure 2-6.
15
Chapter 2 Forest Bomber part 1: A first level
Key learning A variable is like a box which can store some data or
information. Each variable has its own unique name and is initialized
as follows:
score = 0
lives = 1
Figures 2-7 to 2-10 show how the four forests are stored as lists and
how each list is then mapped to a tree drawn on the screen. We will learn
later in this chapter how we actually draw the trees.
16
Chapter 2 Forest Bomber part 1: A first level
Notice that as we move from forest 1 through to forest 4, there are more
trees. This is so that each level is harder than the one before. If you wish,
you can customize Forest Bomber by changing the combination of ‘T’s and
‘-’s in the list to change the formation of trees in a level (although probably
best not to do that just yet).
17
Chapter 2 Forest Bomber part 1: A first level
Notice that line 94 and lines 102–105 are indented (which means
they are spaced in from the left of the page). Also notice that line 97 has
a double indent, and lines 98–99 have three levels of indentation. Python
is very specific about each level of indentation. Each level of indentation
should be exactly four spaces (or one tab).
Let’s take a closer look at line 102.
This is the line of code which draws our game background. It uses
the blit command to display the background image in the top left-hand
corner of the game window. The background image itself is 640 × 480
pixels which is exactly the same size as the Forest Bomber window, so it
fits in place perfectly.
Pygame uses a coordinate system to draw graphics on screen, and the
point (0,0) is in the upper left-hand corner as can be seen in Figure 2-12.
18
Chapter 2 Forest Bomber part 1: A first level
There are a couple of other things to note about the way in which the
background image is displayed by line 102:
Now it’s time to test our program. Run Forest Bomber, and if you have
entered the code correctly, the background image should be displayed.
If you get an error, carefully check that all code has been entered correctly.
Even the slightest mistake will cause the program to not run.
19
Chapter 2 Forest Bomber part 1: A first level
Some lines of code listing 5 in Figure 2-13 are quite complicated, and
so the techniques used will be picked up later in the book.
For now, we will concentrate on lines 106–108 because they actually
draw the trees in our forest.
20
Chapter 2 Forest Bomber part 1: A first level
When column is 0:
tree.x = FIRST_TREE + column ∗ TREE_SPACING
= 140 + 0 ∗ 40
= 140
When column is 1:
tree.x = FIRST_TREE + column ∗ TREE_SPACING
= 140 + 1 ∗ 40
= 180
21
Chapter 2 Forest Bomber part 1: A first level
When column is 2:
tree.x = FIRST_TREE + column ∗ TREE_SPACING
= 140 + 2 ∗ 40
= 220
And so on. This is how we work out the x coordinate of each of the
12 trees.
Notice the use of the double equals (==) in line 107. In Python, we use ==
to check if two things are equal.
Line 107 doesn’t actually draw anything though; it is only making the
decision. If the forest_item is equal to ‘T’, then line 108 will be executed,
and line 108 is the line which draws the tree on the screen.
Notice that line 108 is indented. If the forest_item is a ‘T’, then all
indented lines directly below the line will be executed. In this case, the only
indented line is 108, so that will be executed if the forest_item is a ‘T’.
22
Chapter 2 Forest Bomber part 1: A first level
Line 108 uses the blit command to draw a tree_image onto the
game_screen at coordinates (tree.x,tree.y). But where do all of these
commands and values come from?
Let’s ignore lines 109–110. They will display the image of a tree on fire if
it has been hit by a bomb. As we have not written the code to drop a bomb
yet, these lines won’t actually do anything.
We can summarize lines 105–108 as follows:
Run the program. The four trees of Forest Bomber level 1 should be
displayed along the bottom of the game window.
23
Chapter 2 Forest Bomber part 1: A first level
Double equals (==) are used to check if two things are equal.
Summary
Phew! No one said learning to code would be easy. We have covered a lot
of complex programming in this first chapter because we prefer to dive
right in. Don’t worry if it all seems difficult to understand. It is, but it will get
easier, and we will revisit many of these topics as we work through the book.
So far, we have written lots of lines of code, and all we have to show for
it is our game background and some trees. The Forest Bomber game will
begin to take a bit more shape in the next chapter.
24
CHAPTER 3
Let’s take a closer look at lines 113 and 114 in Figure 3-2.
Figure 3-2. Forest Bomber code listing lines 113 and 114
We can see another if statement has been used here, so we know that
the program code is making a decision. It is checking to see if plane_
exploded is False. If we look all the way back to line 63, we can see that
plane_exploded is a variable and it is initialized to False.
What is False? In programming, there is a variable type known as a
Boolean, and it can have one of only two possible values: True or False.
Boolean variables are useful in game programming, because they can only
be one or the other. There is no in-between. They can only be either True
or False. Later in the program, we will set the value of the plane_exploded
Boolean variable to True when our plane crashes into a tree. But for now,
it’s False.
Given that the value of plane_exploded is False (at least for now), then
line 114 will execute. Line 114 uses the blit command to draw the plane
image at coordinates (plane.x,plane.y).
26
Chapter 3 Forest Bomber part 2: Is it a bird…?
Key learning A Boolean variable can store one of two values: True
or False.
27
Chapter 3 Forest Bomber part 2: Is it a bird…?
28
Chapter 3 Forest Bomber part 2: Is it a bird…?
Figure 3-5. Forest Bomber code listing lines 122 and 123
Line 122 redraws the screen, while line 123 determines how many
times the screen should be redrawn in one second, in this case 30.
So our program now draws the plane, moves it 5 pixels right, redraws
the plane, moves it another 5 pixels right, and so on, creating the illusion of
the plane moving.
Test this by running the program.
Fantastic, right? Except for one thing. Our plane flies off the end of the
screen never to be seen again, and that won’t make for much of a game!
Add the code to fly the plane down the screen shown in code listing 8,
Figure 3-6.
29
Chapter 3 Forest Bomber part 2: Is it a bird…?
Run the program. Now the plane should fly to the right edge of the
screen and then drop down by 100 pixels beginning again on the left-hand
side, except now it flies all the way to the bottom of the screen and then
disappears. We will fix this in a later chapter.
Now we are going to make a couple of minor changes to the code that
flies our plane and which will be useful later.
First, adapt line 102 so that it reads as in Figure 3-7.
Figure 3-8. Forest Bomber code listing line 102 with if statement
The purpose of this line is to make sure we only move the plane if
30
Chapter 3 Forest Bomber part 2: Is it a bird…?
The code should now look like code listing 9 in Figure 3-9. One very
important thing to note – because we added an if statement at line 102,
lines 103, 105, 106, and 107 have all had one extra indentation.
31
CHAPTER 4
34
Another Random Scribd Document
with Unrelated Content
has already spread like wildfire throughout the nation, and kindled
its heart into a fine warlike glow.
BANQUET IN THE SCHLOSS.
DETAILS OF PREPARATION.
THE KNIGHTS OF
MALTA AT AMBULANCE
WORK.
SKIRMISH AT ALEXANDROVO.
The crowd had already begun to thin when the news passed
round that the Ministers were in conclave at the Elysée. I acted
immediately on the first hint I received, and with great difficulty
made my way across the Place. I found myself almost at once wedged
in anew, this time in a streaming current which set steadily towards
the Elysée. The crowd grew vaster every moment, for by this time all
Paris seemed to have been drawn to that quarter of the town. For a
long time there was silence, or what seemed like it after the torrent of
noise which had roared so long in all ears, but at last the babble of
excited tongues began again, and was intermixed with occasional
cries of impatience. These grew in a steady crescendo, until no single
voice was audible. But before things reached that point I had heard a
hundred excited conjectures as to the course which would be adopted
by England at this crisis. By seven o’clock the patience of the mob
was quite outworn. The building, so far as could be seen from the
outside, was in complete darkness, and the rumour of the meeting of
the Ministers seemed likely to be practically denied. At length,
however, a sudden swell in the storm of sound greeted the
appearance of light at three windows, and certain ill-defined
shadows were seen moving on the blinds. One profile was distinct
and stationary for a moment, and there was a roar of ‘Ribot!’ A
minute later the blind of the centre window was drawn up, the
window itself was thrown open, and the figure of M. Ribot, Minister
of Foreign Affairs, was seen. This apparition was the signal for a new
outburst in which only the name of the President of the Republic
could be distinguished. The air rang with shouts of ‘Carnot! Carnot!’
and M. Ribot having braved this incredible tempest for a few seconds
only, bowed and retired. A minute later the President himself
appeared. From where I stood his features were invisible, but his
attitude was erect, and he stretched out his right hand with an
impressive gesture to command silence. It was some time before this
injunction was obeyed, but when he was allowed to speak his voice
was firm and unusually clear. His words were few and to the point.
‘Citizens! Germany has declared war upon the ally of France. Those
gentlemen whom you have appointed as the guardians of the
national honour have debated the serious intelligence which has to-
day awakened the heart of Paris. It is my duty to tell you that there is
no dissentient voice amongst them. France will fulfil her pledges!’ At
this point M. Carnot was interrupted by a unanimous outburst of
applause, which made speech impossible for a space of at least five
minutes. Again and again, when it seemed about to quiet down, it
was taken up from distant quarters, and came rolling along like a
wave, again to subside and again to be renewed. When order was
once more restored the President continued: ‘France speaks to-night,
and demands of her neighbour that the menace against her ally shall
be withdrawn. She couples with that a demand for the surrender of
those provinces which were torn from her twenty years ago!’
There was at this more cheering, and yet more. The President
retired, and a great deluge of rain which had been threatening to fall
all day speedily cleared the streets. The latest and most important of
the day’s events is yet hardly an hour old, but we seem now to be
living in a city of the dumb. Everybody is hoarse with four hours’
almost continuous shouting, but the popular excitement is as great as
ever.
The house of M. Ferry has been guarded by the military, and
only the entente cordiale existing between the troops and the
populace has saved it from attack. At the moment of writing the
Boulevards are again crowded. The reply of Germany is, of course, a
foregone conclusion, but it is awaited with intense eagerness.
DECLARATION OF WAR BY FRANCE.
For this morning the Emperor had ordered a review of all the
troops, amounting to about 60,000 men concentrated hereabouts—
the scene of the parade being a long sweep of meadow-land, not
unlike the Champ de Mars at Paris, on the right bank of the Vistula.
His Majesty and his Staff took their stand on a convenient knoll
commanding all the ground, and scarcely had the serried battalions
of the 3d Corps, with their bristling bayonets glittering in the bright
sun, begun to stride along in all their martial and magnificent array,
when the march past was interrupted by a most dramatic and
thrilling incident.
I was standing on the outside fringe of the brilliant circle of His
Majesty’s suite, quietly chatting to Dr. von Leuthold, the Emperor’s
body physician, when suddenly we saw an orderly officer dash up to
his Majesty and deliver a message, which we could discern from the
colour of the envelope to be a telegram. The Emperor tore it open,
glanced through the contents, then looked up, and let his eye wander
all round the circle of his suite, as if to note the impression produced
upon their minds by the news which His Majesty felt had already
been intuitively divined by those about him. ‘Ja, meine Herren,’ he at
last said; ‘it is just as we all expected. This is a telegram from General
von Caprivi; France has declared war against us’ (Frankreich hat
Uns den Krieg erklärt.) There was a moment’s pause, each man
looking at his neighbour to study the effect of this terrible
announcement, and then all eyes were again turned on the Emperor,
who looked a shade paler than before, but not a whit less calm and
resolute.
‘Gentlemen,’ he said at last, ‘this is a serious moment for us all,
but the news dismays just as little as it surprises us. Yet I must now
leave you, for the danger to the Fatherland is much greater on its
western than on its eastern frontier; and where the danger to the
Fatherland is greatest, there also must Germany’s Kaiser be.
‘Meine Herren, my place as Commander-in-Chief of our armies
here will now be taken by that tried and gallant soldier, my dear
friend and brother, the King of Saxony, who will, I am sure, bring
honour and victory to our arms. One foe at a time is quite enough,
and the sooner we can help our allies to dispose of their invader, the
sooner shall we be able to concentrate all our forces and inflict a
crushing blow on our hereditary enemy (Erbfeind), who has again, in
the most wanton manner, broken loose against us.
‘Gentlemen, this is no time for words, when the call to action is
tingling through all our veins, so I will only invoke the blessing of
God upon the course of our arms in this quarter, and hasten myself
to where the peril of our Fatherland is sorest. Adieu, and may each
and all of us do his duty throughout the coming period of grievous
trial and tribulation!’
So saying, the Emperor put spurs to his steed and, accompanied
only by his immediate suite, galloped off back to Thorn, receiving as
he went three enthusiastic ‘hochs.’
Just as I am closing this despatch information reaches us from
Berlin of a naval engagement in the Baltic between our fleet and
some Russian ships; but you, in London, will probably hear all the
details before they reach us here.
With the German Fleet in the Baltic.
We have been favoured with the following letter, under date
April 30, from Rear-Admiral Philip Colomb, who has been an eye-
witness of the naval operations in the Baltic:—
I was at Kiel with my yacht when the news of the attempt on
Prince Ferdinand’s life reached us. The successive telegrams and
published news created the greatest excitement among all classes,
but especially amongst those connected with the navy.
Simultaneously with the news that Russia had crossed the Austrian
frontier, several German cruisers went to sea, and in a day or two a
regular fleet began to assemble in the port. I don’t understand
German, but my wife does, and she told me whenever we met an
eager crowd discussing, that it was all about whether the fleet would
not be kept to defend the place, and the danger of an attack by the
Russian Fleet if the German Fleet did not remain.
I thought I had better get out of it, as if such an attack were
made it might be awkward for me. I think my wife was so excited
about it that she wanted to stay where we were and see it all; but I
thought we might see all there was to be seen in greater safety from
the seaside. And then from the conversation of some German naval
officers which my wife overheard, I gathered that the navy, at least,
believe that it would try to carry war into the enemy’s country. There
were, however, great discussions about some German coast defence
vessels that had not coal supply enough to go up the Baltic, and great
arguments as to what ships would go and what would stay. As every
day more heavy ships arrived and stayed, while only small ones came
and went, I began to think that after all it was most likely that the
Germans would not stay quiet to let the Russians ravage their coasts.
Then, by the time that nine or ten large turret-ships and others,
besides several smaller ones, had assembled, I understood that the
German armies were about attacking Russia by way of Königsberg,
as well as to the south. I thereupon made sure that the German fleet
would go up in support, even if they were not ready to do more.
So the end of it was that I waited till ten big ships and five or six
smaller ones got under way, and then I did ditto, and steamed out
with them. I was afraid I might be left behind, as my coal supply did
not allow me to go at any speed; but I found the Germans, after
putting their big ships into two lines a good distance apart, with
some of the smaller ones close at hand on each side, and two or three
others a long way in front, steamed quite slowly along, not more than
five or six knots. I went inshore of them, and kept them in sight a
couple of miles off.
We passed close to Rügen Island the afternoon succeeding our
departure, and the south end of Bornholm in the night. I made out
that we were steering straight, for Libau, which is about 450 miles
from Kiel. We scarcely had seen anything in the shape of a ship
except a couple of homeward-bound English trading steamers; but
on the second morning at daybreak I noticed all the German ships
had been stoking up, and were making an immense amount of
smoke. There was a good deal of signalling going on between the
German flagships—there were two of these yesterday, one at the head
of each line—and one or two of the cruisers, which sped away nearly
out of sight, and then came slowly back, signalling as they came. The
same sort of thing went on on the third morning, when we had got
beyond Dantzig, with the difference that two German cruisers were
seen steaming up, one from the southward, and one from the south-
westward. The fleet stopped, and a boat from each of these went to
the flagship and returned, after which there was more signalling, and
a boat from every ship went on board the flagship. I suppose the
other Admiral and the captains were in them, but I was too far off to
make certain.
After a couple of hours we all went on again slowly as before, but
electric and other lights were flashing about all night, so that we were
very excited, and made sure that something was in the wind. As a
consequence, long before daylight on the fourth morning we were on
deck looking out in all directions, and with a good head of steam so
as to get out of the way in case of accidents. Sure enough at daybreak
there was a great bank of smoke to the northward, and presently I
could make out a mast or two sticking up. The two German cruisers,
which were five or six miles in front, at once became very busy with
their signals, and soon afterwards the whole fleet formed into a
single line and turned to the westward, not steaming any faster, but
making such clouds of black smoke that they almost hid themselves
from me. It did not seem that the Russian Fleet—I was not sure
whether it was or not—was closing much, but one or two ships
appeared to draw more in front as if to close the two German
cruisers. Presently the other cruisers that had kept closer to the fleet
also drew out in front, but none of them seemed more inclined to
close the strangers than the strangers were to close them.
I could not make it out at all. I had always understood that in a
modern naval battle, everybody would immediately run at everybody
else, and this looked so little like the sort of thing that I was inclined
to think that what I saw was only an advance guard of the Russian
Fleet. Yet it looked too large a mass for that, and my doubts were
presently set at rest.
Signals were made to one of the German cruisers that had come
to us the day before, and she presently turned and slowly steamed to
the southward. She passed us so very close that I took heart of grace
to call out—
‘Is that the Russian Fleet?’
And the answer came back—
‘Oh! ye-es, zat is ze Russians—ve sall fight zem! So!’ and the
steamer went on her way.
I began to have some sort of an idea that, perhaps, neither fleet
was able to make out the force of the other, and was, therefore, not in
a hurry to bring it to action. And this might easily be so. Though the
sky was clear overhead and the water quite smooth, it was misty
round the horizon, and so far as the Russian Fleet was concerned, it
seemed to me very likely that even the advanced German cruisers
were not able to discover more than I could, between the mist and
the smoke.
But as I puzzled myself over this, I also thought that, perhaps, as
the main attack of Germany was going on by land, it might be her
game merely to watch the Russian Fleet. For if the Germans were
badly beaten at sea, Russia might be left free to land and cut their
communications. I had never thought of this kind of thing before,
and I quite woke up with a new sort of idea, for I saw quite well that
the Russian Fleet could not do anything unless they first thoroughly
beat the Germans.
Engagement off Dantzig—Sinking of a
Russian Torpedo-Boat.
I was so keen on my new ideas that I wanted to know more
about it, and so steamed well to the N.E. to see what the Russian
Fleet was like. Just as I did so, I saw a very small Russian steaming
away to the south-eastward as if to get the look at the German Fleet
which I was going to get at the Russian. She was stoking up
tremendously, and evidently going at great speed. Two of the
German cruisers in front immediately turned to the eastward to cut
her off, but the plucky little Russian did not seem to mind; they
closed one another very rapidly, and some puffs of smoke, followed
by distant bangs, showed a little game of long balls. The Russian had
evidently much greater speed than the others, and was drawing them
astern, but quite away from her own fleet or supports of any kind. All
of a sudden I saw she was blowing off steam furiously, and that her
speed had slackened, if not dropped altogether. She began to fire
more rapidly, and so did the Germans. All three were hidden by the
cloud of smoke they raised. My engineer was frightfully excited; he
said, ‘It was one of them new boilers a-priming,’ and that it was all
up with the Russian. Sure enough it was, for all three ships presently
came out of the smoke, the little Russian with the German flag flying
over her own.
THE NAVAL BATTLE OFF DANTZIG—
THE SINKING OF A RUSSIAN
TORPEDO BOAT AND RESCUE OF THE
CREW BY AN ENGLISH YACHT.
I had got far enough now to see that the Russian Fleet was much
more numerous than the German, but I could only make out six or
seven really big ships. But there were a crowd of small ones, and
behind, eight or nine little things like those we had seen taking the
Excellent’s men for training. I thought it might be dangerous to get
mixed up with such a crowd, so I returned to the southward and
eastward of the German Fleet. I had noticed that the Russians were
steering slowly parallel to the position of the Germans, and night
closed, leaving all things in this position. Both sides never left off
flashing their electric lights up into the sky and all over the sea, and it
really seemed to me as if they must all be a good deal confused by
such things.
So matters went on till eleven o’clock, when I made my wife go
below, while I lay down for a sleep on deck. I was awoke at one
o’clock by such a row as never was, the whole German Fleet was a
blaze and a roar of artillery. I supposed, of course, a Russian
torpedo-boat attack, but it was impossible to tell what had happened,
—all one knew was that an attack of some kind had been made. After
a very few minutes the fire began to slacken, and some of it I noticed,
with an unpleasant sensation, was coming my way. But that, too,
soon came to an end. My wife was at that moment beside me again,
and she suddenly cried out, ‘Hark! what’s that?’ I could hear a
rushing and a panting sound drawing close to us, and then the ball of
white foam that I had seen one night from a torpedo boat. The
panting suddenly stopped, and the rushing became fainter and
fainter until out of the dark came a torpedo-boat evidently making
for the yacht, but very slowly. Just as she was coming alongside there
was a sort of wild cry, and I saw she had suddenly gone to the
bottom. Our little boat was down in an instant, and I got hold of
somebody floating at once, while the men helped in two Russian
sailors. I found I had hold of a Russian officer, but he was evidently
unable to help himself. I could not get him in but we drew him
alongside and the men carried him up. I then saw that the poor chap
was badly wounded in the shoulder. No one on board could speak
Russian, but we laid him down on the deck, and my wife threw
herself down beside him with her scissors and began to cut away his
dress, while she cried to her maid to bring her water and linen. It was
of no use, however. The poor fellow was quite unconscious and
bleeding to death. It was all over in ten minutes, and we could do
nothing but reverently commit the body to the deep. Our other two
Russians were unwounded, but could not make us understand
anything. We put them next day into an English vessel bound to
Revel.
London, May 3.