2026, 새로운 도약을 시작합니다.

심플버전 뽑기 게임

뽑기.png

심플버전 뽑기 게임 

= 심플버전입니다. 필요하신기능은 추가하시어 사용해보십시오 

[code]

<?php
include_once('../common.php');
if(!$is_member) alert('로그인 후 이용 가능합니다.');
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>100장 종이뽑기</title>
<!-- <link rel="stylesheet" href="game.css"> -->
<script src="<?php echo G5_JS_URL ?>/jquery-1.12.4.min.js"></script>
<style>
body{ background:#f2efe9; font-family:'Noto Sans KR',sans-serif; }
.paper100-wrap{
max-width:420px;
margin:40px auto;
background:#fff;
padding:20px;
border-radius:16px;
box-shadow:0 10px 30px rgba(0,0,0,.15);
text-align:center;
}
.paper-grid{
display:grid;
grid-template-columns:repeat(10,1fr);
gap:6px;
margin:20px 0;
}
.paper{
background:#fffdf8;
border:1px dashed #bbb;
border-radius:4px;
height:36px;
font-size:14px;
display:flex;
align-items:center;
justify-content:center;
cursor:pointer;
user-select:none;
}
.paper:hover{ background:#fff3d4; }
.paper.opening{ animation:tear .5s linear; }
.paper.opened{
background:#ffeaa7;
border:1px solid #f1c40f;
font-weight:bold;
}
@keyframes tear{
0%{ transform:scale(1); }
50%{ transform:scale(1.15) rotate(-3deg); }
100%{ transform:scale(1); }
}
.result{
margin-top:15px;
font-size:18px;
font-weight:bold;
}
</style>
</head>
<body>
<div class="paper100-wrap">
<h1>🧾 종이 뽑기 (100장)</h1>
<p class="desc">원하는 종이 하나를 선택해 뜯어보세요</p>


<div class="paper-grid">
<?php for($i=1;$i<=100;$i++){ ?>
<div class="paper" data-no="<?php echo $i; ?>">?</div>
<?php } ?>
</div>


<div id="result" class="result"></div>
</div>


<script>
let locked = false;
$('.paper').on('click', function(){
if(locked) return;
locked = true;


const el = $(this);
el.addClass('opening');


$.post('game_action.php', { paper_no: el.data('no') }, function(res){
setTimeout(function(){
el.removeClass('opening').addClass('opened').text(res.paper);
$('#result').html(res.msg);
}, 600);
}, 'json');
});
</script>
</body>
</html>

[/code]

game_action.php

[code]

<?php
include_once('../common.php');
header('Content-Type: application/json');


if(!$is_member) exit;


$use_point = 10;
if($member['mb_point'] < $use_point){
echo json_encode(['msg'=>'포인트 부족']);
exit;
}


insert_point($member['mb_id'], -$use_point, '100장 종이뽑기 참여');


// 확률 테이블 (총합 100)
$prob = [
['point'=>0, 'label'=>'꽝', 'rate'=>60],
['point'=>500, 'label'=>'500P', 'rate'=>25],
['point'=>1000, 'label'=>'1,000P','rate'=>10],
['point'=>5000, 'label'=>'5,000P','rate'=>5],
];


$rand = rand(1,100);
$sum = 0;
foreach($prob as $p){
$sum += $p['rate'];
if($rand <= $sum){
$win = $p;
break;
}
}


if($win['point'] > 0){
insert_point($member['mb_id'], $win['point'], '100장 종이뽑기 당첨');
}


echo json_encode([
'paper' => $win['label'],
'msg' => "<strong>{$win['label']}</strong> 당첨!"
]);

[/code]

버전 정보

테스트한 버전 5.4
호환 가능 버전 5.3이상

첨부파일

뽑기.png (23.5 KB)
0회 2025-12-14 22:25
game.zip (1.9 KB) 10회 2025-12-14 22:25
|

댓글 6개

감사 합니다.

감사합니다 ^^

감사합니다 

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

그누보드5 플러그인

그누보드 호환이거나 독립적으로 실행되는 플러그인을 소개합니다.
번호 제목 글쓴이 날짜 조회
678 어제 조회 115
677 5일 전 조회 361
676 5일 전 조회 197
675 1주 전 조회 309
674 1주 전 조회 221
673 1주 전 조회 213
672 2주 전 조회 454
671 2주 전 조회 269
670 3주 전 조회 389
669 3주 전 조회 273
668 3주 전 조회 267
667 3주 전 조회 419
🐛 버그신고