Making Dice Game 2 Player ?

Nov 16, 2009

I'm trying to make a dice game, as well as making it two player. I need to be able to have a scoreboard displayed (eg. player 1 has won 7 times and player 2 has won 4) and I need to be able to prompt the user on if they want to play the game again.

So far I have the following:

I basically just tried duplicating the original function that adds up the 'dice'. But it doesn't work, I've tried playing around with if/else statements etc to get it to display messages and so fourth, but I have failed.

View 1 Replies


ADVERTISEMENT

Creating A Dice Game Where 6 Dice Are 'rolled' By You And 6 Dice Are 'rolled' By The Player

Nov 14, 2011

Create a game where 6 dice are 'rolled' by you and 6 dice are 'rolled' by the player (simulated by the click of a button). Add up both rolls. The goal is to come as close to a score of 100 as possible, without passing 100. Have a STOP button to signify when you are ready to stop rolling and compute the winner. The highest score under 100 wins. Display the number of times you win and the number of times the computer wins using javascript. So far I have the following code, however, my dice images are not working(they display as little broken symbols when I run the game). The game itself is running just fine but I can't figure out how to get the game to do the "Add up both rolls" step and beyond.

View 1 Replies View Related

Create A Dice Game ?

Apr 10, 2010

I am studying webdesign and we also go through a chapter of javascript-programming. Our first assignment is to create a dice game. I have written a code and in the beginning it worked, except that all the dices showed the same random number. I tried to fix that and now I do not know what I have done! In the game, you shall click on a link and the three dices will show random numbers.

Here is my code:

View 1 Replies View Related

Make A Doubled Dice Game ?

Dec 9, 2011

How to make a dice game for two player in javascript and html using just two dice?

1. Each player throws both dice once per turn. You only score if you throw doubles (that is, both dice have the same number of spots on their top face).

2. Players score five points for double ones, twos, fours or fives. A double six scores twenty five points, but if you throw a double three your score goes back to zero.

3. Add your score as you play. The first player to get fifty points wins the game. (An adult or older child may need to help score, but you can use this game to teach younger children to count by fives.)

View 3 Replies View Related

Update Amountleft On Dice Game Roll?

Jun 10, 2009

I am just about finished the dice game but am having trouble doing the calculation where if a player wins then they double their venture. I am not too sure how the game stores what the user picks in their venture 100 or 200.

I am already subtracting their venture from the total when they initially make their venture. But if they win then I need to add back the venture to the total by 2. Not too sure how to do this. Do I use a new function. How can I tell which button the user chooses 100 or 200 and then add on that amount.

[Code]...

View 6 Replies View Related

Dice Game - Show The Sums Of The Dices On The Screen

Nov 10, 2010

Developing a dice game. I'm totally new at this so a bit confused with the javascript language...

Anyways, heres my code:

So what i need help with is my pictures. They wont show. Firebug says: "document.getElementById("dice" + i) is null", and I have tried to solve that but with no progress...

Next step is to show the sums of the dices on the screen and also save this sums to be able to show them later on in an alert window... But that is for later, right now the dices needs to show the right (random) sides...

View 9 Replies View Related

Dice Game - Text Box For The First Number And Text Box For The Second

Nov 15, 2009

Im trying to make a dice game. how to get started n stuff. Something that will create a random number b/w 1 n 6 and decide if the user is a winner. He will win only if the #s are equal

So i want a text box for the first number and text box for the second. a button to click to play the game(roll the dice) button to start over and reset all values textbox to display the # of tries(rolls) textbox 2 display the # of wins. Also i want toKeep track of the number of times the user rolls the dice and display this in the appropriate textbox and the number of times the user wins the game and display this in the appropriate textbox.

Well my friend helped me with this but he made 2 player i only want one player and i want the number of tries and win the user wins if the #s are equal and i want a start over button that resets everything. Also the max number i want is 6 and only one roll the dice button but 2 textboxes so if you get same # you win it should appear in alert and text box for tries and wins. Also, i am gonna have 2 pics one for the first textbox the other for the second both of the pics are gonna be dice and i am gonna have 12 pics but only 2 appear at a time so if a guy gets 5 the dice with the #5 appears and the other text gets 4 the dice with the # 4 appears

<html>

View 26 Replies View Related

Dice Roller - Script That Will Roll Dice And Post The Results To The Page

Mar 7, 2011

Before I go on, I should state that I know little of Javascript - tried learning it once, but it was way over my head.

On to the problem: I found a script that will roll dice and post the results to the page. In my case, everything is working except for the fact it doesn't post the results.

Here is the dice roller: [url]

