منتدى استراحات زايد

منتدى استراحات زايد (http://vb.ma7room.com/index.php)
-   منتدى أخبار المواقع والمنتديات العربية والأجنبية (http://vb.ma7room.com/forumdisplay.php?f=183)
-   -   كود لعبة الارقام داخل منتداك (http://vb.ma7room.com/showthread.php?t=2250342)

محروم.كوم 09-12-2017 03:11 AM

كود لعبة الارقام داخل منتداك
 
<div>


http://tw2.absba.org/teamwork21/MOH_...sm_Salam_1.gif

http://tw2.absba.org/teamwork21/MOH_...ba_Welcome.gif
http://tw2.absba.org/teamwork21/MOH_...Previews/1.png

اعضاء وزوار منتدانا الغالى المشاغب ..


كود لعبة الارقام



http://tw.absba.org/teamwork19/960533/50.png




طريقة التركيب

ضع هذا الكود حيث تريد ظهور اللعبة





http://tw.absba.org/teamwork19/960533/50.png
كود:



/*****************************************
* Translated By www.absba.com/
* Visit our site at http://www.absba.org/ for more code
* This notice must stay intact for use
***********************************************/

var max = 3;
var score = 0;
var moves = 0;
var ex = 3;
var ey = 3;

function getElement15(form, name) {
var k;
var elements = form.elements;
for (k = 0; k < elements.length; k++) {
if (elements[k].name == name) return elements[k];
}
}

function press15(form, button) {
name = button.name;
x = name.substring(0,1);
y = name.substring(2,3);
play15(form, (x-1+1), (y-1+1));
}

function shuffle15(form, num) {
for (i = 0; i < num; i++) {
x = Math.floor(Math.random(4) * 4);
if (x == 0) { toggle15(form, ex, ey, ex + 1, ey); }
else if (x == 1) { toggle15(form, ex, ey, ex - 1, ey); }
else if (x == 2) { toggle15(form, ex, ey, ex, ey + 1); }
else if (x == 3) { toggle15(form, ex, ey, ex, ey - 1); }
}
}

function play15(form, x, y) {
if (Math.abs(ex - x) + Math.abs(ey - y) == 1) {
done = toggle15(form, x, y, x+1, y);
if (!done) { done = toggle15(form, x, y, x-1, y); }
if (!done) { done = toggle15(form, x, y, x, y+1); }
if (!done) { done = toggle15(form, x, y, x, y-1); }
moves++;
if (check15(form)) {
alert('You win with ' + moves + ' moves!');
resetboard15(form);
}
}

}

function showrules15() {
rules = 'لعبة لوح الأرقام \n\n'
+ 'هدف اللعبة هو ترتيب \n'
+ 'الأرقام من 1 الى 15 بنفس \n'
+ 'الترتيب اللي ظاهر عندك ببداية اللعبة\n'
+ 'اضغط على خلط وابدأ اللعب\n'
+ 'وتفوز اذا رتبت كل الأرقام\n'
+ 'والمربع اللي يبقى فاضي بالأخير \n'
+ 'هو اللي بأسفل الزاوية اليمنى';
alert(rules);
}

function resetboard15(form) {
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
val = 1 + i + (4*j);
if (val == 16) {
getElement15(form,i + '_' + j).value = ' ';
} else {
getElement15(form,i + '_' + j).value = val;
}
}
}
score = 0;
moves = 0;
ex = 3;
ey = 3;
}

function toggle15(form, x, y, x1, y1) {
if (x < 0 || y < 0 || x > max || y > max) {
return false;
}
if (x1 < 0 || y1 < 0 || x1 > max || y1 > max) {
return false;
}

name = x + '_' + y;
button = getElement15(form,name);
name = x1 + '_' + y1;
button1 = getElement15(form,name);
if (button.value == ' ' || button1.value == ' ') {
tmp = button.value;
button.value = button1.value;
button1.value = tmp;
if (button.value == ' ') {
ex = x;
ey = y;
} else {
ex = x1;
ey = y1;
}
return true;
}
return false;
}

function check15(form) {
score = 0;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
val = 1 + i + (4*j);
if (val < 16) {
if (getElement15(form,i + '_' + j).value == val) {
score++;
}
}
}
}
return score == 15;
}















































احذف الفراغات بين كلمة "j a v a s c r i p t"


http://tw.absba.org/teamwork19/960533/32.png

http://tw2.absba.org/teamwork23/576788/absba50.gif


الساعة الآن 06:21 AM

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.5.2 TranZ By Almuhajir


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227