📄 bigmsg.java
字号:
import java.awt.*;
class bigMsg
{
// Always point to correct page to draw on
private Graphics paper;
private Image gfx;
String msg1;
String msg2;
String msg3;
String msg4;
String msg5;
public bigMsg(Graphics gr, Image im)
{
this.paper=gr;
this.gfx=im;
this.msg1="";
this.msg2="";
this.msg3="";
this.msg4="";
this.msg5="";
}
// Draw image on screen,
// we pass the msg number and the xoffset and yoffset of current image
public void doMsg(int a, int x, int y)
{
// Msg5 can be ENTER, or press Y or N
msg5="[press ENTER to continue]";
switch (a)
{
case 1:
msg1="You'll need to keep your food";
msg2="levels up if you're going to ";
msg3="go wandering around all day, ";
msg4="or your health will suffer. ";
break;
case 2:
msg1="Did you know that those wizards";
msg2="collect plants and things,";
msg3="put them into a magic cauldron";
msg4="and create spells?";
break;
case 3:
msg1="Did you know that you can press";
msg2="TAB to change your selected item?";
msg3="And press 'd' to drop it? Or";
msg4="press SPACE to 'use' it?";
break;
case 4:
msg1="I heard that the cauldron exists";
msg2="in several places at once, don't";
msg3="ask me how though - it's magic!";
break;
case 5:
msg1="Did you know that there are";
msg2="scrolls lying around the place";
msg3="with spell instructions on";
msg4="them?";
break;
case 6:
msg1="I know a fellow that tried to";
msg2="just put any old things into the";
msg3="cauldron and ended off summoning";
msg4="up death himself!";
break;
case 7:
msg1="I heard that with spells you";
msg2="can destroy the evil creatures";
msg3="that curse this land, and each";
msg4="creature has a special spell.";
break;
case 8:
msg1="I heard that you can find";
msg2="spells to make you healthy,";
msg3="feed you, transform things and";
msg4="even vanish!";
break;
case 9:
msg1="When you create a spell, you";
msg2="can pick it up and use it by";
msg3="pressing SPACE. It'll be cast";
msg4="in the direction you face.";
break;
case 10:
msg1="I heard of a spell once to feed";
msg2="a man until he's fit to burst -";
msg3="Poppy, Rowan and Datura I think";
msg4="it was.";
break;
case 11:
msg1="You know why the land is so";
msg2="evil? It's because the queen";
msg3="of the faery folk has been";
msg4="captured by an evil wizard.";
break;
case 12:
msg1="I heard that the evil wizard";
msg2="lives in the southwest of the land,";
msg3="and that a river leads the";
msg4="way there.";
break;
case 13:
msg1="A spell I heard of once was Datura,";
msg2="Slippery Elm and Bones. Good";
msg3="against anything except bats,";
msg4="so I believe.";
break;
case 14:
// Information #
msg1="I once heard that wizards of old";
msg2="could disappear and appear";
msg3="somewhere else with ease?";
msg4="Must be a special spell eh?";
break;
case 15:
// Information #
msg1="The Voidum spell connects the";
msg2="magical stones together, and ";
msg3="the plants for the spell always";
msg4="grow nearby.";
break;
// Scrolls
case 70:
msg1="'Sorbum Granus'";
msg2="Take Henbane &";
msg3="add Slippery Elm";
msg4="";
break;
case 71:
msg1="'Treorbum Tanis'";
msg2="Take Henbane &";
msg3="add Poppy &";
msg4="add Slippery Elm";
break;
case 72:
msg1="'Fugit Vim'";
msg2="Take Fly Agaric &";
msg3="add Henbane";
msg4="";
break;
case 73:
msg1="'Caldus Divum'";
msg2="Take Slippery Elm &";
msg3="add Mandrake &";
msg4="add Poppy";
break;
case 74:
msg1="'Raniam Vim'";
msg2="Take Datura &";
msg3="add Fly Agaric &";
msg4="add Belladona";
break;
case 75:
msg1="'Beezaltium'";
msg2="Take Belladona &";
msg3="add Bones &";
msg4="add Rowan";
break;
case 76:
msg1="'Ticum Deum'";
msg2="Take Bones &";
msg3="add Rowan &";
msg4="add Poppy";
break;
case 77:
msg1="'Popus Lupis'";
msg2="Poppy & Mandrake &";
msg3="add Slippery Elm &";
msg4="add Henbane";
break;
case 78:
msg1="'Natum Tan'";
msg2="Take Mandrake &";
msg3="add Henbane &";
msg4="add Belladona";
break;
case 79:
msg1="'Frenis Vim'";
msg2="Take Fly Agaric &";
msg3="add Belladona &";
msg4="add Bones";
break;
case 80:
msg1="'Voidum'";
msg2="Take Rowan &";
msg3="add Belladona &";
msg4="Datura & Poppy";
break;
case 81:
msg1="'Asi Tacil'";
msg2="Take Henbane &";
msg3="add Mandrake &";
msg4="add Psylocybin";
break;
case 82:
msg1="'Fugor Arbum'";
msg2="Take Psylocybin &";
msg3="add Datura &";
msg4="add Mandrake";
break;
case 83:
msg1="'Ad Argum'";
msg2="Take Psylocybin &";
msg3="add Fly Agaric &";
msg4="add Bones";
break;
case 84:
msg1="'Transgildor'";
msg2="Take Datura &";
msg3="add Slippery Elm &";
msg4="add Belladona";
break;
// Public messages
case 100:
msg1="Mostly, monsters hurt you and";
msg2="take health away. If your ";
msg3="health reaches 0, you will ";
msg4="die. Check your health below.";
break;
case 101:
msg1="Collect gold by moving into";
msg2="it. See how much gold you";
msg3="have below. Gold is useful";
msg4="for buying things.";
break;
case 102:
msg1="Eat food by moving into it.";
msg2="See how much food you have";
msg3="in the panel below.";
msg4="";
break;
case 103:
msg1="Collect items by moving into";
msg2="them - they will appear in the";
msg3="panel below. You can use the";
msg4="items later.";
break;
case 104:
msg1="The cauldron. Someone else ";
msg2="can tell you about the ";
msg3="cauldron. Try talking to the ";
msg4="wandering man.";
break;
case 105:
msg1="Open chests by moving into ";
msg2="them. Inside each chest is an ";
msg3="unknown item - they can be good ";
msg4="and bad.";
break;
case 106:
msg1="This gives you extra health.";
msg2="Check your health in the panel";
msg3="below. If your health reaches";
msg4="0, you will die.";
break;
case 107:
msg1="Hey! You don't have enough";
msg2="gold - come back and see me ";
msg3="when you have some more!";
msg4="";
break;
case 108:
msg1="You can open a door with a key.";
msg2="Select the key using TAB, and";
msg3="then walk into the door.";
msg4="";
break;
case 109:
msg1="Scrolls contain 'recipies' for";
msg2="spells. Select a scroll and ";
msg3="press SPACE to read it.";
msg4="Note the order of the spell!";
break;
case 110:
msg1="Magic spells can be 'cast' by";
msg2="selecting them with TAB, then";
msg3="facing left or right and ";
msg4="pressing SPACE.";
break;
case 111:
msg1="Some walls are not what they";
msg2="seem to be, and will vanish";
msg3="when touched. ";
msg4="";
break;
// Note, messages value over 200 are info worth -200 coins
default:
msg1="Want to buy some information?";
msg2="It will cost you only "+(a-200);
msg3="gold coins.";
msg4="";
msg5="[Press 'Y' or 'N']";
break;
}
showMsg(x, y);
}
// Draw correct message on screen in right place
private void showMsg(int x, int y)
{
int topBox;
int bottomBox;
int boxLeft;
int boxRight;
int midPoint;
int middle;
boxLeft=30;
boxRight=175;
middle=100;
if (y>110)
{
topBox=30;
bottomBox=70;
midPoint=bottomBox;
}
else
{
topBox=130;
bottomBox=70;
midPoint=topBox;
}
paper.setColor(Color.gray);
paper.fillRoundRect(boxLeft,topBox,boxRight,bottomBox, 12, 12);
// Only draw little arrow if co-ords are passed in call to routine
// not passing (passing 0 & 0) causes no arrow.
if (x>0)
{
int xPoints[]=new int[3];
int yPoints[]=new int[3];
xPoints[0]=middle-5;
yPoints[0]=midPoint;
xPoints[1]=middle+5;
yPoints[1]=midPoint;
xPoints[2]=x+10;
yPoints[2]=y+10;
paper.fillPolygon(xPoints, yPoints, 3);
}
paper.setColor(Color.white);
paper.drawString(msg1,45,topBox+15);
paper.drawString(msg2,45,topBox+25);
paper.drawString(msg3,45,topBox+35);
paper.drawString(msg4,45,topBox+45);
paper.setColor(Color.black);
paper.drawString(msg5,45,topBox+60);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -