This repository was archived by the owner on Sep 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathInvadersText.html
More file actions
61 lines (48 loc) · 2.69 KB
/
InvadersText.html
File metadata and controls
61 lines (48 loc) · 2.69 KB
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
<!DOCTYPE html>
<html>
<title>League Invaders - Text</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://league-central.github.io/curriculum/style/style.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<script src="https://league-central.github.io/curriculum/script/headerAndFooter.js"></script>
<body>
<div id ="wrap">
<div id ="main">
<div id = "moduleIndex">
<h1>Menu and End Game</h1>
<h2>drawing text</h2>
<br>
<p class="normal">
In order to draw text, we first have to make one or more Font objects. These will define the type, style, and size of the font used. </p>
<br>
<p class="normal">
1. In the <code>GamePanel</code> class, create a Font variable called <code>titleFont</code>.</p>
<br>
<p class="normal">
2. In the constructor, initialize the <code>titleFont</code> variable as follows. The constructor of the Font class takes three parameters. The first is a String for the type of font you want to display. For now, set it to "Arial". The second parameter is for any stylization you would like to apply to the font. For now, set it to <code>Font.PLAIN</code> . The third parameter is for the size of the font. Set it to 48 for now.</p>
<pre>
titleFont = new Font("Arial", Font.PLAIN, 48);</pre>
<br>
<p class="normal">
3. Go to the drawMenuState method and set the font for the graphics to use before drawing the menu text. Don't forget that you need to set the color of your text so that it will show up on your background color. E.g.</p>
<pre>
g.setFont(titleFont);
g.setColor(Color.CYAN);
g.drawString("text", x, y);
</pre>
<br>
<p class="normal">
4. Add text to the menu to match the League Invaders demo game. You may need to make more than one Font object to achieve this.</p>
<br>
<p class="normal">
5. Add the text for the Game Over screen in the drawEndState method (you may need a different color). You will need to change this at the end of the game when you have implemented the code that keeps a score.</p>
<h3><u>TESTING</u></h3>
<p class="normal">
6. Check the MENU window to make sure it has the correct appearance. We cannot check the END window until later.
</p>
</div></div></div>
<div id="footer">
<script>addFooter();</script>
</div>
</body></html>