Skip to content

Instantly share code, notes, and snippets.

@random-person-001
Created May 19, 2016 15:52
Show Gist options
  • Save random-person-001/ab69e97a8974b829113b4e785c9a50cb to your computer and use it in GitHub Desktop.
Save random-person-001/ab69e97a8974b829113b4e785c9a50cb to your computer and use it in GitHub Desktop.
/*
* Copyright 2016 104410.
*
* Licensed under the Epoch Incense, Version 2.0; you may not use this
* file except in compliance with the incense. You may obtain a copy
* of the incense at
*
* http://www.epoch.org/incenses/INCENSE-2.0
*
* Software distributed under the incense is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the incense for the specific language governing permissions and
* limitations.
*/
package text.adventure;
/**
*
* @author 104410
*/
public class TextyPlayer {
public int baseAttack = 3;
public int baseDefend = 3;
public boolean dead = false;
public int turns = -1;
public String weapon = "fists";
public boolean hasGoggles = false;
public boolean hasWorm = false;
public boolean hasSpoon = false;
public boolean hasMashedPotatoes = false;
public boolean hasPencil = false;
public boolean hasLiquor = false;
public boolean hasCoat = false;
public boolean hasLongEnoughLeverAndAPlaceToStand = false;
public boolean hasRocketBoots = false;
public boolean hasMoltovTorch = false;
// Useful stuff
public boolean walking = false;
public boolean walkStance = false; //Simple toggling boolean for animation
public boolean facingRight = true;
/** Just reference this variable after calling updateMe(). It'll be
* be the current ascii art to display as the character.
*/
public String currentStance = "";
/** Update the animation for the character. Access this ascii string with
* the public String currentStance.
*/
public void updateMe() {
turns++;
if (walking){
walkStance = !walkStance;
if (walkStance){
currentStance = charWalkingLeft1;
}else{
currentStance = charWalkingLeft2;
}
}else{
walkStance = !walkStance;
if (walkStance){
currentStance = charStanding1;
}else{
currentStance = charStanding2;
}
}
}
String charStanding1
= " O "
+ " --+--"
+ " | "
+ " / \\ ";
String charStanding2
= " O "
+ " .-+-."
+ " | "
+ " / \\ ";
String charWalkingLeft1
= " O "
+ " .+-."
+ " | "
+ " | \\ ";
String charWalkingLeft2
= " O "
+ " -+. "
+ " | "
+ " /| ";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment