Content deleted Content added
|
|
|
=What I've Learned in Code Diving Class Today Is=
'' protected boolean isOwnerCallingMe() {
if (owner != null) {
String text = owner.get("text");
if (text != null) {
text = text.trim().toLowerCase();
// react on calling the '''pet's name'''
final String '''title = getTitle();'''
if ((title != null) && text.startsWith(title.trim().toLowerCase())) {
return true;
}
// react on calling the '''pet type''' ("cat", "sheep", ...)
final String type = get("type");
......
return false;
}''
'''A pet's player given name is referenced as title, while the species variable is type. (but then "species" is actually a reserved word for telling sheep (just sheep mind you) from every other pet.'''
Mission was to figure out what reference pet type/species was stored under.
Snipit from DomesticAnimals.java mission was to secure pet type variable.
player.getPet().getName());
'''Progress:''' Succeeded in getting a custom pet. Next comes the tricky part: writing a method that triggers a switch between to pets. Started in babyDragon.java but ended up writing a method in pet.java with the idea being to check that the pet is indeed a dragon type. '''Many syntax errors ensued'''. For now... sleep impedes my advance.
'''This will net the pet type/species not title. Huzzah! I'm learning. :)'''
==Pet System Ideas==
|