View previous topic :: View next topic |
Author |
Message |
M.CORP Grandmaster Cheater Supreme Reputation: 28
Joined: 28 Oct 2009 Posts: 1010
|
Posted: Mon May 21, 2012 4:43 am Post subject: Bored. |
|
|
Made a random basic game out of javascript and html. Really crap, i know.
Code: | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Turn based Fighting Game</title>
</head>
<script>
var player1, player2;
var health = 1000;
var mhealth = 1000;
var log = "[OUTPUT LOG]";
var dmg, mDmg;
function initialise(){
alert("Game successfully loaded onto browser!");
player = prompt("What's Player 1's name?", "Player 1");
player2 = prompt("What's Player 2's name?", "Player 2");
alert ("Welcome, " + player + " and " + player2 + ", to THE SUPER AWESOME OMEGA GAME OF THE DECADE TURN-BASED RPG!!!!!");
document.getElementById("p1label").innerHTML = player + "'s HP";
document.getElementById("p2label").innerHTML = player2 + "'s HP: ";
}
function refreshHealth(){
document.getElementById("mons_health").value = mhealth;
document.getElementById("my_health").value = health;
document.getElementById("log").value = log;
document.getElementById("log").scrollTop = 99999;
if (health<0){
alert (player + " loses to " + player2 + "!!!");
alert (player2 + " wins!!!");
document.getElementById("attackm").disabled = "disabled";
}
if (mhealth<0){
alert(player2 + " loses to " + player + "!!!");
alert (player + " wins!!!");
document.getElementById("attackm").disabled = "disabled";
}
}
function attack(){
dmg = Math.floor(Math.random()*101);
mDmg = Math.floor(Math.random()*101);
mhealth = mhealth - dmg;
log = log + "\n" + player + " inflicted " + dmg + " to " + player2 + " but recieved " + mDmg + " damage.";
log = log + "\n" + player + " has " + health + " remaining.";
dmgMe();
refreshHealth();
}
function dmgMe(){
health = health - mDmg;
log = log + "\n" + player2 + " inflicted " + mDmg + " to " + player + " but recieved " + dmg + " damage.";
log = log + "\n" + player2 + " has " + mhealth + " remaining.";
}
function reset(){
health = 1000;
mhealth = 1000;
refreshHealth();
log = "[OUTPUT LOG]";
cls();
document.getElementById("attackm").disabled = false;
}
function cls(){
document.getElementById("log").value = "[OUTPUT LOG]";
}
</script>
<h1>RPG TURN BASED GAME</h1>
<body onload="initialise()">
<img src="http://beloudest.com/wp-content/uploads/2011/04/old-computer.jpg" height="100" width="100" style="position:absolute; left:300px"/>
<p><label id="p1label">Player1's HP</label><input type="text" id="my_health" value="1000" readonly="readonly"/></p>
<p><label id="p2label">Player2's HP</label><input type="text" id="mons_health" value="1000" readonly="readonly"/></p>
<p><input type="button" id="attackm" value="Attack" onclick="attack()" />
<input type="button" id="reset" value="RESET" onclick="reset()"/></p>
<!-- text field of log-->
<p><label>::Output::</label></p>
<textarea id="log" readonly="readonly" style="width: 500px; height: 100px;" >[OUTPUT LOG]</textarea>
<p><button id="cls" onclick="cls()">Clear Log</button></p>
</body>
</html> |
I might update it eventually and add more features to it. But for now, I'm too busy trying to get TF2 off from my system -_- (got really addicted to it, that's why i wasn't here).
_________________
|
|
Back to top |
|
|
Freiza Grandmaster Cheater Reputation: 22
Joined: 28 Jun 2010 Posts: 662
|
Posted: Tue Jun 12, 2012 6:02 am Post subject: |
|
|
Nice game.
_________________
|
|
Back to top |
|
|
Aecial Cheater Reputation: 2
Joined: 27 Jun 2012 Posts: 44
|
Posted: Mon Jul 02, 2012 1:45 am Post subject: |
|
|
I have no clue what compelled me to do this but I wrote a godmode hack for this (p1 and p2)
Only works in firefox (should be latest version) ie9 and chrome don't save the values in memory for some reason.
If addresses are displayed as ?? then reload it in firefox and attach again until the pointers work, as browsers tend to not like pointers
Description: |
|
Download |
Filename: |
firefox.CT |
Filesize: |
4.14 KB |
Downloaded: |
2363 Time(s) |
|
|
Back to top |
|
|
|