What it should be doing: [url]

I've sent a message to it's creator, but he hasn't responded yet. I'm not sure what exactly the problem is, so I won't post the page source here (it can get fairly long).

View 4 Replies View Related

Making A Game - Image Maps ?

Nov 8, 2011

I m making a game in javascript and i recently found out about image maps and i dont understand how they work very well. Pritty much when you would click a specific spot it would change the picture to a different image map?

View 9 Replies View Related

Making Online Game Web Site

Nov 1, 2009

I want to make a online game web site . i want to klnow , what do i need for now ? should i install any script?

View 3 Replies View Related

Making Query String In URL Work (trivia Game)

Jul 23, 2005

I encoded the action = of my form using GET and I can't seem
to get the property/value stuff from it using a JavaScript script I got from
the web.

I want to create a trivia game where the user gets 1 question at a time and
it keeps scoring until the end and gives a summary and I want to do it only
in JavaScript (no ASP, PHP, JSP, etc).

I tried submitting the quiz page to itself using a query string to keep
track of question # but no joy.

I can post code if necessary or is there a trivia game engine made for 1
question at a time instead of all on 1 page?

Anyway, I looked on Google at the query string issue til I'm sick of it. I
found a Beatles trivia game but it was using frames and hidden JavaScript
source files and that's too much work to try and figure out all of that.
Code:

View 2 Replies View Related

How To Make Browser Music Player/ Video Player

Apr 17, 2006

i am having trouble making an in browser ws to be able to put the songs on it by the way. Basically its supposed to be like winamp or w/e when you download it but instead i want it in a browser. The user should be able to just drag there files in and play.

View 1 Replies View Related

Make The Player Select Playing With The Computer Or Other Player And Select Who Player Beginning Playing?

Dec 29, 2010

i need code in javascript to make the player select playing with the computer or other player and select who player beginning playing

View 2 Replies View Related

Youtube Chromeless Player - Videos With An Id That Contains An Underscore Or Dash Don't Play Although They Play In The Normal Player

Dec 11, 2011

I am using the youtube chromeless player and embeding videos with loadVideoById() method problem is that videos with an id that contains an underscore or dash dont play although they play in the normal player. I also tried replacing with a hex value in querystring i.e (%5f) but that did not work I also tried loadVideoByUrl() method with several urls but still they don't load. here is my code

function switchToPlayer(ytid){
var params = { allowScriptAccess: "always"};
var atts = { id: ytid,onmouseover: "this.playVideo()",onmouseout: "this.pauseVideo()"};
swfobject.embedSWF("http://www.youtube.com/apiplayer?border=0&enablejsapi=1&playerapiid="+ytid, 'cell'+ytid, "150", "120", "8", "scripts/expressInstall.swf",null,params,atts);
}
[Code]....

View 4 Replies View Related

Conditionals Dice Rolls

Nov 5, 2004

I am having trouble creating a page that stimulates a large number of dice rolls and computes the average of the dice totals in an separate text box. Code:

View 1 Replies View Related

Showing History With A Dice Program

Mar 30, 2009

I'm making a dice program, that randomly draws x amount of times for x sided die. I decided to add on a "history" feature to this program--displaying the previous rolls (unlimited I imagine) and to show the math that comes from that equation. Everything works perfect except for the history function.

I've got a div area sectioned off with the id divhistory. At the end of the dice rolling program it calls function fhistory(z). Where z is the string that displays the random rolls and total (1 + 3 + 2 = 6).

Heres the code I've been fusing over. I imagine it's horribly off--but I'm also terrible with arrays it seems...

View 2 Replies View Related

Dice Roll Betting Calculator ?

Mar 28, 2009

Im currently taking some computer science courses in university and kind of enjoy this javascript stuff! im trying to figure out this final program...

Here is what is needed: Enhance the previous example, so the user can bet on the outcome of the roll, i.e. she can try to guess if the roll is going to be even or odd. If the user makes the right guess, she wins the amount of the bet, otherwise she loses the amount of the bet. The initial value of the wallet should be 100.

You should use 3 functions for this exercise. One function is executed when the user presses the button. The other functions (win and lose) are called by the first function when the user wins or loses.

This is the code i have so far. The "first function" was working perfectly. Now not only will the picture not show up when the "Roll!" button is pressed, but i cant figure out the even and odd assignments.

View 14 Replies View Related

Dice Roller - Passing - Rolling - Output ?

Oct 30, 2011

I am taking a JavaScript class and I am currently on an assignment where my Professor wants me to create a dice roller program with the following stipulations:

