忍者ブログ
To show what I have done in the works
[8] [7] [6] [5] [4] [3] [2] [1]
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

I used the Java program to design a text game, Text Fighter.

In the game, I designed  two characters, Davis and Kim.

They will be randomly to fight, if one of them the Power (Health Point / HP) is lower than zero, the game will stop and finish.

There is a example in downward.

Test for TextFighter

Download the file:
1.
Player.class
2.Player.java (update: 21-10-07)
3.
PlayerTest.class
4.PlayerTest.java
You can see the code in here.
PR

コメント
無題
Thank you very much.

However, it is a bug to write something like:

setPower( 100 + 1 );
victim.setPower ( 100 - 1 );

in the method attack because the powers will be reset to 101 and 99 respectively no matter what the original powers are. These did not happen in your trials because it is difficult to have both the players at equal power once the game has started.

The fix is to use getPower() in place of the 100.
【2007/10/20 03:15】 NAME[張真人] WEBLINK[] EDIT[]
Re:張真人
Thank you for your comment.

I have tried the method before, but when I run the program it shows wrong value of power.

I know what I did wrong at last time. Now the program goes thought the right value.
【2007/10/21 01:21】 NAME[Ash] WEBLINK[] EDIT[]


コメントフォーム
お名前
タイトル
文字色
メールアドレス
URL
コメント
パスワード
  Vodafone絵文字 i-mode絵文字 Ezweb絵文字


トラックバック
この記事にトラックバックする:


忍者ブログ [PR]
Date
03 2024/04 05
S M T W T F S
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
Freearea
New Commend
[10/21 Ash]
[10/20 張真人]
New Event
Blog Search