Skip to content

Commit d2a6db4

Browse files
unknownunknown
unknown
authored and
unknown
committed
マップ上に同じキャラのアイテムが同時に出現しないように修正しました。
1 parent 616638d commit d2a6db4

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

score.ser

64 Bytes
Binary file not shown.

src/ggjsap2013/models/map/MapModel.java

+22-1
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,32 @@ public void createCharacterItemBlock(Stage stage, Level currentLevel)
9898
CharacterItem.TYPES itemType = null;
9999
if (typeString.equals("H")) {
100100
itemType = CharacterItem.HEROINES[RandomUtil.nextInt(CharacterItem.HEROINES.length)];
101+
102+
/* 既にマップ上に同じキャラアイテムが存在するか */
103+
boolean hasSameItem = false;
104+
for(int i=0; i<map.length; i++) {
105+
for(int j=0;j<map[0].length; j++) {
106+
Block b = map[i][j];
107+
if (b != null && b instanceof CharacterItem) {
108+
CharacterItem charItem = (CharacterItem)b;
109+
if (charItem.getType() == itemType) {
110+
hasSameItem = true;
111+
break;
112+
}
113+
}
114+
}
115+
}
116+
117+
if (hasSameItem) {
118+
itemType = CharacterItem.ANIMALS[RandomUtil.nextInt(CharacterItem.ANIMALS.length)];
119+
}
120+
101121
} else {
102-
itemType = CharacterItem.ANIMALS[RandomUtil.nextInt(CharacterItem.HEROINES.length)];
122+
itemType = CharacterItem.ANIMALS[RandomUtil.nextInt(CharacterItem.ANIMALS.length)];
103123
}
104124

105125

126+
106127
/* 隊列に既にヒロインキャラが含まれていた場合、ランダムで動物アイテムを配置しますよ */
107128
if (CharacterItem.isHeroineType(itemType)) {
108129
BodyType bodyType = CharacterItem.getBodyTypeFromItemType(itemType);

src/ggjsap2013/views/game/StageNode.java

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
package ggjsap2013.views.game;
22

3-
import ggjsap2013.Gloomy;
43
import ggjsap2013.models.Stage;
5-
6-
import java.awt.Color;
7-
84
import jp.tohhy.gamepanel.GameNode;
95
import jp.tohhy.gamepanel.graphics.NodeGraphics;
106
import jp.tohhy.gamepanel.utils.MouseInfo;

0 commit comments

Comments
 (0)