Now to the problems. I have set up to where it will take the form, pass it to my "sidecheck" function, but I do not think it is passing it to the Die() function to roll the die. As far as the output part of it to show roll totals and percentages, I am lost on that one.

Below is my code and what I have so far.

View 1 Replies View Related

Maths Game

Oct 3, 2003

Have a look at this maths game I made. It tests you on adding, subtracting, multiplying and dividing and has three different levels.

Note-you must save the code below as mathsgamefinal.htm for the reset button to work.


<html>



<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<meta http-equiv="Content-Language" content="en-gb">

<title></title>

</head>



<body bgcolor="#FF0000">



<script type="text/javascript">



function next1(){

var outof=document.getElementById('outof').value;

if(document.getElementById('next').value=="Next" && document.getElementById('type').value=="a"){document.getElementById('next').value='Enter' add(); document.getElementById('answer').value='answer'}
else if(document.getElementById('next').value=="Next" && document.getElementById('type').value=="m"){document.getElementById('next').value='Enter' times(); document.getElementById('answer').value='answer'}
else if(document.getElementById('next').value=="Next" && document.getElementById('type').value=="t"){document.getElementById('next').value='Enter' minus(); document.getElementById('answer').value='answer'}
else if(document.getElementById('next').value=="Next" && document.getElementById('type').value=="d"){document.getElementById('next').value='Enter' divide(); document.getElementById('answer').value='answer'}

else if(document.getElementById('next').value=="Enter" && document.getElementById('answer').value==(cr)){ document.getElementById('question').value='Correct' document.getElementById('next').value='Next' document.getElementById('outof').value=parseInt(document.getElementById('outof').value)+1; document.getElementById('score').value=parseInt(document.getElementById('score').value)+1; pc();}

else{ document.getElementById('question').value='Wrong. Answer= '+cr; document.getElementById('next').value='Next' document.getElementById('outof').value=parseInt(document.getElementById('outof').value)+1; pc();}

document.getElementById('answer').select();
}



function add(){
ea1=(Math.floor(Math.random() * (1 - 10)) + 10);
ea2=(Math.floor(Math.random() * (1 - 10)) + 10);
ma1=(Math.floor(Math.random() * (21 - 49)) + 49);
ma2=(Math.floor(Math.random() * (21 - 49)) + 49);
ha1=(Math.floor(Math.random() * (111 - 299)) + 299);
ha2=(Math.floor(Math.random() * (111 - 299)) + 299);

if(document.getElementById('level').value=="e"){document.getElementById('question').value=ea1+' plus '+ea2; cr=ea1+ea2}
if(document.getElementById('level').value=="m"){document.getElementById('question').value=ma1+' plus '+ma2; cr=ma1+ma2}
if(document.getElementById('level').value=="h"){document.getElementById('question').value=ha1+' plus '+ha2; cr=ha1+ha2}
}
function times(){
em1=(Math.floor(Math.random() * (2 - 10)) + 10);
em2=(Math.floor(Math.random() * (2 - 10)) + 10);
mm1=(Math.floor(Math.random() * (11 - 19)) + 19);
mm2=(Math.floor(Math.random() * (6 - 12)) + 12);
hm1=(Math.floor(Math.random() * (21 - 29)) + 29);
hm2=(Math.floor(Math.random() * (21 - 29)) + 29);

if(document.getElementById('level').value=="e"){document.getElementById('question').value=em1+' times '+em2; cr=em1*em2}
if(document.getElementById('level').value=="m"){document.getElementById('question').value=mm1+' times '+mm2; cr=mm1*mm2}
if(document.getElementById('level').value=="h"){document.getElementById('question').value=hm1+' times '+hm2; cr=hm1*hm2}


}

function minus(){
et1=(Math.floor(Math.random() * (10 - 20)) + 20);
et2=(Math.floor(Math.random() * (1 - 10)) + 10);
mt1=(Math.floor(Math.random() * (50 - 99)) + 99);
mt2=(Math.floor(Math.random() * (20 - 50)) + 50);
ht1=(Math.floor(Math.random() * (350 - 1000)) + 1000);
ht2=(Math.floor(Math.random() * (350 - 1000)) + 1000);

if(document.getElementById('level').value=="e"){document.getElementById('question').value=et1+' minus '+et2; cr=et1-et2}
if(document.getElementById('level').value=="m"){document.getElementById('question').value=mt1+' minus '+mt2; cr=mt1-mt2}
if(document.getElementById('level').value=="h"){document.getElementById('question').value=ht1+' minus '+ht2; cr=ht1-ht2}


}
function divide(){
ed1=(Math.floor(Math.random() * (2 - 10)) + 10);
ed2=(Math.floor(Math.random() * (2 - 10)) + 10);
md1=(Math.floor(Math.random() * (11 - 19)) + 19);
md2=(Math.floor(Math.random() * (11 - 19)) + 19);
hd1=(Math.floor(Math.random() * (21 - 29)) + 29);
hd2=(Math.floor(Math.random() * (21 - 29)) + 29);
ed3=ed1*ed2;
md3=md1*md2;
hd3=hd1*hd2;

if(document.getElementById('level').value=="e"){document.getElementById('question').value=ed3+' divided by '+ed2; cr=ed1}
if(document.getElementById('level').value=="m"){document.getElementById('question').value=md3+' divided by '+md2; cr=md1}
if(document.getElementById('level').value=="h"){document.getElementById('question').value=hd3+' divided by '+hd2; cr=hd1}
}


