Assessment 2011 Hard

From Progzoo
Revision as of 14:51, 30 September 2011 by Andr3w (Talk | contribs) (Turpin's Crossing)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Each of these road signs is worth 20 points.

Ice

Ice!


[Font] [Default] [Show] [Resize] [History] [Profile]

Zone ENDS

You can calculate the width of the text using the stringWidth method of the FontMetrics class. You can use this figure to calculate where to place text that should be in the centre.

Notes on using the transport font. You can use the following to load and use the UK transport font:

try{
  Font f = Font.createFont(Font.TRUETYPE_FONT,
     new java.io.FileInputStream("transporth.ttf"));
  f = f.deriveFont(20.0f);
  g.setFont(f);
}catch (Exception e){
  g.drawString("Font not found",10,30);
}
Zone Ends


[Font] [Default] [Show] [Resize] [History] [Profile]

Diversion Northtown

Notice how the black border is curved inside and out.

Diversion Northtown



[Font] [Default] [Show] [Resize] [History] [Profile]

Swing Bridge

Making a wavy line is hard work. The cosine function can be used to set up the coordinate array. The drawPolyline function only works with integers which will result in a "lumpy" wave unless you "scale up".

Swing Bridge


[Font] [Default] [Show] [Resize] [History] [Profile]

Turpin's Crossing

You are not asked to do this because it is easy.

You are asked to do it because it is hard.

Turpin's Crossroads


[Font] [Default] [Show] [Resize] [History] [Profile]