Compare commits
No commits in common. 'master' and 'dropbox-merge' have entirely different histories.
master
...
dropbox-me
@ -1,11 +1,10 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<classpath> |
||||
<classpathentry kind="src" path="src"/> |
||||
<classpathentry kind="src" path="assets"/> |
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> |
||||
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx/1.9.6/47d1e9b890e364ec28f128e9bb3b9a12a94c164/gdx-1.9.6.jar" sourcepath="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx/1.9.6/7d903ecd6b0df2ec334814b8e70618e4c93fd37c/gdx-1.9.6-sources.jar"/> |
||||
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-box2d/1.9.6/c249ef4060a4fada952f278455c8f7b9cba3c18a/gdx-box2d-1.9.6.jar" sourcepath="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-box2d/1.9.6/584f96799f8fedc8e6bb87eef1e261f0e7f92900/gdx-box2d-1.9.6-sources.jar"/> |
||||
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-controllers/1.9.6/ea1fd4884be631d9b7cd0f496b1ab39e31eb434b/gdx-controllers-1.9.6.jar" sourcepath="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-controllers/1.9.6/a730ab024c77f376b24e635f1d82e7d69fc5c648/gdx-controllers-1.9.6-sources.jar"/> |
||||
<classpathentry kind="lib" path="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-freetype/1.9.6/69187cc3c8062f191df435b43671b0e5ffcbf353/gdx-freetype-1.9.6.jar" sourcepath="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-freetype/1.9.6/4b5600df790e2798b21d6e5decdf752698c05013/gdx-freetype-1.9.6-sources.jar"/> |
||||
<classpathentry kind="output" path="bin"/> |
||||
<classpathentry path="bin" kind="output"/> |
||||
<classpathentry path="src" kind="src"/> |
||||
<classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6/" kind="con"/> |
||||
<classpathentry path="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx/1.9.6/47d1e9b890e364ec28f128e9bb3b9a12a94c164/gdx-1.9.6.jar" kind="lib" sourcepath="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx/1.9.6/7d903ecd6b0df2ec334814b8e70618e4c93fd37c/gdx-1.9.6-sources.jar"/> |
||||
<classpathentry path="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-box2d/1.9.6/c249ef4060a4fada952f278455c8f7b9cba3c18a/gdx-box2d-1.9.6.jar" kind="lib" sourcepath="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-box2d/1.9.6/584f96799f8fedc8e6bb87eef1e261f0e7f92900/gdx-box2d-1.9.6-sources.jar"/> |
||||
<classpathentry path="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-controllers/1.9.6/ea1fd4884be631d9b7cd0f496b1ab39e31eb434b/gdx-controllers-1.9.6.jar" kind="lib" sourcepath="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-controllers/1.9.6/a730ab024c77f376b24e635f1d82e7d69fc5c648/gdx-controllers-1.9.6-sources.jar"/> |
||||
<classpathentry path="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-freetype/1.9.6/69187cc3c8062f191df435b43671b0e5ffcbf353/gdx-freetype-1.9.6.jar" kind="lib" sourcepath="C:/Users/Joshua Sigona/.gradle/caches/modules-2/files-2.1/com.badlogicgames.gdx/gdx-freetype/1.9.6/4b5600df790e2798b21d6e5decdf752698c05013/gdx-freetype-1.9.6-sources.jar"/> |
||||
</classpath> |
||||
|
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 498 B |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 602 B |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 499 B |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 713 B |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 563 B |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 543 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 259 B |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 572 B |
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 711 B |
Before Width: | Height: | Size: 727 B |
Before Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 741 B |
@ -1,4 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<tileset name="wiremantiles" tilewidth="16" tileheight="16" spacing="1" margin="1" tilecount="66" columns="11"> |
||||
<image source="wiremantiles.png" width="188" height="103"/> |
||||
</tileset> |
@ -1,4 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<tileset name="wiremantiles" tilewidth="16" tileheight="16" spacing="1" margin="1" tilecount="66" columns="11"> |
||||
<image source="D:/Downloads/MegaMon/MegaMon/GRAPHICS/tilesets/wiremantiles.png" width="188" height="103"/> |
||||
</tileset> |
Before Width: | Height: | Size: 4.1 KiB |
@ -0,0 +1,48 @@ |
||||
package sig.megamon; |
||||
|
||||
import com.badlogic.gdx.Gdx; |
||||
import com.badlogic.gdx.graphics.Color; |
||||
import com.badlogic.gdx.graphics.Texture; |
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont; |
||||
import com.badlogic.gdx.graphics.g2d.GlyphLayout; |
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch; |
||||
import com.badlogic.gdx.utils.Align; |
||||
|
||||
import sig.megamon.utils.DrawUtils; |
||||
|
||||
public class DialogBox { |
||||
static Texture dialog_background = new Texture("dialog.png"); |
||||
static Texture dialog_box = new Texture("dialog_box.png"); |
||||
static BitmapFont messageboxfont = new BitmapFont(Gdx.files.internal("fonts/messageboxfont.fnt")); |
||||
String messageBody = ""; |
||||
String displayedMessage = ""; |
||||
int cursor=0; |
||||
int message_split_marker=0; |
||||
GlyphLayout layout; |
||||
|
||||
public DialogBox(String messageBody) { |
||||
this.messageBody=messageBody; |
||||
} |
||||
|
||||
public void run() { |
||||
//TODO accept keyboard inputs for the dialog box.
|
||||
/*if (layout!=null) { |
||||
if (layout.height<64 && cursor<messageBody.length()) { |
||||
cursor++; |
||||
} |
||||
}*/ |
||||
} |
||||
|
||||
public void draw(SpriteBatch batch) { |
||||
DrawUtils.drawTextureWithColor(batch, dialog_background, (Megamon.WINDOW_WIDTH-dialog_background.getWidth())/2,0,new Color(0.5f,1f,0.5f,1f)); |
||||
DrawUtils.drawTextureWithColor(batch, dialog_box, (Megamon.WINDOW_WIDTH-dialog_box.getWidth())/2,0,new Color(0.5f,1f,0.5f,1f)); |
||||
//System.out.println(dialog_box.getTextureData().getWidth());
|
||||
layout = messageboxfont.draw(batch, "Can we display\nNewline characters?", (Megamon.WINDOW_WIDTH-dialog_box.getWidth())/2+96, dialog_box.getHeight()-24, 0, 30, 420, Align.left, true); |
||||
if (layout.height<64) { |
||||
//Check if the next set of text with a space is not going to maximize the window.
|
||||
cursor++; |
||||
//layout.setTe
|
||||
} |
||||
//Megamon.font.draw(batch, messageBody, (Megamon.WINDOW_WIDTH-dialog_box.getWidth())/2-dialog_box.getWidth()/2, dialog_box.getHeight()+, start, end, targetWidth, halign, wrap);
|
||||
} |
||||
} |
@ -1,188 +0,0 @@ |
||||
package sig.megamon; |
||||
|
||||
import java.lang.reflect.Field; |
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.LinkedList; |
||||
import java.util.List; |
||||
|
||||
import sig.megamon.creature.CreatureLore; |
||||
import sig.megamon.creature.CreatureMove; |
||||
import sig.megamon.creature.CreatureMoveLinker; |
||||
import sig.megamon.creature.CreatureType; |
||||
import sig.megamon.creature.Evolution; |
||||
import sig.megamon.creature.ExperienceRate; |
||||
import sig.megamon.creature.SpriteCollection; |
||||
|
||||
public class MegamonCreature { |
||||
final SpriteCollection sprites; |
||||
final String name; |
||||
final CreatureLore bio; |
||||
final CreatureType type1; |
||||
final CreatureType type2; |
||||
final int hp; |
||||
final int atk; |
||||
final int def; |
||||
final int spd; |
||||
final int spc; |
||||
final int catch_rate; |
||||
final int base_exp; |
||||
final ExperienceRate exp_rate; |
||||
final List<CreatureMoveLinker> moveset; |
||||
List<Evolution> evolution_rules; |
||||
boolean seenByPlayer=false; |
||||
boolean caughtByPlayer=false; |
||||
|
||||
public MegamonCreature(String mini_icon, String sprite, String back_sprite, |
||||
String name, String bio, int size, float weight, CreatureType type1, |
||||
int base_hp, int base_atk, int base_def, int base_spc, int base_spd, |
||||
int catch_rate, int base_exp, ExperienceRate exp_rate, |
||||
CreatureMoveLinker...moveset) { |
||||
this(mini_icon,sprite,back_sprite,name,bio,size, weight,type1,CreatureType.NONE,base_hp,base_atk,base_def,base_spc,base_spd,catch_rate,base_exp,exp_rate,new ArrayList<Evolution>(),moveset); |
||||
} |
||||
|
||||
public MegamonCreature(String mini_icon, String sprite, String back_sprite, |
||||
String name, String bio, int size, float weight, CreatureType type1, |
||||
int base_hp, int base_atk, int base_def, int base_spc, int base_spd, |
||||
int catch_rate, int base_exp, ExperienceRate exp_rate, |
||||
List<Evolution> evolution_rules, |
||||
CreatureMoveLinker...moveset) { |
||||
this(mini_icon,sprite,back_sprite,name,bio,size, weight,type1,CreatureType.NONE,base_hp,base_atk,base_def,base_spc,base_spd,catch_rate,base_exp,exp_rate,evolution_rules,moveset); |
||||
} |
||||
|
||||
public MegamonCreature(String mini_icon, String sprite, String back_sprite, |
||||
String name, String bio, int size, float weight, CreatureType type1, |
||||
CreatureType type2, int base_hp, int base_atk, int base_def, int base_spc, int base_spd, |
||||
int catch_rate, int base_exp, ExperienceRate exp_rate, |
||||
CreatureMoveLinker...moveset) { |
||||
this(mini_icon,sprite,back_sprite,name,bio,size, weight,type1,type2,base_hp,base_atk,base_def,base_spc,base_spd,catch_rate,base_exp,exp_rate,new ArrayList<Evolution>(),moveset); |
||||
} |
||||
|
||||
public MegamonCreature(String mini_icon, String sprite, String back_sprite, |
||||
String name, String bio, int size, float weight, CreatureType type1, |
||||
CreatureType type2, |
||||
int base_hp, int base_atk, int base_def, int base_spc, int base_spd, |
||||
int catch_rate, int base_exp, ExperienceRate exp_rate, |
||||
List<Evolution> evolution_rules, |
||||
CreatureMoveLinker...moveset) { |
||||
this.sprites = new SpriteCollection(mini_icon,sprite,back_sprite); |
||||
this.name = name; |
||||
this.bio = new CreatureLore(bio,size,weight); |
||||
this.type1 = type1; |
||||
this.type2 = type2; |
||||
this.hp = base_hp; |
||||
this.atk = base_atk; |
||||
this.def = base_def; |
||||
this.spd = base_spd; |
||||
this.spc = base_spc; |
||||
this.catch_rate=catch_rate; |
||||
this.base_exp=base_exp; |
||||
this.exp_rate = exp_rate; |
||||
this.moveset = new LinkedList(Arrays.asList(moveset)); |
||||
this.evolution_rules=evolution_rules; |
||||
} |
||||
|
||||
public void setSeen(boolean seenByPlayer) { |
||||
this.seenByPlayer=seenByPlayer; |
||||
} |
||||
|
||||
public void setCaught(boolean caughtByPlayer) { |
||||
this.caughtByPlayer=caughtByPlayer; |
||||
} |
||||
|
||||
public SpriteCollection getSprites() { |
||||
return sprites; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public CreatureLore getBio() { |
||||
return bio; |
||||
} |
||||
|
||||
public CreatureType getType1() { |
||||
return type1; |
||||
} |
||||
|
||||
public CreatureType getType2() { |
||||
return type2; |
||||
} |
||||
|
||||
public int getHP() { |
||||
return hp; |
||||
} |
||||
|
||||
public int getATK() { |
||||
return atk; |
||||
} |
||||
|
||||
public int getDEF() { |
||||
return def; |
||||
} |
||||
|
||||
public int getSPD() { |
||||
return spd; |
||||
} |
||||
|
||||
public int getSPC() { |
||||
return spc; |
||||
} |
||||
|
||||
public int getCatchRate() { |
||||
return catch_rate; |
||||
} |
||||
|
||||
public int getBaseEXP() { |
||||
return base_exp; |
||||
} |
||||
|
||||
public ExperienceRate getEXPRate() { |
||||
return exp_rate; |
||||
} |
||||
|
||||
public List<CreatureMoveLinker> getMoveset() { |
||||
return moveset; |
||||
} |
||||
|
||||
public boolean isSeenByPlayer() { |
||||
return seenByPlayer; |
||||
} |
||||
public boolean isCaughtByPlayer() { |
||||
return caughtByPlayer; |
||||
} |
||||
|
||||
public List<Evolution> getEvolutionRules() { |
||||
return evolution_rules; |
||||
} |
||||
|
||||
public void setEvolutionRules(List<Evolution> rules) { |
||||
this.evolution_rules = rules; |
||||
} |
||||
|
||||
public String toString() { |
||||
StringBuilder sb = new StringBuilder(this.getClass().getSimpleName()+"("); |
||||
boolean first=true; |
||||
for (Field f : this.getClass().getDeclaredFields()) { |
||||
try { |
||||
if (!first) { |
||||
sb.append(","); |
||||
} else { |
||||
first=false; |
||||
} |
||||
sb.append(f.getName()+"="+this.getClass().getDeclaredField(f.getName()).get(this)); |
||||
} catch (IllegalArgumentException e) { |
||||
e.printStackTrace(); |
||||
} catch (IllegalAccessException e) { |
||||
e.printStackTrace(); |
||||
} catch (NoSuchFieldException e) { |
||||
e.printStackTrace(); |
||||
} catch (SecurityException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
sb.append(")"); |
||||
return sb.toString(); |
||||
} |
||||
} |
@ -1,391 +0,0 @@ |
||||
package sig.megamon; |
||||
|
||||
import java.lang.reflect.Field; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
import sig.megamon.creature.CreatureMove; |
||||
import sig.megamon.creature.NonVolatileStatus; |
||||
import sig.megamon.creature.VolatileStatus; |
||||
|
||||
public class MegamonPet { |
||||
MegamonCreature creature; |
||||
NonVolatileStatus status; |
||||
VolatileStatus battlestatus; |
||||
Integer atk_modifier; |
||||
Integer def_modifier; |
||||
Integer spd_modifier; |
||||
Integer spc_modifier; |
||||
Integer eva_modifier; |
||||
Integer acc_modifier; |
||||
Integer atk_iv; |
||||
Integer def_iv; |
||||
Integer spd_iv; |
||||
Integer spc_iv; |
||||
Integer atk_ev; |
||||
Integer def_ev; |
||||
Integer spd_ev; |
||||
Integer spc_ev; |
||||
Integer hp_ev; |
||||
Integer hp; |
||||
Integer maxhp; |
||||
Integer atk; |
||||
Integer def; |
||||
Integer spd; |
||||
Integer spc; |
||||
String nickname; |
||||
Integer original_trainer; |
||||
String original_trainer_name; |
||||
Integer level; |
||||
Integer hp_iv; |
||||
List<CreatureMove> moveset = new ArrayList<CreatureMove>(); |
||||
|
||||
public MegamonPet(String nickname, MegamonCreature creature_type, Integer level) { |
||||
this(nickname,creature_type,level,Megamon.mainP.trainer_id,Megamon.mainP.name); |
||||
} |
||||
|
||||
public MegamonPet(String nickname, MegamonCreature creature_type, Integer level, |
||||
Integer original_trainer, String original_trainer_name) { |
||||
this(nickname,creature_type,level,original_trainer,original_trainer_name, new ArrayList<CreatureMove>(), |
||||
new Integer[]{}, new Integer[]{}); |
||||
} |
||||
|
||||
public MegamonPet(String nickname, MegamonCreature creature_type, Integer level, |
||||
Integer original_trainer, String original_trainer_name, List<CreatureMove> moveset) { |
||||
this(nickname,creature_type,level,original_trainer,original_trainer_name, moveset, |
||||
new Integer[]{}, new Integer[]{}); |
||||
} |
||||
|
||||
public MegamonPet(String nickname, MegamonCreature creature_type, Integer level, |
||||
Integer original_trainer, String original_trainer_name, List<CreatureMove> moveset, |
||||
Integer[] stats_collection, Integer...IV_EV_Collection) { |
||||
this.creature = creature_type; |
||||
if (nickname.length()>0) { |
||||
this.nickname = nickname; |
||||
} else { |
||||
this.nickname = creature_type.name; |
||||
} |
||||
this.level = level; |
||||
this.original_trainer = original_trainer; |
||||
this.original_trainer_name = original_trainer_name; |
||||
InitializeStats(stats_collection,IV_EV_Collection); |
||||
LearnDefaultMoves(); |
||||
} |
||||
|
||||
private void LearnDefaultMoves() { |
||||
// TODO Auto-generated method stub
|
||||
} |
||||
|
||||
private void InitializeStats(Integer[] stats_collection, Integer[] IV_EV_Collection) { |
||||
/*if (stats_collection.length<6) { |
||||
//System.out.println("WARNING! Malformed stats array! Will fill in with defaults.");
|
||||
} |
||||
if (IV_EV_Collection.length<9) { |
||||
//System.out.println("WARNING! Malformed IV_EV array! Will fill in with defaults.");
|
||||
}*/ |
||||
|
||||
int i=0; |
||||
atk_iv = UseStatOrDefault(IV_EV_Collection,i++,(int)(Math.random()*16)); |
||||
def_iv = UseStatOrDefault(IV_EV_Collection,i++,(int)(Math.random()*16)); |
||||
spd_iv = UseStatOrDefault(IV_EV_Collection,i++,(int)(Math.random()*16)); |
||||
spc_iv = UseStatOrDefault(IV_EV_Collection,i++,(int)(Math.random()*16)); |
||||
hp_iv = CalculateHPIV(); |
||||
atk_ev = UseStatOrDefault(IV_EV_Collection,i++,0); |
||||
def_ev = UseStatOrDefault(IV_EV_Collection,i++,0); |
||||
spd_ev = UseStatOrDefault(IV_EV_Collection,i++,0); |
||||
spc_ev = UseStatOrDefault(IV_EV_Collection,i++,0); |
||||
hp_ev = UseStatOrDefault(IV_EV_Collection,i++,0); |
||||
i=0; |
||||
hp = UseStatOrDefault(stats_collection,i++,CalculateHealth(level)); |
||||
maxhp = UseStatOrDefault(stats_collection,i++,CalculateHealth(level)); |
||||
atk = UseStatOrDefault(stats_collection,i++,CalculateStat(level,creature.atk,atk_iv,atk_ev)); |
||||
def = UseStatOrDefault(stats_collection,i++,CalculateStat(level,creature.def,def_iv,def_ev)); |
||||
spd = UseStatOrDefault(stats_collection,i++,CalculateStat(level,creature.spd,spd_iv,spd_ev)); |
||||
spc = UseStatOrDefault(stats_collection,i++,CalculateStat(level,creature.spc,spc_iv,spc_ev)); |
||||
} |
||||
|
||||
private boolean isOdd(Integer val) { |
||||
return val % 2 == 0; |
||||
} |
||||
|
||||
private Integer CalculateHPIV() { |
||||
int lsb_total = ((isOdd(atk_iv))?8:0)+ |
||||
((isOdd(def_iv))?4:0)+ |
||||
((isOdd(spd_iv))?2:0)+ |
||||
((isOdd(spc_iv))?1:0); |
||||
return lsb_total; |
||||
} |
||||
|
||||
private Integer UseStatOrDefault(Integer[] stat_array, int index, int default_value) { |
||||
if (stat_array.length>index) { |
||||
return stat_array[index]; |
||||
} else { |
||||
return default_value; |
||||
} |
||||
} |
||||
|
||||
private int CalculateHealth(Integer lv) { |
||||
return (int)(((((creature.hp+hp_iv)*2)+(Math.sqrt(hp_ev)/4))*lv)/100)+lv+10; |
||||
} |
||||
|
||||
private int CalculateStat(Integer lv, int base, Integer iv, Integer ev) { |
||||
return (int)(((((base+iv)*2)+(Math.sqrt(ev)/4))*lv)/100)+5; |
||||
} |
||||
|
||||
public MegamonCreature getCreature() { |
||||
return creature; |
||||
} |
||||
|
||||
public NonVolatileStatus getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public VolatileStatus getBattleStatus() { |
||||
return battlestatus; |
||||
} |
||||
|
||||
public Integer getATKModifier() { |
||||
return atk_modifier; |
||||
} |
||||
|
||||
public Integer getDEFModifier() { |
||||
return def_modifier; |
||||
} |
||||
|
||||
public Integer getSPDModifier() { |
||||
return spd_modifier; |
||||
} |
||||
|
||||
public Integer getSPCModifier() { |
||||
return spc_modifier; |
||||
} |
||||
|
||||
public Integer getEVAModifier() { |
||||
return eva_modifier; |
||||
} |
||||
|
||||
public Integer getACCModifier() { |
||||
return acc_modifier; |
||||
} |
||||
|
||||
public Integer getATKIV() { |
||||
return atk_iv; |
||||
} |
||||
|
||||
public Integer getDEFIV() { |
||||
return def_iv; |
||||
} |
||||
|
||||
public Integer getSPDIV() { |
||||
return spd_iv; |
||||
} |
||||
|
||||
public Integer getSPCIV() { |
||||
return spc_iv; |
||||
} |
||||
|
||||
public Integer getATKEV() { |
||||
return atk_ev; |
||||
} |
||||
|
||||
public Integer getDEFEV() { |
||||
return def_ev; |
||||
} |
||||
|
||||
public Integer getSPDEV() { |
||||
return spd_ev; |
||||
} |
||||
|
||||
public Integer getSPCEV() { |
||||
return spc_ev; |
||||
} |
||||
|
||||
public Integer getHPEV() { |
||||
return hp_ev; |
||||
} |
||||
|
||||
public Integer getHP() { |
||||
return hp; |
||||
} |
||||
|
||||
public Integer getMaxHP() { |
||||
return maxhp; |
||||
} |
||||
|
||||
public Integer getATK() { |
||||
return atk; |
||||
} |
||||
|
||||
public Integer getDEF() { |
||||
return def; |
||||
} |
||||
|
||||
public Integer getSPD() { |
||||
return spd; |
||||
} |
||||
|
||||
public Integer getSPC() { |
||||
return spc; |
||||
} |
||||
|
||||
public String getNickname() { |
||||
return nickname; |
||||
} |
||||
|
||||
public Integer getOriginalTrainerID() { |
||||
return original_trainer; |
||||
} |
||||
|
||||
public String getOriginalTrainerName() { |
||||
return original_trainer_name; |
||||
} |
||||
|
||||
public Integer getLevel() { |
||||
return level; |
||||
} |
||||
|
||||
public Integer getHPIV() { |
||||
return hp_iv; |
||||
} |
||||
|
||||
public void setCreature(MegamonCreature creature) { |
||||
this.creature = creature; |
||||
} |
||||
|
||||
public void setStatus(NonVolatileStatus status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public void setBattleStatus(VolatileStatus battlestatus) { |
||||
this.battlestatus = battlestatus; |
||||
} |
||||
|
||||
public void setATKModifier(Integer atk_modifier) { |
||||
this.atk_modifier = atk_modifier; |
||||
} |
||||
|
||||
public void setDEFModifier(Integer def_modifier) { |
||||
this.def_modifier = def_modifier; |
||||
} |
||||
|
||||
public void setSPDModifier(Integer spd_modifier) { |
||||
this.spd_modifier = spd_modifier; |
||||
} |
||||
|
||||
public void setSPCModifier(Integer spc_modifier) { |
||||
this.spc_modifier = spc_modifier; |
||||
} |
||||
|
||||
public void setEVAModifier(Integer eva_modifier) { |
||||
this.eva_modifier = eva_modifier; |
||||
} |
||||
|
||||
public void setACCModifier(Integer acc_modifier) { |
||||
this.acc_modifier = acc_modifier; |
||||
} |
||||
|
||||
public void setATKIV(Integer atk_iv) { |
||||
this.atk_iv = atk_iv; |
||||
} |
||||
|
||||
public void setDEFIV(Integer def_iv) { |
||||
this.def_iv = def_iv; |
||||
} |
||||
|
||||
public void setSPDIV(Integer spd_iv) { |
||||
this.spd_iv = spd_iv; |
||||
} |
||||
|
||||
public void setSPCIV(Integer spc_iv) { |
||||
this.spc_iv = spc_iv; |
||||
} |
||||
|
||||
public void setATKEV(Integer atk_ev) { |
||||
this.atk_ev = atk_ev; |
||||
} |
||||
|
||||
public void setDEFEV(Integer def_ev) { |
||||
this.def_ev = def_ev; |
||||
} |
||||
|
||||
public void setSPDEV(Integer spd_ev) { |
||||
this.spd_ev = spd_ev; |
||||
} |
||||
|
||||
public void setSPCEV(Integer spc_ev) { |
||||
this.spc_ev = spc_ev; |
||||
} |
||||
|
||||
public void setHPEV(Integer hp_ev) { |
||||
this.hp_ev = hp_ev; |
||||
} |
||||
|
||||
public void setHP(Integer hp) { |
||||
this.hp = hp; |
||||
} |
||||
|
||||
public void setMaxHP(Integer maxhp) { |
||||
this.maxhp = maxhp; |
||||
} |
||||
|
||||
public void setATK(Integer atk) { |
||||
this.atk = atk; |
||||
} |
||||
|
||||
public void setDEF(Integer def) { |
||||
this.def = def; |
||||
} |
||||
|
||||
public void setSPD(Integer spd) { |
||||
this.spd = spd; |
||||
} |
||||
|
||||
public void setSPC(Integer spc) { |
||||
this.spc = spc; |
||||
} |
||||
|
||||
public void setNickname(String nickname) { |
||||
this.nickname = nickname; |
||||
} |
||||
|
||||
public void setOriginalTrainerID(Integer original_trainer) { |
||||
this.original_trainer = original_trainer; |
||||
} |
||||
|
||||
public void setOriginalTrainerName(String original_trainer_name) { |
||||
this.original_trainer_name = original_trainer_name; |
||||
} |
||||
|
||||
public void setLevel(Integer level) { |
||||
this.level = level; |
||||
} |
||||
|
||||
public void setHPIV(Integer hp_iv) { |
||||
this.hp_iv = hp_iv; |
||||
} |
||||
|
||||
public String toString() { |
||||
StringBuilder sb = new StringBuilder(this.getClass().getSimpleName()+"("); |
||||
boolean first=true; |
||||
for (Field f : this.getClass().getDeclaredFields()) { |
||||
try { |
||||
if (!first) { |
||||
sb.append(","); |
||||
} else { |
||||
first=false; |
||||
} |
||||
sb.append(f.getName()+"="+this.getClass().getDeclaredField(f.getName()).get(this)); |
||||
} catch (IllegalArgumentException e) { |
||||
e.printStackTrace(); |
||||
} catch (IllegalAccessException e) { |
||||
e.printStackTrace(); |
||||
} catch (NoSuchFieldException e) { |
||||
e.printStackTrace(); |
||||
} catch (SecurityException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
sb.append(")"); |
||||
return sb.toString(); |
||||
} |
||||
} |
@ -1,100 +0,0 @@ |
||||
package sig.megamon; |
||||
|
||||
import java.awt.geom.Point2D; |
||||
import java.awt.geom.Point2D.Double; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
import com.badlogic.gdx.Gdx; |
||||
import com.badlogic.gdx.graphics.Texture; |
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch; |
||||
|
||||
import sig.megamon.menu.DialogBox; |
||||
import sig.megamon.ref.RoomRef; |
||||
import sig.megamon.ref.SignRef; |
||||
import sig.megamon.utils.GraphicUtils; |
||||
import sig.megamon.utils.PlayerUtils; |
||||
import sig.megamon.utils.TrainerUtils; |
||||
|
||||
public class Player { |
||||
|
||||
public Point2D.Double position = new Point2D.Double(1,1); |
||||
Point2D.Double direction = new Point2D.Double(0,0); |
||||
Point2D.Double lastdirection = new Point2D.Double(0,1); |
||||
Texture sprite; |
||||
private List<MegamonPet> megamon_party = new ArrayList<MegamonPet>(); |
||||
int trainer_id; |
||||
String name; |
||||
|
||||
public Player(Point2D.Double position, String sprite) { |
||||
this.position=position; |
||||
this.sprite=new Texture(sprite); |
||||
this.trainer_id = TrainerUtils.getRandomTrainerID(); |
||||
this.name = "Rob"; |
||||
} |
||||
|
||||
public void run() { |
||||
direction=new Point2D.Double(0, 0); |
||||
if (Gdx.input.isKeyPressed(Megamon.MOVELEFTKEY)) { |
||||
direction=lastdirection=new Point2D.Double(-Megamon.CHAR_SPD,0); |
||||
} else |
||||
if (Gdx.input.isKeyPressed(Megamon.MOVEUPKEY)) { |
||||
direction=lastdirection=new Point2D.Double(0,Megamon.CHAR_SPD); |
||||
} else |
||||
if (Gdx.input.isKeyPressed(Megamon.MOVERIGHTKEY)) { |
||||
direction=lastdirection=new Point2D.Double(Megamon.CHAR_SPD,0); |
||||
} else |
||||
if (Gdx.input.isKeyPressed(Megamon.MOVEDOWNKEY)) { |
||||
direction=lastdirection=new Point2D.Double(0,-Megamon.CHAR_SPD); |
||||
} |
||||
Point2D.Double destinationposition = new Point2D.Double(position.x+Math.signum(lastdirection.x),position.y+Math.signum(lastdirection.y)); |
||||
if (Gdx.input.isKeyJustPressed(Megamon.ACTIONKEY)) { |
||||
CheckForInfo(destinationposition); |
||||
} |
||||
if (direction.x!=0 || direction.y!=0) { |
||||
//System.out.println("("+position.x+","+Math.signum(direction.x)+","+position.y+","+Math.signum(direction.y)+")");
|
||||
//Point2D.Double destinationposition = new Point2D.Double(position.x+Math.signum(direction.x),position.y+Math.signum(direction.y));
|
||||
if (PlayerUtils.isLocationPassable(Megamon.currentLevel.getMap(),destinationposition)) { |
||||
position.setLocation(position.x+direction.x, position.y+direction.y); |
||||
} else { |
||||
//We hit a wall.
|
||||
} |
||||
//System.out.println(Megamon.infoDatabase.keySet());
|
||||
CheckForDoor(destinationposition); |
||||
} |
||||
} |
||||
|
||||
private void CheckForDoor(Point2D.Double destinationposition) { |
||||
if (Megamon.doorDatabase.containsKey(PlayerUtils.getDoorPositionHash(destinationposition))) { |
||||
//System.out.println("This is a door!");
|
||||
RoomRef door = Megamon.doorDatabase.get(PlayerUtils.getDoorPositionHash(destinationposition)); |
||||
if (!door.destinationRoom.equalsIgnoreCase(Megamon.currentLevel.mapName)) { |
||||
Megamon.currentLevel.destroy(); |
||||
Megamon.currentLevel = new Room(door.doorDestination,door.destinationRoom); |
||||
} else { |
||||
position.setLocation(door.doorDestination); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void CheckForInfo(Point2D.Double destinationposition) { |
||||
if (Megamon.infoDatabase.containsKey(PlayerUtils.getDoorPositionHash(destinationposition))) { |
||||
//System.out.println("This is a door!");
|
||||
SignRef info = Megamon.infoDatabase.get(PlayerUtils.getDoorPositionHash(destinationposition)); |
||||
//TODO Do interface stuff here.
|
||||
Megamon.messagebox = new DialogBox(info.getMessages()); |
||||
} |
||||
} |
||||
|
||||
public void draw(SpriteBatch batch) { |
||||
batch.draw(sprite, (int)GraphicUtils.getPlayerPixelPosition(Megamon.camera).getX(), (int)GraphicUtils.getPlayerPixelPosition(Megamon.camera).getY(), (int)GraphicUtils.getTileSize(Megamon.camera).getX(), (int)GraphicUtils.getTileSize(Megamon.camera).getY()); |
||||
} |
||||
|
||||
public void addMegamonToParty(MegamonPet megamon) { |
||||
megamon_party.add(megamon); |
||||
} |
||||
|
||||
public List<MegamonPet> getMegamonParty() { |
||||
return megamon_party; |
||||
} |
||||
} |
@ -1,7 +0,0 @@ |
||||
package sig.megamon.creature; |
||||
|
||||
public enum Category { |
||||
PHYSICAL, |
||||
SPECIAL, |
||||
STATUS; |
||||
} |
@ -1,15 +0,0 @@ |
||||
package sig.megamon.creature; |
||||
|
||||
import java.lang.reflect.Field; |
||||
|
||||
public class CreatureLore { |
||||
final String bio; |
||||
final int size; //In inches.
|
||||
final float weight; //In lbs.
|
||||
|
||||
public CreatureLore(String bio, int size, float weight) { |
||||
this.bio = bio; |
||||
this.size = size; |
||||
this.weight = weight; |
||||
} |
||||
} |
@ -1,49 +0,0 @@ |
||||
package sig.megamon.creature; |
||||
|
||||
import java.lang.reflect.Field; |
||||
|
||||
public class CreatureMove { |
||||
String name=""; |
||||
String desc=""; |
||||
CreatureType type; |
||||
Category cat; |
||||
int pp; |
||||
int accuracy; |
||||
int power; |
||||
|
||||
public CreatureMove(String name, String description, CreatureType type, Category category, |
||||
int initialPP, int power, int accuracy) { |
||||
this.name=name; |
||||
this.desc=description; |
||||
this.type=type; |
||||
this.cat=category; |
||||
this.pp=initialPP; |
||||
this.power = power; |
||||
this.accuracy = accuracy; |
||||
} |
||||
|
||||
public String toString() { |
||||
StringBuilder sb = new StringBuilder(this.getClass().getSimpleName()+"("); |
||||
boolean first=true; |
||||
for (Field f : this.getClass().getDeclaredFields()) { |
||||
try { |
||||
if (!first) { |
||||
sb.append(","); |
||||
} else { |
||||
first=false; |
||||
} |
||||
sb.append(f.getName()+"="+this.getClass().getDeclaredField(f.getName()).get(this)); |
||||
} catch (IllegalArgumentException e) { |
||||
e.printStackTrace(); |
||||
} catch (IllegalAccessException e) { |
||||
e.printStackTrace(); |
||||
} catch (NoSuchFieldException e) { |
||||
e.printStackTrace(); |
||||
} catch (SecurityException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
sb.append(")"); |
||||
return sb.toString(); |
||||
} |
||||
} |
@ -1,18 +0,0 @@ |
||||
package sig.megamon.creature; |
||||
|
||||
import sig.megamon.Megamon; |
||||
|
||||
public class CreatureMoveLinker { |
||||
CreatureMove move; |
||||
int lvLearned=0; |
||||
|
||||
public CreatureMoveLinker(String moveKeyName, int lvLearnedAt) { |
||||
if (Megamon.moveDatabase.containsKey(moveKeyName)) { |
||||
this.move = Megamon.moveDatabase.get(moveKeyName); |
||||
} else { |
||||
System.out.println("WARNING! Move \""+moveKeyName+"\" does not exist! Adding default move."); |
||||
this.move = Megamon.moveDatabase.get("M.Buster"); |
||||
} |
||||
this.lvLearned=lvLearnedAt; |
||||
} |
||||
} |
@ -1,121 +0,0 @@ |
||||
package sig.megamon.creature; |
||||
|
||||
import java.lang.reflect.Field; |
||||
|
||||
public enum CreatureType { |
||||
NORMAL, |
||||
FIRE, |
||||
WATER, |
||||
ELECTRIC, |
||||
ICE, |
||||
STRENGTH, |
||||
GROUND, |
||||
FLYING, |
||||
BUG, |
||||
DRAGON, |
||||
DARK, |
||||
SHIELD, |
||||
NONE; |
||||
|
||||
public CreatureType[] getSuperEffectiveTypes() { |
||||
switch (this) { |
||||
case BUG: |
||||
return new CreatureType[]{DARK,SHIELD}; |
||||
case DARK: |
||||
return new CreatureType[]{STRENGTH,FLYING}; |
||||
case DRAGON: |
||||
return new CreatureType[]{DRAGON}; |
||||
case ELECTRIC: |
||||
return new CreatureType[]{WATER,FLYING,DARK}; |
||||
case FIRE: |
||||
return new CreatureType[]{BUG,DARK}; |
||||
case FLYING: |
||||
return new CreatureType[]{STRENGTH,BUG}; |
||||
case GROUND: |
||||
return new CreatureType[]{FIRE,ELECTRIC}; |
||||
case ICE: |
||||
return new CreatureType[]{FLYING,DRAGON}; |
||||
case NORMAL: |
||||
return new CreatureType[]{}; |
||||
case SHIELD: |
||||
return new CreatureType[]{ICE,GROUND}; |
||||
case STRENGTH: |
||||
return new CreatureType[]{NORMAL,ICE}; |
||||
case WATER: |
||||
return new CreatureType[]{FIRE,GROUND}; |
||||
case NONE: |
||||
return new CreatureType[]{}; |
||||
default: |
||||
System.out.println("WARNING! Could not find proper effectiveness table for type "+this.name()+"! This should not be happening!"); |
||||
return new CreatureType[]{}; |
||||
} |
||||
} |
||||
|
||||
public CreatureType[] getWeakTypes() { |
||||
switch (this) { |
||||
case BUG: |
||||
return new CreatureType[]{FIRE,STRENGTH,FLYING}; |
||||
case DARK: |
||||
return new CreatureType[]{FIRE,ELECTRIC}; |
||||
case DRAGON: |
||||
return new CreatureType[]{}; |
||||
case ELECTRIC: |
||||
return new CreatureType[]{ELECTRIC,DRAGON,SHIELD}; |
||||
case FIRE: |
||||
return new CreatureType[]{FIRE,WATER,DRAGON,SHIELD}; |
||||
case FLYING: |
||||
return new CreatureType[]{ELECTRIC,DARK}; |
||||
case GROUND: |
||||
return new CreatureType[]{BUG}; |
||||
case ICE: |
||||
return new CreatureType[]{WATER,ICE}; |
||||
case NORMAL: |
||||
return new CreatureType[]{}; |
||||
case SHIELD: |
||||
return new CreatureType[]{STRENGTH,FLYING}; |
||||
case STRENGTH: |
||||
return new CreatureType[]{FLYING,BUG}; |
||||
case WATER: |
||||
return new CreatureType[]{WATER,DRAGON,SHIELD}; |
||||
case NONE: |
||||
return new CreatureType[]{}; |
||||
default: |
||||
System.out.println("WARNING! Could not find proper effectiveness table for type "+this.name()+"! This should not be happening!"); |
||||
return new CreatureType[]{}; |
||||
} |
||||
} |
||||
|
||||
public CreatureType[] getUnaffectedTypes() { |
||||
switch (this) { |
||||
case BUG: |
||||
return new CreatureType[]{}; |
||||
case DARK: |
||||
return new CreatureType[]{}; |
||||
case DRAGON: |
||||
return new CreatureType[]{}; |
||||
case ELECTRIC: |
||||
return new CreatureType[]{GROUND}; |
||||
case FIRE: |
||||
return new CreatureType[]{}; |
||||
case FLYING: |
||||
return new CreatureType[]{}; |
||||
case GROUND: |
||||
return new CreatureType[]{FLYING}; |
||||
case ICE: |
||||
return new CreatureType[]{}; |
||||
case NORMAL: |
||||
return new CreatureType[]{}; |
||||
case SHIELD: |
||||
return new CreatureType[]{}; |
||||
case STRENGTH: |
||||
return new CreatureType[]{}; |
||||
case WATER: |
||||
return new CreatureType[]{}; |
||||
case NONE: |
||||
return new CreatureType[]{}; |
||||
default: |
||||
System.out.println("WARNING! Could not find proper effectiveness table for type "+this.name()+"! This should not be happening!"); |
||||
return new CreatureType[]{}; |
||||
} |
||||
} |
||||
} |
@ -1,19 +0,0 @@ |
||||
package sig.megamon.creature; |
||||
|
||||
import sig.megamon.MegamonCreature; |
||||
|
||||
public class Evolution { |
||||
MegamonCreature creature; |
||||
int level; |
||||
boolean trade; |
||||
|
||||
public Evolution(MegamonCreature creatureEvolvesInto, int levelOfEvolution) { |
||||
this(creatureEvolvesInto,levelOfEvolution,false); |
||||
} |
||||
|
||||
public Evolution(MegamonCreature creatureEvolvesInto, int levelOfEvolution, boolean tradeRequired) { |
||||
this.creature = creatureEvolvesInto; |
||||
this.level = levelOfEvolution; |
||||
this.trade = tradeRequired; |
||||
} |
||||
} |
@ -1,12 +0,0 @@ |
||||
package sig.megamon.creature; |
||||
|
||||
import java.lang.reflect.Field; |
||||
|
||||
public enum ExperienceRate { |
||||
ERRATIC, |
||||
FAST, |
||||
MEDIUM_FAST, |
||||
MEDIUM_SLOW, |
||||
SLOW, |
||||
FLUCTUATING; |
||||
} |
@ -1,18 +0,0 @@ |
||||
package sig.megamon.creature; |
||||
|
||||
import java.lang.reflect.Field; |
||||
|
||||
public enum NonVolatileStatus { |
||||
BURN("BRN"), |
||||
FREEZE("FRZ"), |
||||
PARALYSIS("BRN"), |
||||
POISON("PSN"), |
||||
BAD_POISON("PSN"), |
||||
SLEEP("SLP"); |
||||
|
||||
String abbreviation; |
||||
|
||||
NonVolatileStatus(String abbreviation) { |
||||
this.abbreviation=abbreviation; |
||||
} |
||||
} |
@ -1,62 +0,0 @@ |
||||
package sig.megamon.creature; |
||||
|
||||
import java.lang.reflect.Field; |
||||
|
||||
import com.badlogic.gdx.graphics.Texture; |
||||
|
||||
/** |
||||
* A collection of 3 images that represents each Megamon. |
||||
* One is the overworld/mini icon when looking at stats of the Megamon. |
||||
* One is the forward-facing sprite that players see when facing the Megamon. |
||||
* One if the backward-facing sprite that players see when they send out their Megamon. |
||||
* |
||||
*/ |
||||
public class SpriteCollection { |
||||
final static String MEGAMON_ASSETS = "Megamon/"; |
||||
Texture mini_icon; |
||||
Texture sprite; |
||||
Texture back_sprite; |
||||
/** |
||||
* Provide the file names of the sprites relative to the 'Megamon' assets folder. |
||||
*/ |
||||
public SpriteCollection(String mini_icon, String sprite, String back_sprite) { |
||||
this.mini_icon = new Texture(MEGAMON_ASSETS+mini_icon); |
||||
this.sprite = new Texture(MEGAMON_ASSETS+sprite); |
||||
this.back_sprite = new Texture(MEGAMON_ASSETS+back_sprite); |
||||
} |
||||
|
||||
public Texture getMiniIcon() { |
||||
return mini_icon; |
||||
} |
||||
public Texture getSprite() { |
||||
return sprite; |
||||
} |
||||
public Texture getBackSprite() { |
||||
return back_sprite; |
||||
} |
||||
|
||||
public String toString() { |
||||
StringBuilder sb = new StringBuilder(this.getClass().getSimpleName()+"("); |
||||
boolean first=true; |
||||
for (Field f : this.getClass().getDeclaredFields()) { |
||||
try { |
||||
if (!first) { |
||||
sb.append(","); |
||||
} else { |
||||
first=false; |
||||
} |
||||
sb.append(f.getName()+"="+this.getClass().getDeclaredField(f.getName()).get(this)); |
||||
} catch (IllegalArgumentException e) { |
||||
e.printStackTrace(); |
||||
} catch (IllegalAccessException e) { |
||||
e.printStackTrace(); |
||||
} catch (NoSuchFieldException e) { |
||||
e.printStackTrace(); |
||||
} catch (SecurityException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
sb.append(")"); |
||||
return sb.toString(); |
||||
} |
||||
} |
@ -1,13 +0,0 @@ |
||||
package sig.megamon.creature; |
||||
|
||||
import java.lang.reflect.Field; |
||||
|
||||
public enum VolatileStatus { |
||||
BIND, |
||||
NO_ESCAPE, |
||||
CONFUSED, |
||||
CURSE, |
||||
FLINCH, |
||||
LEECHED, |
||||
; |
||||
} |
@ -1,69 +0,0 @@ |
||||
package sig.megamon.menu; |
||||
|
||||
import com.badlogic.gdx.graphics.Color; |
||||
|
||||
public class ColorCycler { |
||||
double r = 0; |
||||
double g = 0; |
||||
double b = 0; |
||||
double cyclespd = 0; |
||||
int stage = 1; //1 = Green+, 2 = Red-, 3 = Blue+, 4 = Green-, 5 = Red+, 6 = Blue-
|
||||
|
||||
public ColorCycler(Color startingColor, double cyclespd) { |
||||
this.r = startingColor.r; |
||||
this.g = startingColor.g; |
||||
this.b = startingColor.b; |
||||
this.cyclespd=cyclespd; |
||||
} |
||||
|
||||
public void run() { |
||||
switch (stage) { |
||||
case 1:{ |
||||
if (g<255) { |
||||
g=Math.min(255, g+cyclespd); |
||||
} else { |
||||
stage++; |
||||
} |
||||
}break; |
||||
case 2:{ |
||||
if (r>0) { |
||||
r=Math.max(0, r-cyclespd); |
||||
} else { |
||||
stage++; |
||||
} |
||||
}break; |
||||
case 3:{ |
||||
if (b<255) { |
||||
b=Math.min(255, b+cyclespd); |
||||
} else { |
||||
stage++; |
||||
} |
||||
}break; |
||||
case 4:{ |
||||
if (g>0) { |
||||
g=Math.max(0, g-cyclespd); |
||||
} else { |
||||
stage++; |
||||
} |
||||
}break; |
||||
case 5:{ |
||||
if (r<255) { |
||||
r=Math.min(255, r+cyclespd); |
||||
} else { |
||||
stage++; |
||||
} |
||||
}break; |
||||
case 6:{ |
||||
if (b>0) { |
||||
b=Math.max(0, b-cyclespd); |
||||
} else { |
||||
stage=1; |
||||
} |
||||
}break; |
||||
} |
||||
} |
||||
|
||||
public Color getCycleColor() { |
||||
return new Color((float)(r/255),(float)(g/255),(float)(b/255),1f); |
||||
} |
||||
} |
@ -1,100 +0,0 @@ |
||||
package sig.megamon.menu; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.LinkedList; |
||||
import java.util.List; |
||||
|
||||
import com.badlogic.gdx.Gdx; |
||||
import com.badlogic.gdx.graphics.Color; |
||||
import com.badlogic.gdx.graphics.Texture; |
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont; |
||||
import com.badlogic.gdx.graphics.g2d.GlyphLayout; |
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch; |
||||
import com.badlogic.gdx.utils.Align; |
||||
|
||||
import sig.megamon.Megamon; |
||||
import sig.megamon.utils.DrawUtils; |
||||
|
||||
public class DialogBox { |
||||
static Texture dialog_background = new Texture("dialog.png"); |
||||
static Texture dialog_box = new Texture("dialog_box.png"); |
||||
static BitmapFont messageboxfont = new BitmapFont(Gdx.files.internal("fonts/messageboxfont.fnt")); |
||||
List<String> remainingMessages; |
||||
String messageBody = ""; |
||||
String displayedMessage = ""; |
||||
int cursor=0; |
||||
int message_split_marker=0; |
||||
GlyphLayout layout; |
||||
|
||||
public DialogBox(String...messages) { |
||||
remainingMessages=new LinkedList<String>(Arrays.asList(messages)); |
||||
this.messageBody = remainingMessages.remove(0); |
||||
} |
||||
|
||||
public void run() { |
||||
//TODO accept keyboard inputs for the dialog box.
|
||||
if (Gdx.input.isKeyJustPressed(Megamon.ACTIONKEY)) { |
||||
//System.out.println("Cursor is at position "+cursor+"/"+displayedMessage.length());
|
||||
if (cursor==displayedMessage.length()) { |
||||
if (cursor!=messageBody.length()) { |
||||
displayedMessage=""; |
||||
messageBody=messageBody.substring(cursor, messageBody.length()); |
||||
cursor=0; |
||||
} else { |
||||
if (remainingMessages.size()>0) { |
||||
messageBody = remainingMessages.remove(0); |
||||
displayedMessage=""; |
||||
cursor=0; |
||||
} else { |
||||
DestroyMessageBox(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void DestroyMessageBox() { |
||||
Megamon.messagebox=null; |
||||
} |
||||
|
||||
public void draw(SpriteBatch batch) { |
||||
DrawUtils.drawTextureWithColor(batch, dialog_background, (Megamon.WINDOW_WIDTH-dialog_background.getWidth())/2,0,new Color(0.5f,1f,0.5f,1f)); |
||||
DrawUtils.drawTextureWithColor(batch, dialog_box, (Megamon.WINDOW_WIDTH-dialog_box.getWidth())/2,0,new Color(0.5f,1f,0.5f,1f)); |
||||
//System.out.println(dialog_box.getTextureData().getWidth());
|
||||
layout = messageboxfont.draw(batch, displayedMessage, (Megamon.WINDOW_WIDTH-dialog_box.getWidth())/2+96, dialog_box.getHeight()-24, 0, displayedMessage.length(), 420, Align.left, true); |
||||
if (cursor!=displayedMessage.length()) { |
||||
cursor++; |
||||
} else |
||||
if (layout.height<64) { |
||||
//Check if the next set of text with a space is not going to maximize the window.
|
||||
int checkcursor = findNextSpace(messageBody,cursor)+cursor; |
||||
//layout.setTe
|
||||
String nextStr=""; |
||||
if (checkcursor==messageBody.length()) { |
||||
nextStr = messageBody; |
||||
} else { |
||||
nextStr = messageBody.substring(0, checkcursor+1); |
||||
} |
||||
layout.setText(messageboxfont, nextStr, Color.BLACK, 420, Align.left, true); |
||||
if (layout.height<64 && cursor!=messageBody.length()) { |
||||
displayedMessage = nextStr; |
||||
cursor++; |
||||
} |
||||
} |
||||
//Megamon.font.draw(batch, messageBody, (Megamon.WINDOW_WIDTH-dialog_box.getWidth())/2-dialog_box.getWidth()/2, dialog_box.getHeight()+, start, end, targetWidth, halign, wrap);
|
||||
} |
||||
|
||||
private int findNextSpace(String messageBody, int cursor) { |
||||
String subString=messageBody.substring(cursor, messageBody.length()); |
||||
//System.out.println("Substring is "+subString);
|
||||
for (int i=0;i<subString.length();i++) { |
||||
//System.out.println("Character at "+i+" is "+subString.charAt(i));
|
||||
if (subString.charAt(i)==' ') { |
||||
//System.out.println("Found a space at position "+i);
|
||||
return i; |
||||
} |
||||
} |
||||
return subString.length(); |
||||
} |
||||
} |
@ -1,49 +0,0 @@ |
||||
package sig.megamon.menu; |
||||
|
||||
import java.awt.geom.Point2D; |
||||
|
||||
import com.badlogic.gdx.graphics.Color; |
||||
import com.badlogic.gdx.graphics.Texture; |
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch; |
||||
|
||||
import sig.megamon.utils.DrawUtils; |
||||
|
||||
public class FancyBackground { |
||||
Point2D.Double offset = new Point2D.Double(0, 0); |
||||
Point2D.Double scrollspd = new Point2D.Double(0, 0); |
||||
Texture scrollbackground; |
||||
ColorCycler cycler; |
||||
Color color; |
||||
|
||||
public FancyBackground(Texture background, Point2D.Double scrollspd, boolean cycleColors) { |
||||
this.scrollbackground=background; |
||||
this.scrollspd=scrollspd; |
||||
if (cycleColors) { |
||||
cycler = new ColorCycler(new Color(1,0,0,1),10); |
||||
} else { |
||||
color = new Color(0,0,0.5f,1); |
||||
} |
||||
} |
||||
|
||||
public FancyBackground(Texture background, Point2D.Double scrollspd, Color staticColor) { |
||||
this(background,scrollspd,false); |
||||
this.color = staticColor; |
||||
} |
||||
|
||||
public void run() { |
||||
if (cycler!=null) { |
||||
cycler.run(); |
||||
} |
||||
offset.setLocation(offset.x+scrollspd.x, offset.y+scrollspd.y); |
||||
} |
||||
|
||||
public void draw(SpriteBatch batch) { |
||||
if (cycler!=null) { |
||||
batch.setColor(cycler.getCycleColor()); |
||||
} else { |
||||
batch.setColor(color); |
||||
} |
||||
DrawUtils.drawTiledImage(batch, scrollbackground, offset); |
||||
batch.setColor(new Color(1,1,1,1)); |
||||
} |
||||
} |
@ -1,257 +0,0 @@ |
||||
package sig.megamon.menu; |
||||
|
||||
import java.awt.geom.Point2D; |
||||
|
||||
import com.badlogic.gdx.Gdx; |
||||
import com.badlogic.gdx.graphics.Color; |
||||
import com.badlogic.gdx.graphics.Texture; |
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch; |
||||
import com.badlogic.gdx.utils.Align; |
||||
|
||||
import sig.megamon.*; |
||||
|
||||
public class MegadexMenu { |
||||
static FancyBackground background = new FancyBackground(new Texture("interface/tiledbackground.png"),new Point2D.Double(0.4, 0.2),true); |
||||
static Texture menu = new Texture("interface/megadex.png"); |
||||
final static int TOTALMEGAMON = 151; |
||||
int selection = 0; |
||||
int offset_displayed_selection = 0; //The top most selection that is visible.
|
||||
int largestNumberSeen = 0; |
||||
boolean released=true; |
||||
int delaytimer = Megamon.CURSORDELAYTIMER*3; |
||||
final int fontheight = 36; |
||||
final int smallfontheight = 20; |
||||
final int boxheight = 458; |
||||
int lastkey = 0; |
||||
int hpval=0; |
||||
int atkval=0; |
||||
int defval=0; |
||||
int spcval=0; |
||||
int spdval=0; |
||||
final static int ticktime=2; |
||||
int changedelay=ticktime; |
||||
|
||||
public MegadexMenu() { |
||||
largestNumberSeen = calculateLargestNumberSeen(); |
||||
} |
||||
|
||||
private int calculateLargestNumberSeen() { |
||||
for (int i=Megamon.megamonDatabase.size()-1;i>0;i--) { |
||||
if (Megamon.megamonDatabase.get(i).isSeenByPlayer()) { |
||||
return i; |
||||
} |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
public void run() { |
||||
background.run(); |
||||
if (Gdx.input.isKeyJustPressed(Megamon.CANCELKEY) || |
||||
Gdx.input.isKeyJustPressed(Megamon.MENUKEY)) { |
||||
Megamon.megadexscreen=null; |
||||
return; |
||||
} |
||||
int keycheck = Megamon.MOVEDOWNKEY; |
||||
if (Gdx.input.isKeyJustPressed(keycheck)) { |
||||
released=false; |
||||
lastkey = keycheck; |
||||
MoveDown(); |
||||
} |
||||
if (lastkey == keycheck) { |
||||
if (Gdx.input.isKeyPressed(keycheck) && !released) { |
||||
if (delaytimer--<=0) { |
||||
MoveDown(); |
||||
delaytimer = Megamon.CURSORDELAYTIMER; |
||||
} |
||||
} else |
||||
if (!Gdx.input.isKeyPressed(keycheck) && !released) { |
||||
delaytimer = Megamon.CURSORDELAYTIMER*3; |
||||
released=true; |
||||
} |
||||
} |
||||
keycheck = Megamon.MOVEUPKEY; |
||||
if (Gdx.input.isKeyJustPressed(keycheck)) { |
||||
released=false; |
||||
lastkey = keycheck; |
||||
MoveUp(); |
||||
} |
||||
if (lastkey == keycheck) { |
||||
if (Gdx.input.isKeyPressed(keycheck) && !released) { |
||||
if (delaytimer--<=0) { |
||||
MoveUp(); |
||||
delaytimer = Megamon.CURSORDELAYTIMER; |
||||
} |
||||
} else |
||||
if (!Gdx.input.isKeyPressed(keycheck) && !released) { |
||||
delaytimer = Megamon.CURSORDELAYTIMER*3; |
||||
released=true; |
||||
} |
||||
} |
||||
keycheck = Megamon.MOVERIGHTKEY; |
||||
if (Gdx.input.isKeyJustPressed(keycheck)) { |
||||
released=false; |
||||
lastkey = keycheck; |
||||
MoveRight(); |
||||
} |
||||
if (lastkey == keycheck) { |
||||
if (Gdx.input.isKeyPressed(keycheck) && !released) { |
||||
if (delaytimer--<=0) { |
||||
MoveRight(); |
||||
delaytimer = Megamon.CURSORDELAYTIMER; |
||||
} |
||||
} else |
||||
if (!Gdx.input.isKeyPressed(keycheck) && !released) { |
||||
delaytimer = Megamon.CURSORDELAYTIMER*3; |
||||
released=true; |
||||
} |
||||
} |
||||
keycheck = Megamon.MOVELEFTKEY; |
||||
if (Gdx.input.isKeyJustPressed(keycheck)) { |
||||
released=false; |
||||
lastkey = keycheck; |
||||
MoveLeft(); |
||||
} |
||||
if (lastkey == keycheck) { |
||||
if (Gdx.input.isKeyPressed(keycheck) && !released) { |
||||
if (delaytimer--<=0) { |
||||
MoveLeft(); |
||||
delaytimer = Megamon.CURSORDELAYTIMER; |
||||
} |
||||
} else |
||||
if (!Gdx.input.isKeyPressed(keycheck) && !released) { |
||||
delaytimer = Megamon.CURSORDELAYTIMER*3; |
||||
released=true; |
||||
} |
||||
} |
||||
if (changedelay>0) { |
||||
changedelay--; |
||||
if (changedelay==0) { |
||||
changedelay = ticktime; |
||||
UpdateValues(Megamon.megamonDatabase.get(selection)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void UpdateValues(MegamonCreature mon) { |
||||
hpval+=(mon.getHP()>hpval)?1:(mon.getHP()<hpval)?-1:0; |
||||
atkval+=(mon.getATK()>atkval)?1:(mon.getATK()<atkval)?-1:0; |
||||
defval+=(mon.getDEF()>defval)?1:(mon.getDEF()<defval)?-1:0; |
||||
spcval+=(mon.getSPC()>spcval)?1:(mon.getSPC()<spcval)?-1:0; |
||||
spdval+=(mon.getSPD()>spdval)?1:(mon.getSPD()<spdval)?-1:0; |
||||
} |
||||
|
||||
private void MoveRight() { |
||||
selection = Math.min(selection+(boxheight/fontheight), largestNumberSeen); |
||||
MenuFollowsCursor(); |
||||
} |
||||
private void MoveLeft() { |
||||
selection = Math.max(selection-(boxheight/fontheight), 0); |
||||
MenuFollowsCursor(); |
||||
} |
||||
|
||||
private void MoveDown() { |
||||
if (selection<largestNumberSeen) { |
||||
selection++; |
||||
MenuFollowsCursor(); |
||||
} |
||||
} |
||||
private void MoveUp() { |
||||
if (selection>0) { |
||||
selection--; |
||||
MenuFollowsCursor(); |
||||
} |
||||
} |
||||
|
||||
private void MenuFollowsCursor() { |
||||
if (selection<offset_displayed_selection) { |
||||
offset_displayed_selection = selection; |
||||
} |
||||
if (selection - offset_displayed_selection>=(boxheight/fontheight)) { |
||||
offset_displayed_selection = selection - (boxheight/fontheight) + 1; |
||||
} |
||||
} |
||||
|
||||
public void draw(SpriteBatch batch) { |
||||
background.draw(batch); |
||||
batch.draw(menu, 0, 0); |
||||
|
||||
DrawMegamonMenu(batch); |
||||
} |
||||
|
||||
private void DrawMegamonMenu(SpriteBatch batch) { |
||||
//First usable pixel: (12,12)
|
||||
for (int i=0;i<boxheight/fontheight;i++) { |
||||
if (i+offset_displayed_selection<largestNumberSeen+1) { |
||||
MegamonCreature megamon = Megamon.megamonDatabase.get(offset_displayed_selection+i); |
||||
Megamon.font.setColor(new Color(1.0f,0.5f,0.5f,0.9f)); |
||||
Megamon.font.draw(batch, Integer.toString(i+offset_displayed_selection+1), 20+16, Megamon.WINDOW_HEIGHT-fontheight-12-(i*fontheight)+fontheight/2, 10, Align.center, false); |
||||
if (megamon.isCaughtByPlayer()) { |
||||
Megamon.font.setColor(new Color(0.7f,1.0f,0.7f,1.0f)); |
||||
} else { |
||||
Megamon.font.setColor(new Color(0.7f,0.7f,0.7f,1.0f)); |
||||
} |
||||
String namedisplay = " "+(megamon.isSeenByPlayer()?megamon.getName():createTwitchyName()); |
||||
Megamon.font.draw(batch, namedisplay, 32+16, Megamon.WINDOW_HEIGHT-fontheight-12-(i*fontheight)+fontheight/2, 0, namedisplay.length(), 256, Align.left, false, "..."); |
||||
Megamon.font.setColor(Color.WHITE); |
||||
if (i+offset_displayed_selection == selection) { |
||||
Megamon.font.setColor(new Color(0.8f,0.8f,1f,0.9f)); |
||||
Megamon.font.draw(batch, ">", 16, Megamon.WINDOW_HEIGHT-fontheight-12-(i*fontheight)+fontheight/2, 10, Align.left, false); |
||||
Megamon.font.setColor(Color.WHITE); |
||||
batch.draw(StartMenuBox.startmenu_highlight,16, Megamon.WINDOW_HEIGHT-fontheight-12-(i*fontheight)+fontheight/2-StartMenuBox.startmenu_highlight.getHeight()*2, StartMenuBox.startmenu_highlight.getWidth(),StartMenuBox.startmenu_highlight.getHeight()*3); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/*Image box: (332,120) |
||||
* Stats: (462,120) |
||||
* Bio: (332,150) |
||||
* Map: (332,468) |
||||
*/ |
||||
MegamonCreature mon = Megamon.megamonDatabase.get(selection); |
||||
boolean seen = mon.isSeenByPlayer(); |
||||
if (seen) { |
||||
Texture monImage = mon.getSprites().getSprite(); |
||||
batch.draw(monImage, 332, Megamon.WINDOW_HEIGHT-120, 110, 110); |
||||
|
||||
int i=1; |
||||
DialogBox.messageboxfont.draw(batch, "HP", 472, Megamon.WINDOW_HEIGHT-(i++*smallfontheight), 16, Align.center, false); |
||||
DialogBox.messageboxfont.draw(batch, "ATK", 472, Megamon.WINDOW_HEIGHT-(i++*smallfontheight), 16, Align.center, false); |
||||
DialogBox.messageboxfont.draw(batch, "DEF", 472, Megamon.WINDOW_HEIGHT-(i++*smallfontheight), 16, Align.center, false); |
||||
DialogBox.messageboxfont.draw(batch, "SPC", 472, Megamon.WINDOW_HEIGHT-(i++*smallfontheight), 16, Align.center, false); |
||||
DialogBox.messageboxfont.draw(batch, "SPD", 472, Megamon.WINDOW_HEIGHT-(i++*smallfontheight), 16, Align.center, false); |
||||
i=1; |
||||
/*batch.draw(Megamon.healthbar, 500, Megamon.WINDOW_HEIGHT-(i++*smallfontheight), 0, 0, Megamon.healthbar.getWidth(), Megamon.healthbar.getHeight()-(int)((1-(mon.getHP()/600f))*Megamon.healthbar.getHeight()), 1, 1, 270, 0, 0, Megamon.healthbar.getWidth(), Megamon.healthbar.getHeight()-(int)((1-(mon.getHP()/600f))*Megamon.healthbar.getHeight()), false, false); |
||||
batch.draw(Megamon.healthbar, 500, Megamon.WINDOW_HEIGHT-(i++*smallfontheight), 0, 0, Megamon.healthbar.getWidth(), Megamon.healthbar.getHeight()-(int)((1-(mon.getATK()/600f))*Megamon.healthbar.getHeight()), 1, 1, 270, 0, 0, Megamon.healthbar.getWidth(), Megamon.healthbar.getHeight()-(int)((1-(mon.getATK()/600f))*Megamon.healthbar.getHeight()), false, false); |
||||
batch.draw(Megamon.healthbar, 500, Megamon.WINDOW_HEIGHT-(i++*smallfontheight), 0, 0, Megamon.healthbar.getWidth(), Megamon.healthbar.getHeight()-(int)((1-(mon.getDEF()/600f))*Megamon.healthbar.getHeight()), 1, 1, 270, 0, 0, Megamon.healthbar.getWidth(), Megamon.healthbar.getHeight()-(int)((1-(mon.getDEF()/600f))*Megamon.healthbar.getHeight()), false, false); |
||||
batch.draw(Megamon.healthbar, 500, Megamon.WINDOW_HEIGHT-(i++*smallfontheight), 0, 0, Megamon.healthbar.getWidth(), Megamon.healthbar.getHeight()-(int)((1-(mon.getSPC()/600f))*Megamon.healthbar.getHeight()), 1, 1, 270, 0, 0, Megamon.healthbar.getWidth(), Megamon.healthbar.getHeight()-(int)((1-(mon.getSPC()/600f))*Megamon.healthbar.getHeight()), false, false); |
||||
batch.draw(Megamon.healthbar, 500, Megamon.WINDOW_HEIGHT-(i++*smallfontheight), 0, 0, Megamon.healthbar.getWidth(), Megamon.healthbar.getHeight()-(int)((1-(mon.getSPD()/600f))*Megamon.healthbar.getHeight()), 1, 1, 270, 0, 0, Megamon.healthbar.getWidth(), Megamon.healthbar.getHeight()-(int)((1-(mon.getSPD()/600f))*Megamon.healthbar.getHeight()), false, false);*/ |
||||
if (mon.getHP()>=100) {batch.setColor(new Color(1f,0.7f,0.7f,1f));} else {batch.setColor(Color.WHITE);} |
||||
batch.draw(Megamon.healthbar_horizontal, 500, Megamon.WINDOW_HEIGHT-(i++*smallfontheight)+1-Megamon.healthbar_horizontal.getHeight(),0,0,(int)((hpval/200f)*Megamon.healthbar_horizontal.getWidth()*2),Megamon.healthbar_horizontal.getHeight()); |
||||
if (mon.getATK()>=100) {batch.setColor(new Color(1f,0.7f,0.7f,1f));} else {batch.setColor(Color.WHITE);} |
||||
batch.draw(Megamon.healthbar_horizontal, 500, Megamon.WINDOW_HEIGHT-(i++*smallfontheight)+1-Megamon.healthbar_horizontal.getHeight(),0,0,(int)((atkval/200f)*Megamon.healthbar_horizontal.getWidth()*2),Megamon.healthbar_horizontal.getHeight()); |
||||
if (mon.getDEF()>=100) {batch.setColor(new Color(1f,0.7f,0.7f,1f));} else {batch.setColor(Color.WHITE);} |
||||
batch.draw(Megamon.healthbar_horizontal, 500, Megamon.WINDOW_HEIGHT-(i++*smallfontheight)+1-Megamon.healthbar_horizontal.getHeight(),0,0,(int)((defval/200f)*Megamon.healthbar_horizontal.getWidth()*2),Megamon.healthbar_horizontal.getHeight()); |
||||
if (mon.getSPC()>=100) {batch.setColor(new Color(1f,0.7f,0.7f,1f));} else {batch.setColor(Color.WHITE);} |
||||
batch.draw(Megamon.healthbar_horizontal, 500, Megamon.WINDOW_HEIGHT-(i++*smallfontheight)+1-Megamon.healthbar_horizontal.getHeight(),0,0,(int)((spcval/200f)*Megamon.healthbar_horizontal.getWidth()*2),Megamon.healthbar_horizontal.getHeight()); |
||||
if (mon.getSPD()>=100) {batch.setColor(new Color(1f,0.7f,0.7f,1f));} else {batch.setColor(Color.WHITE);} |
||||
batch.draw(Megamon.healthbar_horizontal, 500, Megamon.WINDOW_HEIGHT-(i++*smallfontheight)+1-Megamon.healthbar_horizontal.getHeight(),0,0,(int)((spdval/200f)*Megamon.healthbar_horizontal.getWidth()*2),Megamon.healthbar_horizontal.getHeight()); |
||||
batch.setColor(Color.WHITE); |
||||
} |
||||
} |
||||
|
||||
private String createTwitchyName() { |
||||
StringBuilder sb = new StringBuilder(""); |
||||
for (int i=0;i<8;i++) { |
||||
if (Math.random()<=0.01) { |
||||
Character c = (char)(Character.getNumericValue('A')+(int)(Math.random()*26)); |
||||
if (Math.random()<=0.5) { |
||||
c = (char)(Character.getNumericValue('a')+(int)(Math.random()*26)); |
||||
} |
||||
sb.append(c); |
||||
} else { |
||||
sb.append("-"); |
||||
} |
||||
} |
||||
return sb.toString(); |
||||
} |
||||
} |
@ -1,99 +0,0 @@ |
||||
package sig.megamon.menu; |
||||
|
||||
import com.badlogic.gdx.Gdx; |
||||
import com.badlogic.gdx.graphics.Color; |
||||
import com.badlogic.gdx.graphics.GL20; |
||||
import com.badlogic.gdx.graphics.Texture; |
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch; |
||||
import com.badlogic.gdx.utils.Align; |
||||
|
||||
import sig.megamon.Megamon; |
||||
import sig.megamon.MegamonPet; |
||||
|
||||
public class MegamonPartyScreen { |
||||
static Color backgroundColor = new Color(63/255f,72/255f,204/255f,1); |
||||
static Texture party_window = new Texture("interface/megamon_party.png"); |
||||
static Texture party_window_selection = new Texture("interface/megamon_party_selection.png"); |
||||
int selection = 0; |
||||
final static int MEGAMON_SLOT_SPACING = 140; |
||||
final static int WINDOW_MARGIN = 140; |
||||
int alpha=0; |
||||
final int ALPHA_SPD=4; |
||||
boolean alpha_dir=true; |
||||
|
||||
public MegamonPartyScreen() { |
||||
|
||||
} |
||||
|
||||
public void run() { |
||||
alpha+=(alpha_dir)?ALPHA_SPD:-ALPHA_SPD; |
||||
if (Math.abs(alpha)>=255) { |
||||
alpha_dir=!alpha_dir; |
||||
} |
||||
if (Gdx.input.isKeyJustPressed(Megamon.MOVELEFTKEY)) { |
||||
if (selection<3) { |
||||
selection = Math.floorMod(selection-1, 3); |
||||
} else { |
||||
selection = Math.floorMod(selection-4, 3)+3; |
||||
} |
||||
} |
||||
if (Gdx.input.isKeyJustPressed(Megamon.MOVERIGHTKEY)) { |
||||
if (selection<3) { |
||||
selection = Math.floorMod(selection+1, 3); |
||||
} else { |
||||
selection = Math.floorMod(selection-2, 3)+3; |
||||
} |
||||
} |
||||
if (Gdx.input.isKeyJustPressed(Megamon.MOVEUPKEY)) { |
||||
selection = Math.floorMod(selection-3, 6); |
||||
} |
||||
if (Gdx.input.isKeyJustPressed(Megamon.MOVEDOWNKEY)) { |
||||
selection = Math.floorMod(selection+3, 6); |
||||
} |
||||
if (Gdx.input.isKeyJustPressed(Megamon.CANCELKEY) || |
||||
Gdx.input.isKeyJustPressed(Megamon.MENUKEY)) { |
||||
Megamon.partyscreen=null; |
||||
return; |
||||
} |
||||
} |
||||
|
||||
public void draw(SpriteBatch batch) { |
||||
Gdx.gl.glClearColor(backgroundColor.r,backgroundColor.g,backgroundColor.b,backgroundColor.a); |
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); |
||||
int i=0; |
||||
batch.draw(party_window, 0, 0); |
||||
|
||||
batch.setColor(new Color(1,1,1,Math.abs(alpha)/255f)); |
||||
batch.draw(party_window_selection, |
||||
WINDOW_MARGIN + ((selection%3)*MEGAMON_SLOT_SPACING)-36, |
||||
(int)(Megamon.WINDOW_HEIGHT/(selection>2?1.9:1.1))-party_window_selection.getHeight()-32); |
||||
batch.setColor(new Color(1,1,1,1)); |
||||
for (MegamonPet mp : Megamon.mainP.getMegamonParty()) { |
||||
batch.draw( |
||||
mp.getCreature().getSprites().getMiniIcon(), |
||||
WINDOW_MARGIN+((i%3)*MEGAMON_SLOT_SPACING)+4,(int)(Megamon.WINDOW_HEIGHT/(i>2?1.9:1.1)-64)); |
||||
Megamon.font.draw(batch, "Lv", |
||||
WINDOW_MARGIN+((i%3)*MEGAMON_SLOT_SPACING),(int)(Megamon.WINDOW_HEIGHT/(i>2?1.9:1.1))- |
||||
16*2-40); |
||||
DialogBox.messageboxfont.draw(batch, Integer.toString(mp.getLevel()), |
||||
WINDOW_MARGIN+((i%3)*MEGAMON_SLOT_SPACING),(int)(Megamon.WINDOW_HEIGHT/(i>2?1.9:1.1))- |
||||
16*2-72,24,Align.center,false); |
||||
DialogBox.messageboxfont.draw(batch, mp.getHP()+"/"+mp.getMaxHP(), |
||||
WINDOW_MARGIN+((i%3)*MEGAMON_SLOT_SPACING),(int)(Megamon.WINDOW_HEIGHT/(i>2?1.9:1.1))- |
||||
16*2-96,24,Align.center,false); |
||||
if ((float)mp.getHP()/mp.getMaxHP()<0.3) { |
||||
batch.setColor(Color.RED); |
||||
} |
||||
batch.draw(Megamon.healthbar, |
||||
WINDOW_MARGIN+((i%3)*MEGAMON_SLOT_SPACING)+ |
||||
mp.getCreature().getSprites().getMiniIcon().getWidth()+32, |
||||
(int)(Megamon.WINDOW_HEIGHT/(i>2?1.9:1.1)-48-Megamon.healthbar.getHeight()), |
||||
0,0,Megamon.healthbar.getWidth(),Math.max(3,(int)(((float)mp.getHP()/mp.getMaxHP())*Megamon.healthbar.getHeight()))); |
||||
batch.setColor(Color.WHITE); |
||||
Megamon.font.draw(batch, mp.getNickname(), |
||||
WINDOW_MARGIN+((i%3)*MEGAMON_SLOT_SPACING)-24,(int)(Megamon.WINDOW_HEIGHT/(i>2?1.9:1.1)- |
||||
16*2-120),0,mp.getNickname().length(),100,Align.center,true,"..."); |
||||
i++; |
||||
} |
||||
} |
||||
} |
@ -1,21 +0,0 @@ |
||||
package sig.megamon.menu; |
||||
|
||||
public enum MenuItem { |
||||
MEGADEX("Megadex"), |
||||
MEGAMON("Megamon"), |
||||
BAG("Bag"), |
||||
TRAINER("<Trainer>"), |
||||
SAVE("Save"), |
||||
OPTIONS("Options"), |
||||
EXIT("Exit"); |
||||
|
||||
String displayName; |
||||
|
||||
MenuItem(String displayName) { |
||||
this.displayName = displayName; |
||||
} |
||||
|
||||
public String getDisplayText() { |
||||
return this.displayName; |
||||
} |
||||
} |
@ -1,77 +0,0 @@ |
||||
package sig.megamon.menu; |
||||
|
||||
import com.badlogic.gdx.Gdx; |
||||
import com.badlogic.gdx.graphics.Texture; |
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch; |
||||
|
||||
import sig.megamon.Megamon; |
||||
|
||||
public class StartMenuBox { |
||||
static Texture startmenu_background = new Texture("startmenu_box_middle.png"); |
||||
static Texture startmenu_background_bottom = new Texture("startmenu_box_bottom.png"); |
||||
static Texture startmenu_background_top = new Texture("startmenu_box.png"); |
||||
public static Texture startmenu_highlight = new Texture("startmenu_highlight.png"); |
||||
int selection=0; |
||||
MenuItem[] menuitems = MenuItem.values(); |
||||
int menuitem_spacing = 28; |
||||
|
||||
public StartMenuBox(int cursorStartingPosition) { |
||||
this.selection=cursorStartingPosition; |
||||
} |
||||
|
||||
public void run() { |
||||
if (Gdx.input.isKeyJustPressed(Megamon.MOVEUPKEY)) { |
||||
selection = Math.floorMod(selection-1, menuitems.length); |
||||
} |
||||
if (Gdx.input.isKeyJustPressed(Megamon.MOVEDOWNKEY)) { |
||||
selection = Math.floorMod(selection+1, menuitems.length); |
||||
} |
||||
if (Gdx.input.isKeyJustPressed(Megamon.MENUKEY)) { |
||||
Megamon.startmenubox=null; |
||||
return; |
||||
} |
||||
if (Gdx.input.isKeyJustPressed(Megamon.ACTIONKEY)) { |
||||
switch (menuitems[selection]) { |
||||
case MEGADEX: |
||||
Megamon.megadexscreen = new MegadexMenu(); |
||||
break; |
||||
case MEGAMON: |
||||
Megamon.partyscreen = new MegamonPartyScreen(); |
||||
break; |
||||
case BAG: |
||||
break; |
||||
case TRAINER: |
||||
break; |
||||
case OPTIONS: |
||||
break; |
||||
case SAVE: |
||||
break; |
||||
case EXIT: |
||||
Megamon.startmenubox = null; |
||||
break; |
||||
} |
||||
} |
||||
if (Gdx.input.isKeyJustPressed(Megamon.CANCELKEY)) { |
||||
Megamon.startmenubox=null; |
||||
} |
||||
} |
||||
|
||||
public void draw(SpriteBatch batch) { |
||||
int windowx = Megamon.WINDOW_WIDTH-startmenu_background_top.getWidth(); |
||||
int windowy = Megamon.WINDOW_HEIGHT-startmenu_background_top.getHeight(); |
||||
int spacingpixels = menuitem_spacing*menuitems.length-startmenu_background_bottom.getHeight(); |
||||
int menubot = windowy-spacingpixels; |
||||
batch.draw(startmenu_background_top, windowx,windowy); |
||||
batch.draw(startmenu_background, windowx, windowy-spacingpixels, 0,0,startmenu_background.getWidth(), |
||||
spacingpixels); |
||||
batch.draw(startmenu_background_bottom, windowx,menubot-startmenu_background_bottom.getHeight()); |
||||
int i=0; |
||||
for (MenuItem s : menuitems) { |
||||
if (i==selection) { |
||||
batch.draw(startmenu_highlight, windowx-4, windowy-((i+1)*menuitem_spacing)+8); |
||||
} |
||||
DialogBox.messageboxfont.draw(batch, s.getDisplayText(), windowx+28, windowy-(i++*menuitem_spacing)); |
||||
} |
||||
Megamon.font.draw(batch, ">", windowx+8, windowy-(selection*menuitem_spacing)+8); |
||||
} |
||||
} |
@ -1,7 +0,0 @@ |
||||
package sig.megamon.utils; |
||||
|
||||
public class TrainerUtils { |
||||
public static int getRandomTrainerID() { |
||||
return (int)(Math.random()*1000000); |
||||
} |
||||
} |