function answerreset(){
if(document.getElementById('answer').value=="answer"){document.getElementById('answer').value=''}
}

function pc(){
document.getElementById('scorepercent').value=document.getElementById('score').value/document.getElementById('outof').value*100;
document.getElementById('scorepercent').value=Math.round(document.getElementById('scorepercent').val ue);
}
</script>

<table border="0" width="198" height="180" bordercolor="#000000" style="background-color: #FFFF00; border-style: solid">

<tr>

<td height="33" width="99" colspan="2">

<p align="center">

<select size="1" name="type" id='type'>

<option value="a" selected>Add</option>

<option value="t">Take away</option>

<option value="m">Multiply</option>

<option value="d">Divide</option>

</select></p>

</td>

<td height="36" width="99" colspan="2">

<p align="center">

<select size="1" name="level" id=level>

<option value="e" selected>Easy</option>

<option value="m">Medium</option>

<option value="h">Hard</option>

</select></p>

</td>

</tr>

<tr>

<td height="36" width="198" colspan="4">

<p align="left">

<input type="button" name="T1" id='question' value="Click next to begin" style="background-color: #FFFF00; border: 0 solid #FFFF00">

</p>

</td>

</tr>

<tr>

<td height="33" width="66">

<p align="center"><input type="text" name="answer" size="6" id='answer' onclick=answerreset()></td>

<td height="36" width="66" colspan="2">

<p align="center"><button onclick='next1()' id='next'>Next</button></td>

<td height="33" width="66">

<p align="center"><button onclick='window.location="mathsgamefinal.htm"'>Reset</button></td>

</tr>

<tr>

<td height="36" width="66">

<p align="center">Score %:</td>

<td height="33" width="66" colspan="2">

<p align="center">Score Marks:</td>

<td height="33" width="66">

<p align="center">Out of:</td>

</tr>

<tr>

<td height="33" width="66">

<p align="center"><input type="button" name="T1" size="3" id=scorepercent value="0"></td>

<td height="33" width="66" colspan="2">

<p align="center"><input type="button" name="score" size="3" id=score value="0"></td>

<td height="36" width="66">

<p align="center"><input type="button" name="outof" size="3" id=outof value="0"></td>

</tr>
</table>
</body>
</html>



Any feedback would be much apprieciated...

View 6 Replies View Related

Javascript Game

Sep 25, 2006

I have been making a game in javascript. The game works now but I would like to know if the user has completed the game. Hope some one have an idea on how to find out if the user has completed the game. Code:

View 1 Replies View Related

The Caption Game

Feb 14, 2003

I am trying to get a line of text that a user types into a textfield to appear somewhere else on the screen. AT teh moment when the user presses submit it refreshes the page and does write the text line to the screen but it is a brand new page and I lose all my content.

View 11 Replies View Related

Card Game Javascript

Jul 20, 2005

Has anyone got a script to run a higher or lower card game on a web page.

View 1 Replies View Related

AJAX :: Create A Tic Tac Toe Game ?

Nov 18, 2009

I am trying to create a tic tac toe game using jQuery. In the game the player starts a game and when someone else does the same they can then play each other.

So far I am stuck for ideas as to how to construct the javascript. This is the javascript i have so far.

Code:

Should i use a plugin? I thought it would be easier..

View 2 Replies View Related

Way To Creat Puzzle Game

Jan 4, 2010

How to empty one of the cells and identify the adjacent cells (the ones with which the empty cell could swap on the first move.) code...

View 4 Replies View Related

Make A Game In Script?

Apr 26, 2010

I need a racing game in java graphics doesn't matter but speed should be good ?

View 2 Replies View Related

How Computer Know Whose Scored More In A Game?

Jun 25, 2011

I'm wanting to know how does the computer know whose scored more in a game?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved