Title: Game Code Development Area | |
friendsoffortiesfive > General > Games | Go to subcategory: |
Author | Content |
Zenith | |
Date Posted:02/05/2023 8:20 PMCopy HTML CONCEIVE, BELIEVE, ACHIEVE!
|
|
Niceguy2 | #801 |
Re:Game Code Development Area Date Posted:02/14/2024 4:49 AMCopy HTML Oops, did you mean to take turns? |
|
Zenith | #802 |
Re:Game Code Development Area Date Posted:02/14/2024 1:38 PMCopy HTML I took a regular game and Java-scripted it. If you see weird buttons, it's a demo, not a game. You're lucky you got a new page since the IDs clash with the previous page. That's why I put it in your MAILBOX! And you already said you didn't like jigsaws. I learned that I cannot run your code, but you can run mine since you are owner. Mike will not be able to work the demos!!! I cannot reset your post, but any reset will do all of my posts on the page CONCEIVE, BELIEVE, ACHIEVE!
|
|
Niceguy2 | #803 |
Re:Game Code Development Area Date Posted:02/15/2024 6:54 AMCopy HTML Oh, I see, said the blind man. Was wondering why you put it in my mailbox. Now I know! Interesting. |
|
Niceguy2 | #804 |
Re:Game Code Development Area Date Posted:02/15/2024 6:57 AMCopy HTML |
|
Zenith | #805 |
Re:Game Code Development Area Date Posted:02/16/2024 2:33 PMCopy HTML Mike could run demos if he knew how to change all the IDs. He could run them on his desktop without that if he knew about copying to BLANK.TXT and HTML. CONCEIVE, BELIEVE, ACHIEVE!
|
|
Zenith | #806 |
Re:Game Code Development Area Date Posted:02/16/2024 6:22 PMCopy HTML CONCEIVE, BELIEVE, ACHIEVE!
|
|
Zenith | #807 |
Re:Game Code Development Area Date Posted:02/16/2024 9:04 PMCopy HTML CONCEIVE, BELIEVE, ACHIEVE!
|
|
Niceguy2 | #808 |
Re:Game Code Development Area Date Posted:02/17/2024 4:22 AMCopy HTML Those are neat, Dave! What happened to V9? |
|
Zenith | #809 |
Re:Game Code Development Area Date Posted:02/17/2024 1:27 PMCopy HTML It only went around once. I replaced it with v10. Now I meed ideas for something else. |
|
Zenith | #810 |
Re:Game Code Development Area Date Posted:02/17/2024 2:07 PMCopy HTML Here's the code for V8 Please check if you can follow it. Read down the code SLOWLY. The IDs are the key. Their TDs are put into LISTS The Lists are lit up by FOR The colors are randomized The thing keeps running by setInterval(doLoops, 150); Now we get to the brains of it I count how many loops it does. I do an all-black at the top of every loop I look for the count and trigger off a certain list of lights.with each one ... if count is 2 then light up L3 list ... n.style.background=myColor; one-by-one ... n=L3[i]; ... very fast. if (count==2){for (i=0;i<L3.length;i++){n=L3[i];n.style.background=myColor;}} I reset the count to 0 and change color at 4 ...if (count==4){count=0;myRand();} More code here, but below is the main idea. ====================================== <td id="8TD7" style="width:100px; height:100px; background-color:white; border:5px solid #000099;"></td> <td id="8TD8" style="width:100px; height:100px; background-color:white; border:5px solid #000099;"></td> <td id="8TD9" style="width:100px; height:100px; background-color:white; border:5px solid #000099;"></td> </tr> </tbody> </table> </td> </tr> </tbody> </table><a href="javascript: var r; var myColor='yellow'; var t1_8 =document.getElementById('8TD1'); var t2_8 =document.getElementById('8TD2'); var t3_8 =document.getElementById('8TD3'); var t4_8 =document.getElementById('8TD4'); var t5_8 =document.getElementById('8TD5'); var t6_8 =document.getElementById('8TD6'); var t7_8 =document.getElementById('8TD7'); var t8_8 =document.getElementById('8TD8'); var t9_8 =document.getElementById('8TD9'); var noir=[t1_8,t2_8,t3_8,t4_8,t5_8,t6_8,t7_8,t8_8,t9_8]; var L1=[t1_8,t5_8,t9_8]; var L2=[t2_8,t5_8,t8_8]; var L3=[t3_8,t5_8,t7_8]; var L4=[t4_8,t5_8,t6_8]; /*called by internal*/ var lastColor; function myRand(){ var r=Math.floor(Math.random()*9)+1; if (r==1){myColor='red';} if (r==2){myColor='orange';} if (r==3){myColor='green';} if (r==4){myColor='blue';} if (r==5){myColor='magenta';} if (r==6){myColor='cyan';} if (r==7){myColor='gray';} if (r==8){myColor='white';} if (r==9){myColor='yellow';} if (myColor==lastColor){myRand();} lastColor=myColor; } /*end myRand*/ function init(){ var i; var n; var count=0; setInterval(doLoops, 150); function doLoops(){ count+=1; if (count==4){count=0;myRand();} for(i=0;i<noir.length;i++){n=noir[i];n.style.background='black';} if (count==0){for(i=0;i<L1.length;i++){n=L1[i];n.style.background=myColor;}} if (count==1){for(i=0;i<L2.length;i++){n=L2[i];n.style.background=myColor;}} if (count==2){for(i=0;i<L3.length;i++){n=L3[i];n.style.background=myColor;}} if (count==3){for(i=0;i<L4.length;i++){n=L4[i];n.style.background=myColor;}} } /*end doLoops */ } /*end init*/ "> <br/> <button style="padding:10px; color:white; font-weight:900; background-color:#0000cc; border:5px solid black;" onclick="init()">Click Twice</button> <button style="padding:10px; color:white; font-weight:900; background-color:#0000cc; border:5px solid black;" onclick="location.reload()">Reset</button></a> </div> CONCEIVE, BELIEVE, ACHIEVE!
|
|
Zenith | #811 |
Re:Game Code Development Area Date Posted:02/17/2024 3:21 PMCopy HTML |
|
Zenith | #812 |
Re:Game Code Development Area Date Posted:02/17/2024 7:35 PMCopy HTML Joe: Homework: Cococt a Javascript way to turn 0.876501 and 0.812373 into 8. You can look for help online. You can use them as var n=0.876501 and var m=0.812373 The answer routines can be in var eight_n; and var eight_m; CONCEIVE, BELIEVE, ACHIEVE!
|
|
Niceguy2 | #813 |
Re:Game Code Development Area Date Posted:02/18/2024 3:44 AMCopy HTML I wouldn't know where to even start. Sorry Dave. |
|
Zenith | #814 |
Re:Game Code Development Area Date Posted:02/18/2024 2:22 PMCopy HTML How about multiplying by 10 and dropping the decimal places. Search for: Javascript drop decimal places EDIT: =============================== How do you get rid of decimals in HTML?
|
|
Zenith | #815 |
Re:Game Code Development Area Date Posted:02/19/2024 2:23 PMCopy HTML You can copy and paste that code into BLANK.TXT and save as WHATEVER.HTM. Close Notepad and double click the HTM. You can write your own code in Notepad, and do the same to run it. If you have a code problem, push F12 while it is running, and select CONSOLE. It may give you some tips. When debugging, instead of alert('My check for ' + myvar); you can send it to the console without having to close the alert. Use console.log('My check for ' + myvar); myvar is a name specified by yourself, and is not a key word same as 'My check for ' is your own concoction. It's so you can see the results that some code is giving back to you during debugging, and in a longer code you may want to watch several different results. |
|
Niceguy2 | #816 |
Re:Game Code Development Area Date Posted:02/20/2024 3:16 AMCopy HTML |
|
Zenith | #817 |
Re:Game Code Development Area Date Posted:02/20/2024 1:07 PMCopy HTML =============================== <a href="javascript: var n = 0.876501; var eight_n = Math.floor(10 * n); alert('answer=' + eight_n); ">Click Here</a> =============================== Joe: Write a similar program for m using trunc. CONCEIVE, BELIEVE, ACHIEVE!
|
|
Zenith | #818 |
Re:Game Code Development Area Date Posted:02/20/2024 1:08 PMCopy HTML =============================== <a href="javascript: var n = 0.876501; var eight_n = Math.floor(10 * n); alert('answer=' + eight_n); ">Click Here</a> =============================== Joe: Write a similar program for m using trunc. Math.trunc() m=0.812373 Substitute new number and command for crossed out parts. Run it in your work area to check it. If you don't remember how to run it, I will go through all that stuff again. In fact, WRITE it in your work area in Notepad to start with. Save as HTM. |
|
Niceguy2 | #819 |
Re:Game Code Development Area Date Posted:02/21/2024 5:10 AMCopy HTML I wrote it in Notepad. Would only save it as a .txt file. I don't know wth I'm doing, anyway. |
|
Zenith | #820 |
Re:Game Code Development Area Date Posted:02/21/2024 2:20 PMCopy HTML Copy the code into here and run it. "SAVE AS" fudpucker.htm should have done it ============================================================================================ This is a lead-up to how to get a random number. The original rand() only gives numbers from 0 to 0.999999999 Say the rand() gave you 0.812373 We need that as 8, since you can't move 0.812373 blockers, for instance. In javascript YOU MUST DECLARE YOUR VARIABLES prior to or on first usage. That means telling JS you need a memory hole for one, or need a hole and put in a number. Like we don't know what will be in eight_m yet, so we just say var eight_m; but we do know what's in m, so we say var m = 0.876501;. Same as in School-Daze, A - 9=(10 + A)/5 or whatever, A is the variable, and we solve for A. It's a variable because every question has a different value for A. Here we set var m = 0.876501; We could set charlie_browns_favorite _number = 0.812373; but that is too unweildly. Multiplying m=0.812373 by 10 gets us in the ballpark, but let's give that variable a different name. var m2 = 10 * m; Solving (by the internal JS brain) gives us m2 = 8.12373 So what's left? Drop the decimal places.
|
|
Zenith | #821 |
Re:Game Code Development Area Date Posted:02/22/2024 3:26 PMCopy HTML I noticed ed doubles up posts sometimes when I edit. Short story: interchange m and n, and trunc and floor. You can also rename a file with right-click method after it is saved. =========== Shall we delete Quilting Bee since it is a piss-off to play under current conditions? |
|
Niceguy2 | #822 |
Re:Game Code Development Area Date Posted:02/23/2024 4:17 AMCopy HTML A former member used to have a heck of a lot of trouble with her posts duplicating, sometimes as many as four identical posts. It SO aggravated her! And me, because I was the one that had to delete the extras, lol.
What's wrong with Quilting Bee? I haven't noticed anything. |
|
Zenith | #823 |
Re:Game Code Development Area Date Posted:02/23/2024 1:15 PMCopy HTML Too much red! Hey, change red to cyan! |
|
Niceguy2 | #824 |
Re:Game Code Development Area Date Posted:02/24/2024 3:00 AMCopy HTML That's only because Mike insists on posting red every single time. You're welcome to make any changes you want. |
|
Zenith | #825 |
Re:Game Code Development Area Date Posted:02/24/2024 2:15 PMCopy HTML That's what 'current conditions' meant!
CONCEIVE, BELIEVE, ACHIEVE!
|