RYL Forums


Forum Jump
Post New Thread  Reply
 
Thread Tools Search this Thread
Old 30-05-2013, 01:47 PM   #1
Hepherlump
can we please stop killing out probation workers
 
Hepherlump's Avatar
 
Join Date: Jul 2011
Location: USA
I am currently:
Reviews Requested- Safe - dragon slayer game

OK so i took a sample from a place where i was learning and expanded upon it, it isnt near to perfect, and doesnt do all i want it to, but heres were i am on it.

The following content has been hidden - Reason : long
var slaying = true;
var youHit = Math.floor(Math.random() * 2);
var dragonHit = Math.floor(Math.random () *2);
var playerDamage = Math.floor(Math.random() * 80 + 1);
var dragonDamage = Math.floor(Math.random() * 20 + 1);
var totalDamage = 0;
var playerHealth = 100;
var dragonHealth = 200;
var totalDragonDamage = 0;
if(playerHealth > 0 || dragonHealth >0){
slaying = true;
}
while(slaying) {


if((playerHealth && dragonHealth > 1) && (youHit) && (dragonHit)) {
console.log("you hit the dragon!");
console.log("the dragon hits you!")

totalDamage += playerDamage;
dragonHealth -= playerDamage;
totalDragonDamage += dragonDamage;
playerHealth -= dragonDamage;

if(totalDamage>=dragonHealth) {
console.log("Gratz you killed the dragon");
slaying = false;
}else if(totalDragonDamage > playerHealth) {
console.log("the dragon hath slain thee")
}else{
console.log("you only hit for" + playerDamage +"the dragon still has " + dragonHealth + " health the dragon hits you for " + dragonDamage + "you still have " + playerHealth + "health");
}
} else if((playerHealth && dragonHealth >1)&& (youHit) && (dragonHit= false)){
console.log("you hit the dragon and the dragon missed")

totalDamage += playerDamage;
dragonHealth -= playerDamage
if(totalDamage > dragonHealth) {
console.log("Gratz you killed the dragon");
slaying = false
}else if(totalDragonDamage > playerHealth) {
console.log("the dragon hath slain thee")
}else {
console.log("you only hit the dragon for" + playerDamage + " the dragon still has "+ dragonHealth + " health. you still have " + playerHealth + "health.")
}
}else if (playerHealth&&dragonHealth>1 && (youHit = false) && (dragonHit)) {
console.log("you have missed, but the dragon hit you")

totalDragonDamage += dragonDamage;
playerHealth -= dragonDamage;
if(totalDragonDamage > playerHealth) {
console.log("the dragon hath slain thee");
slaying = false
}else {
console.log("the dragon only hit you for" + dragonDamage+ "damage, you still have "+ playerHealth +" Health left.")
}
} if ( (playerHealth && dragonHealth>1) && ((youHit = false) && (dragonHit = false)) ){
console.log("you have both missed");
slaying = false

if(playerHealth > 0 || dragonHealth >0){
slaying = true;
}
slaying = false;
}

also i made a phone book too :)

The following content has been hidden - Reason : long

var bob = {
firstName: "Bob",
lastName: "Jones",
phoneNumber: "(650) 777-7777",
email: "bob.jones@example.com"
};

var mary = {
firstName: "Mary",
lastName: "Johnson",
phoneNumber: "(650) 888-8888",
email: "mary.johnson@example.com"
};

var contacts = [bob, mary];

function printPerson(person) {
console.log(person.firstName + " " + person.lastName);
}

function list() {
var contactsLength = contacts.length;
for (var i = 0; i < contactsLength; i++) {
printPerson(contacts[i]);
}
}

/*Create a search function
then call it passing "Jones"*/
function search(lastName){
var contactsLength = contacts.length;
for(var i = 0; i<contactsLength; i++) {
if(contacts[i].lastName === lastName ){
printPerson(contacts[i]);
}
}
}

function add(firstName, lastName,phoneNumber, email){
contacts[contacts.length] = {
firstName: firstName,
lastName: lastName,
phoneNumber: phoneNumber,
email: email

};
}
add("firstname", "lastname", "phonenumber", "email@example.com");

list(contacts)





I live in my own little world, but it's ok, they know me there.
i give up

Hepherlump is offline   Reply With Quote
Reply


Currently Active Members Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Censor is ON
Forum Jump


Sea Pink Aroma
All times are GMT +1. The time now is 10:54 PM.