애니메이션 효과 문의.
숫자가 증가되는게.
슬롯머신 처럼 증가되는 코드 없을까요?
없다면 어떻게 만들어야 하는지 나오는 싸이트라도 알고 계시는분 링크좀 부탁드립니다.
댓글 4개
13년 전
슬롯머신 소스요
##############################################
<center>
<form name="slots" onsubmit="rollem(); return false;">
<table border="0" cellpadding="3" cellspacing="1" width="300" style="border:1 solid #000000;">
<tr>
<th colspan="2">슬롯머신 게임</th>
</tr>
<tr>
<th align="right"> Gold: </th>
<td align="left"><input type="box" size="5" name="gold" READONLY value="50"></td>
</tr>
<tr>
<th align="right"> Your bet: </th>
<td align="left"><input type="box" size="5" name="bet"></td>
</tr>
<tr>
<th><input type="submit" value="Spin the slots"></th>
<th><input type="button" value="I am done for now" onclick="stopplay();"></th>
</tr>
<tr>
<th colspan="2"><input type="reset" value="Start over"></th>
</tr>
<tr>
<td colspan="2"><hr></td>
</tr>
<tr>
<td colspan="2" align="center">
<img src="slot_1.gif" name="slot1">
<img src="slot_2.gif" name="slot2">
<img src="slot_3.gif" name="slot3">
<br>
<input type="text" readonly size="40" name="banner">
</td>
</tr>
<tr>
<td colspan="2"><hr></td>
</tr>
<tr>
<td colspan="2">
<table width="100%" border="0">
<tr>
<th colspan="3"><font size="4">Payouts</th>
</tr>
<tr>
<th> 3 of a Kind </th>
<td align="center"><img src="slot_1.gif"><img src="slot_1.gif"><img src="slot_1.gif"></td>
<th> 10x your bet </th>
</tr>
<tr>
<th> A Pair </th>
<td align="center"><img src="slot_2.gif"><img src="slot_2.gif"><img src="slot_3.gif"></td>
<th> 2x your bet </th>
</tr>
<tr>
<th> or </th>
<td align="center"><img src="slot_0.gif"><img src="slot_4.gif"><img src="slot_4.gif"></td>
<th> 2x your bet </th>
</tr>
<tr>
<th> or </th>
<td align="center"><img src="slot_5.gif"><img src="slot_6.gif"><img src="slot_5.gif"></td>
<th> 2x your bet </th>
</tr>
<tr>
<th> No Match </th>
<td align="center"><img src="slot_7.gif"><img src="slot_8.gif"><img src="slot_9.gif"></td>
<th> You lose </th>
</tr>
</table>
</td>
</tr>
</table>
</form>
</cetner>
<script language="javascript">
<!--
// 소스 제작자 coptright..
// 소스 사용시 이 부분은 지우면 안됩니다.
// ############# Copyright 2002, Patrick Lewis
// ############# www.PatrickLewis.net
// 게임에 사용되는 전체 이미지 갯수
slotitem = new Array('0','1','2','3','4','5','6','7','8','9');
document.slots.bet.focus();
startgold=50; // 시작 잔금 - 이 부분 수정 후 윗 부분 폼의 값도 수정
document.slots.gold.value=startgold;
function stopplay () {
if (document.slots.gold.value < startgold)
{alert("당신은 "+ (startgold-document.slots.gold.value) +" gold를 잃었습니다.");}
else {alert("당신은 "+ (document.slots.gold.value-startgold) +" gold를 획득했습니다.");}
}
function rollem () {
if (document.slots.bet.value<1 || document.slots.bet.value == "") {alert("베팅할 금액이 없습니다."); return;}
if (Math.floor(document.slots.gold.value) < Math.floor(document.slots.bet.value)) {alert("당신은 "+document.slots.bet.value+" gold를 베팅하여 잔금을 모두 잃었으며\n"+document.slots.gold.value+" gold의 잔금으론 게임 진행이 안되므로 새로 시작하여 주십시오."); return;}
if (document.slots.bet.value>1) {document.slots.banner.value="베팅 금액 "+document.slots.bet.value+" gold입니다.";}
else {document.slots.banner.value="베팅 금액 "+document.slots.bet.value+" gold입니다.";}
counter=0;
spinem();
}
function spinem() { // 슬롯 돌릴시 이미지 경로 부분
turns1=10+Math.floor((Math.random() * 10))
for (a=0;a<turns1;a++)
{document.slots.slot1.src="slot_"+slotitem[a % 9]+".gif"; }
turns2=10+Math.floor((Math.random() * 10))
for (b=0;b<turns2;b++)
{document.slots.slot2.src="slot_"+slotitem[b % 9]+".gif"; }
turns3=10+Math.floor((Math.random() * 10))
for (c=0;c<turns3;c++)
{document.slots.slot3.src="slot_"+slotitem[c % 9]+".gif"; }
counter++;
if (counter<25) {setTimeout("spinem(counter);",50);} else {checkmatch();}
}
function checkmatch() {
if ((document.slots.slot1.src == document.slots.slot2.src) && (document.slots.slot1.src == document.slots.slot3.src))
{document.slots.banner.value="3 of a Kind - 당신은 "+Math.floor(document.slots.bet.value*10)+" gold를 획득했습니다.";
document.slots.gold.value=Math.floor(document.slots.gold.value)+Math.floor(document.slots.bet.value*10); }
else if ((document.slots.slot1.src == document.slots.slot2.src) ||
(document.slots.slot1.src == document.slots.slot3.src) ||
(document.slots.slot2.src == document.slots.slot3.src))
{document.slots.banner.value="A Pair - 당신은 "+Math.floor(document.slots.bet.value*2)+" gold를 획득했습니다";
document.slots.gold.value = Math.floor(document.slots.bet.value*2) + Math.floor(document.slots.gold.value);}
else {document.slots.gold.value=document.slots.gold.value-document.slots.bet.value;
document.slots.banner.value="No Match - 당신은 "+document.slots.bet.value+" gold를 잃었습니다.";}
}
//-->
</script>
#################################################
##############################################
<center>
<form name="slots" onsubmit="rollem(); return false;">
<table border="0" cellpadding="3" cellspacing="1" width="300" style="border:1 solid #000000;">
<tr>
<th colspan="2">슬롯머신 게임</th>
</tr>
<tr>
<th align="right"> Gold: </th>
<td align="left"><input type="box" size="5" name="gold" READONLY value="50"></td>
</tr>
<tr>
<th align="right"> Your bet: </th>
<td align="left"><input type="box" size="5" name="bet"></td>
</tr>
<tr>
<th><input type="submit" value="Spin the slots"></th>
<th><input type="button" value="I am done for now" onclick="stopplay();"></th>
</tr>
<tr>
<th colspan="2"><input type="reset" value="Start over"></th>
</tr>
<tr>
<td colspan="2"><hr></td>
</tr>
<tr>
<td colspan="2" align="center">
<img src="slot_1.gif" name="slot1">
<img src="slot_2.gif" name="slot2">
<img src="slot_3.gif" name="slot3">
<br>
<input type="text" readonly size="40" name="banner">
</td>
</tr>
<tr>
<td colspan="2"><hr></td>
</tr>
<tr>
<td colspan="2">
<table width="100%" border="0">
<tr>
<th colspan="3"><font size="4">Payouts</th>
</tr>
<tr>
<th> 3 of a Kind </th>
<td align="center"><img src="slot_1.gif"><img src="slot_1.gif"><img src="slot_1.gif"></td>
<th> 10x your bet </th>
</tr>
<tr>
<th> A Pair </th>
<td align="center"><img src="slot_2.gif"><img src="slot_2.gif"><img src="slot_3.gif"></td>
<th> 2x your bet </th>
</tr>
<tr>
<th> or </th>
<td align="center"><img src="slot_0.gif"><img src="slot_4.gif"><img src="slot_4.gif"></td>
<th> 2x your bet </th>
</tr>
<tr>
<th> or </th>
<td align="center"><img src="slot_5.gif"><img src="slot_6.gif"><img src="slot_5.gif"></td>
<th> 2x your bet </th>
</tr>
<tr>
<th> No Match </th>
<td align="center"><img src="slot_7.gif"><img src="slot_8.gif"><img src="slot_9.gif"></td>
<th> You lose </th>
</tr>
</table>
</td>
</tr>
</table>
</form>
</cetner>
<script language="javascript">
<!--
// 소스 제작자 coptright..
// 소스 사용시 이 부분은 지우면 안됩니다.
// ############# Copyright 2002, Patrick Lewis
// ############# www.PatrickLewis.net
// 게임에 사용되는 전체 이미지 갯수
slotitem = new Array('0','1','2','3','4','5','6','7','8','9');
document.slots.bet.focus();
startgold=50; // 시작 잔금 - 이 부분 수정 후 윗 부분 폼의 값도 수정
document.slots.gold.value=startgold;
function stopplay () {
if (document.slots.gold.value < startgold)
{alert("당신은 "+ (startgold-document.slots.gold.value) +" gold를 잃었습니다.");}
else {alert("당신은 "+ (document.slots.gold.value-startgold) +" gold를 획득했습니다.");}
}
function rollem () {
if (document.slots.bet.value<1 || document.slots.bet.value == "") {alert("베팅할 금액이 없습니다."); return;}
if (Math.floor(document.slots.gold.value) < Math.floor(document.slots.bet.value)) {alert("당신은 "+document.slots.bet.value+" gold를 베팅하여 잔금을 모두 잃었으며\n"+document.slots.gold.value+" gold의 잔금으론 게임 진행이 안되므로 새로 시작하여 주십시오."); return;}
if (document.slots.bet.value>1) {document.slots.banner.value="베팅 금액 "+document.slots.bet.value+" gold입니다.";}
else {document.slots.banner.value="베팅 금액 "+document.slots.bet.value+" gold입니다.";}
counter=0;
spinem();
}
function spinem() { // 슬롯 돌릴시 이미지 경로 부분
turns1=10+Math.floor((Math.random() * 10))
for (a=0;a<turns1;a++)
{document.slots.slot1.src="slot_"+slotitem[a % 9]+".gif"; }
turns2=10+Math.floor((Math.random() * 10))
for (b=0;b<turns2;b++)
{document.slots.slot2.src="slot_"+slotitem[b % 9]+".gif"; }
turns3=10+Math.floor((Math.random() * 10))
for (c=0;c<turns3;c++)
{document.slots.slot3.src="slot_"+slotitem[c % 9]+".gif"; }
counter++;
if (counter<25) {setTimeout("spinem(counter);",50);} else {checkmatch();}
}
function checkmatch() {
if ((document.slots.slot1.src == document.slots.slot2.src) && (document.slots.slot1.src == document.slots.slot3.src))
{document.slots.banner.value="3 of a Kind - 당신은 "+Math.floor(document.slots.bet.value*10)+" gold를 획득했습니다.";
document.slots.gold.value=Math.floor(document.slots.gold.value)+Math.floor(document.slots.bet.value*10); }
else if ((document.slots.slot1.src == document.slots.slot2.src) ||
(document.slots.slot1.src == document.slots.slot3.src) ||
(document.slots.slot2.src == document.slots.slot3.src))
{document.slots.banner.value="A Pair - 당신은 "+Math.floor(document.slots.bet.value*2)+" gold를 획득했습니다";
document.slots.gold.value = Math.floor(document.slots.bet.value*2) + Math.floor(document.slots.gold.value);}
else {document.slots.gold.value=document.slots.gold.value-document.slots.bet.value;
document.slots.banner.value="No Match - 당신은 "+document.slots.bet.value+" gold를 잃었습니다.";}
}
//-->
</script>
#################################################
13년 전
http://www.blueb.co.kr/blueb/javascript.php?mid=8&r=view&uid=70056
게시판 목록
자유게시판
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 |
|
1주 전 | 10 | |
| 199718 |
|
1주 전 | 9 | |
| 199717 | 3주 전 | 21 | ||
| 199716 |
느긋한카키쿠키
|
3주 전 | 17 | |
| 199715 |
현대적인무질서한까마귀
|
3주 전 | 20 | |
| 199714 | 3주 전 | 24 | ||
| 199713 | 3주 전 | 33 | ||
| 199712 | 1개월 전 | 292 | ||
| 199711 |
안졸리니졸리니
|
1개월 전 | 144 | |
| 199710 |
|
1개월 전 | 160 | |
| 199709 |
|
1개월 전 | 91 | |
| 199708 | 1개월 전 | 106 | ||
| 199707 | 1개월 전 | 240 | ||
| 199706 | 1개월 전 | 41 | ||
| 199705 | 1개월 전 | 29 | ||
| 199704 | 1개월 전 | 46 | ||
| 199703 | 2개월 전 | 57 | ||
| 199702 | 2개월 전 | 97 | ||
| 199701 | 2개월 전 | 111 | ||
| 199700 | 2개월 전 | 83 | ||
| 199699 | 2개월 전 | 88 | ||
| 199698 | 2개월 전 | 134 | ||
| 199697 | 2개월 전 | 99 | ||
| 199696 |
|
2개월 전 | 245 | |
| 199695 | 2개월 전 | 89 | ||
| 199694 | 2개월 전 | 118 | ||
| 199693 | 2개월 전 | 185 | ||
| 199692 | 2개월 전 | 195 | ||
| 199691 |
|
2개월 전 | 170 | |
| 199690 | 2개월 전 | 257 | ||
| 199689 | 2개월 전 | 160 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기