-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51b6173
commit 4fbf3a6
Showing
19 changed files
with
4,659 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package me.pieking.game.combat.attacks; | ||
|
||
import java.awt.BasicStroke; | ||
import java.awt.Graphics; | ||
import java.awt.Graphics2D; | ||
import java.awt.Point; | ||
import java.awt.Rectangle; | ||
import java.awt.Stroke; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import me.pieking.game.Rand; | ||
import me.pieking.game.Vars; | ||
import me.pieking.game.Vars.AttackType; | ||
import me.pieking.game.combat.Combat; | ||
|
||
public class AttackBlueAndOrange1 extends Attack{ | ||
|
||
public List<Integer> lines = new ArrayList<Integer>(); | ||
public List<AttackType> types = new ArrayList<AttackType>(); | ||
|
||
public AttackBlueAndOrange1() { | ||
|
||
prefferedTime = 300; | ||
prefferedUL= new Point(323 - 82, 260); | ||
prefferedBR = new Point(323 + 82, 400); | ||
|
||
int currMax = prefferedBR.x + 10; | ||
for(int i = 0; i < 5; i++){ | ||
currMax += Rand.range(40, 120); | ||
lines.add(currMax); | ||
types.add(Rand.getRand().nextBoolean() ? AttackType.BLUE : AttackType.ORANGE); | ||
} | ||
} | ||
|
||
@Override | ||
protected void tick() { | ||
for(int i = 0; i < lines.size(); i++){ | ||
|
||
int x = lines.get(i).intValue(); | ||
int y = Combat.currCombat.boxUL.y; | ||
int w = 1; | ||
int h = Combat.currCombat.boxBR.y - Combat.currCombat.boxUL.y; | ||
|
||
Rectangle r = new Rectangle(x, y, w, h); | ||
if(Combat.currCombat.soulCollides(r)){ | ||
//System.out.println("coll"); | ||
hitPlayer(types.get(i)); | ||
} | ||
|
||
lines.set(i, lines.get(i) - 2); | ||
} | ||
} | ||
|
||
@Override | ||
public void render(Graphics g) { | ||
|
||
Graphics2D g2d = (Graphics2D) g; | ||
Stroke str = g2d.getStroke(); | ||
g2d.setStroke(new BasicStroke(3f)); | ||
|
||
for(int i = 0; i < lines.size(); i++){ | ||
int x = lines.get(i).intValue(); | ||
AttackType t = types.get(i); | ||
if(t == AttackType.BLUE){ | ||
g.setColor(Vars.parseColor("\\L")); | ||
}else{ | ||
g.setColor(Vars.parseColor("\\O")); | ||
} | ||
g.drawLine(x, Combat.currCombat.boxUL.y, x, Combat.currCombat.boxBR.y); | ||
|
||
} | ||
|
||
g2d.setStroke(str); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.usfirst.frc.team871.robot; | ||
|
||
import edu.wpi.first.wpilibj.DigitalInput; | ||
|
||
public class DigitalInputActiveLow extends DigitalInput{ | ||
|
||
public DigitalInputActiveLow(int channel) { | ||
super(channel); | ||
// TODO Auto-generated constructor stub | ||
} | ||
|
||
@Override | ||
public boolean get(){ | ||
return !super.get(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package org.usfirst.frc.team871.robot; | ||
|
||
import edu.wpi.first.wpilibj.SpeedController; | ||
import edu.wpi.first.wpilibj.networktables.NetworkTable; | ||
|
||
public class Drive { | ||
|
||
private SpeedController driveL, driveR; | ||
|
||
public static final byte SIDE_L = 0; | ||
public static final byte SIDE_R = 1; | ||
public boolean enabled = false; //TODO: Check | ||
|
||
final NetworkTable dashboard = NetworkTable.getTable("SmartDashboard"); | ||
|
||
public Drive(SpeedController driveL, SpeedController driveR){ | ||
this.driveL = driveL; | ||
this.driveR = driveR; | ||
} | ||
|
||
/** | ||
* Side is 0 for left, 1 for right. Speed should be from -1 to +1. | ||
*/ | ||
public void driveMotor(byte side, double speed){ | ||
switch (side) { | ||
case SIDE_L: | ||
driveL.set(speed); | ||
break; | ||
|
||
case SIDE_R: | ||
driveR.set(speed); | ||
break; | ||
|
||
default: | ||
//Invalid Motor Side. | ||
break; | ||
} | ||
} | ||
|
||
/** | ||
* Drive both sides in one method. Speeds should be from -1 to +1. | ||
*/ | ||
public void driveBothMotors(double speedL, double speedR){ | ||
driveMotor(SIDE_L, speedL); | ||
|
||
driveMotor(SIDE_R, speedR); | ||
} | ||
|
||
/** | ||
* Returns the speed from -1 to +1 for the given side. | ||
*/ | ||
public double getSpeed(byte side){ | ||
double speed = 0; | ||
|
||
switch (side) { | ||
case SIDE_L: | ||
speed = driveL.get(); | ||
break; | ||
|
||
case SIDE_R: | ||
speed = driveR.get(); | ||
break; | ||
|
||
default: | ||
//Invalid Motor Side | ||
break; | ||
} | ||
|
||
return speed; | ||
} | ||
|
||
public void autoAim(){ | ||
// double centerOfMassX = dashboard.getNumber("centerOfMassX", 0.0); | ||
// | ||
// if(centerOfMassX > Vars.TARGET_CENTER_OF_MASS_X_UPPER_BOUND){ | ||
// driveBothMotors(-.1, .1);//TODO: direction | ||
// }else if(centerOfMassX < Vars.TARGET_CENTER_OF_MASS_X_LOWER_BOUND){ | ||
// driveBothMotors(.1, -.1);//TODO: direction | ||
// } | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
package me.pieking.game.item; | ||
|
||
import me.pieking.game.Game; | ||
import me.pieking.game.Utils; | ||
|
||
public class Item { | ||
|
||
public String fullName = Game.resourcePack.getString(227); | ||
public String shortName_reg = Game.resourcePack.getString(228); | ||
public String shortName_gen = Game.resourcePack.getString(228); | ||
|
||
public String desc = Game.resourcePack.getString(229); | ||
public String use = Game.resourcePack.getString(229); | ||
|
||
public int id = 0; | ||
|
||
public ItemType type = ItemType.UNKNOWN; | ||
|
||
public Item(int id, String fullName, String shortName_reg, | ||
String shortName_gen, String desc, String use){ | ||
this.fullName = fullName; | ||
this.shortName_reg = shortName_reg; | ||
this.shortName_gen = shortName_gen; | ||
this.desc = desc; | ||
this.type = ItemType.values()[id]; | ||
} | ||
|
||
public Item(ItemType type, String fullName, String shortName_reg, | ||
String shortName_gen, String desc, String use){ | ||
this.fullName = fullName; | ||
this.shortName_reg = shortName_reg; | ||
this.shortName_gen = shortName_gen; | ||
this.desc = desc; | ||
this.type = type; | ||
} | ||
|
||
public static Item getById(int parseInt) { | ||
|
||
Item ret = new ItemMonsterCandy(); | ||
|
||
ItemType it = ItemType.values()[parseInt]; | ||
|
||
String className = "me.pieking.game.item.Item" + Utils.toTitleCase( | ||
it.name().toLowerCase().replace("_", " ")).replace(" ", ""); | ||
|
||
//System.out.println(parseInt + " " + it + " " + className); | ||
|
||
Class<?> clazz; | ||
try { | ||
clazz = Class.forName(className); | ||
|
||
try { | ||
ret = (Item) clazz.newInstance(); | ||
} catch (InstantiationException | IllegalAccessException e) { | ||
Game.warn("Could not create instance for class " + | ||
className + " for item " + it + ". (" + e.getMessage() + ")"); | ||
} | ||
|
||
} catch (ClassNotFoundException e) { | ||
Game.warn("Class " + className + " for item " + | ||
it + " does not exist! (" + e.getMessage() + ")"); | ||
} | ||
|
||
return ret; | ||
} | ||
|
||
public enum ItemType{ | ||
UNKNOWN (0), | ||
MONSTER_CANDY (1), | ||
CORQUET_ROLL (2), | ||
STICK (3), | ||
BANDAGE (4), | ||
ROCK_CANDY (5), | ||
PUMPKIN_RINGS (6), | ||
SPIDER_DONUT (7), | ||
STOIC_ONION (8), | ||
GHOST_FRUIT (9), | ||
SPIDER_CIDER (10), | ||
BUTTERSCOTCH_PIE (11), | ||
FADED_RIBBON (12), | ||
TOY_KNIFE (13), | ||
TOUGH_GLOVE (14), | ||
MANLY_BANDANNA (15), | ||
SNOWMAN_PIECE (16), | ||
NICE_CREAM (17), | ||
PUPPYDOUGH_ICECREAM (18), | ||
BISICLE (19), | ||
UNISICLE (20), | ||
CINNAMON_BUN (21), | ||
TEMMIE_FLAKES (22), | ||
ABANDONED_QUICHE (23), | ||
OLD_TUTU (24), | ||
BALLET_SHOES (25), | ||
PUNCH_CARD (26), | ||
ANNOYING_DOG (27), | ||
DOG_SALAD (28), | ||
DOG_RESIDUE_0 (29), | ||
DOG_RESIDUE_1 (30), | ||
DOG_RESIDUE_2 (31), | ||
DOG_RESIDUE_3 (32), | ||
DOG_RESIDUE_4 (33), | ||
DOG_RESIDUE_5 (34), | ||
ASTRONAUT_FOOD (35), | ||
INSTANT_NOODLES (36), | ||
CRAB_APPLE (37), | ||
HOT_DOG (38), | ||
HOT_CAT (39), | ||
GLAMBURGER (40), | ||
SEA_TEA (41), | ||
STARFAIT (42), | ||
LEGENDARY_HERO (43), | ||
BUTTY_GLASSES (44), | ||
TORN_NOTEBOOK (45), | ||
STAINED_APRON (46), | ||
BURNT_PAN (47), | ||
COWBOY_HAT (48), | ||
EMPTY_GUN (49), | ||
HEART_LOCKET (50), | ||
WORN_DAGGER (51), | ||
REAL_KNIFE (52), | ||
THE_LOCKET (53), | ||
BAD_MEMORY (54), | ||
DREAM (55), | ||
UNDYNE_LETTER (56), | ||
UNDYNE_LETTER_EX (57), | ||
POPATO_CHISPS (58), | ||
JUNK_FOOD (59), | ||
MYSTERY_KEY (60), | ||
FACE_STEAK (61), | ||
HUSH_PUPPY (62), | ||
SNAIL_PIE (63), | ||
TEmy_arORMOr (64); | ||
|
||
public int id; | ||
|
||
ItemType(int id){ | ||
this.id = id; | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.