OSdata.com |
Building a game open source code This is the actual source code from a new web game. See the game at thissideofsanity.com and read how this was built starting at example code.
This is example code from the SlamZee project and This Side of Sanity, released under Apache License 2.0.
Copyright 2013, 2014 Milo (for software), Distribution and website handled by Strazbick.com
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This narrative uses anchor links so that you can follow the building of this software in chronological order. Go to software explanation to start reading. Go to thissideofsanity.com to see the working software.
This is example code from the SlamZee project and This Side of Sanity, released under Apache License 2.0.
Started work on the flash sports pages.
The goal here is a self-contained flash sports feed.
This work is split off into its own set of example code for the time being.
The following is the basic skeleton code for the sports page.
<?php // include function files for this application require_once('../php/accounts.php'); require_once('../php/datavalidation.php'); require_once('../php/databasefunctions.php'); require_once('../php/newregistration.php'); require_once('../php/login.php'); /* SESSION MANAGEMENT */ SessionManagement(); /* located in accounts.php */ $accountemail = CheckValidUser(); /* located in accounts.php */ /* empty string if not signed in, or string holds the official account email */ ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html lang="en" dir="ltr"> <head><title>SlamZee Flash Sports</title> <meta HTTP-EQUIV="Content-Type" content="text/html; charset=ISO-8859-1"></meta> <meta name="revisit-after" content="15 days"></meta> <meta name="robots" content="all"></meta> <meta name="description" content="SlamZee -- Flash Sports."></meta> <meta name="keywords" content="SlamZee sports"></meta> <meta name="creation" content="2013-12-21"></meta> <meta name="last-modified" content="2013-12-21"></meta> <meta name="MSSmartTagsPreventParsing" content="TRUE"></meta> <link rel="stylesheet" type="text/css" href="../style.css"> <!--asdf CSS style--> <style type="text/css"> body { margin:0; padding:0; } </style> <!--asdf JavaScript--> <script type="text/javascript"> <!-- /* GLOBALS (property of window object) */ <!-- this javascript snippet draws the temptation box --> var temptationdelaytime = 6000; /* 6 second delay */ var intervalhandle; var hourcounter = 0; var minutecounter = 0; var secondcounter = 0; var tenthsecondcounter = 0; var hundredthsecondcounter = 0; function checktimedispatcher() { //document.getElementById("slamcounterelement").innerHTML= slamcounter; /* DEBUG */ var currentdate=new Date(); var currenttime= currentdate.toLocaleTimeString(); /*document.getElementById("timerelement").innerHTML= currenttime;*/ /* knocked out so that we look better - restore for debugging */ /* hundredthsecondcounter = hundredthsecondcounter +1; document.getElementById("hundredthelement").innerHTML= hundredthsecondcounter; if ( (hundredthsecondcounter%10) == 0 ) { tenthsecondcounter = tenthsecondcounter +1; document.getElementById("tenthelement").innerHTML= tenthsecondcounter; if ( (tenthsecondcounter%10) == 0) { secondcounter = secondcounter + 1; document.getElementById("secondelement").innerHTML= secondcounter; if ( (secondcounter%60) == 0) { minutecounter = minutecounter + 1; document.getElementById("minuteelement").innerHTML= minutecounter; if ( (minutecounter%60) == 0) { hourcounter = hourcounter + 1; document.getElementById("hourelement").innerHTML= hourcounter; } /* END hour check */ /* } /* END minute check */ /* } /* END second check */ /*} /* END tenth second check */ } /* END FUNCTION checktimedispatcher */ /*!--asdf on window load init--*/ //--> </script> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> </head> <!--asdf main HTML--> <body text="#ffffff" bgcolor="black" onload="intervalhandle=window.setInterval(function() {checktimedispatcher() },10);"> <div id="mainpage"> <h1 align="center">SlamZee Flash Sports</h1> <div id="gamecontent"> <h3 align="center"><a href="../game.php">play the game</a></h3> </div><!--gamecontent--> <?php /* check to see if an incoming new registration form and process as needed */ if ( $_GET['action'] == 'logout' ) { require_once('../php/logout.php'); echo '<div id="loginarea">'; ProcessLogOut(); $accountemail = CheckValidUser(); /* update this for later check */ /* located in accounts.php */ //echo '<br>the account sting is *'.$accountemail .'*<br>'; /* DEBUG */ echo '<p align="center">please play again soon!</p>'; echo '</div><!--loginarea-->'; DisplayLoginForm(); /* and show the login form */ } elseif ($accountemail != '') { echo '<div id="loginarea">'; echo '<p align="center">currently logged in as ',GetAccountNameFromAccountNumber(GetAccountNumberFromEmail($accountemail)),'<br>'; //echo '<br>the account sting is *'.$accountemail .'*<br>'; /* DEBUG */ echo '<a href="../index.php?action=logout">logout</a></p>'; echo '<h3 align="center" id="topstartgamearea"><a href="../game.php"><span style="color:white">start play now!</span></a></h3>'; echo '</div><!--loginarea-->'; } elseif ( $_GET['action'] == 'createaccount' ) { echo '<div id="loginarea">'; ProcessRegistrationForm(); $accountemail = CheckValidUser(); /* update this for later check */ /* located in accounts.php */ //echo '<br>the account sting is *'.$accountemail .'*<br>'; /* DEBUG */ echo '<p align="center"><a href="../index.php?action=logout">logout</a></p>'; echo '<h3 align="center"><a href="../game.php"><span style="color:white">start play now!</span></a></h3>'; echo '</div><!--loginarea-->'; } elseif ( $_GET['action'] == 'login' ) { echo '<div id="loginarea">'; ProcessLoginForm(); $accountemail = CheckValidUser(); /* update this for later check */ /* located in accounts.php */ //echo '<br>the account sting is *'.$accountemail .'*<br>'; /* DEBUG */ echo '<p align="center"><a href="../index.php?action=logout">logout</a></p>'; echo '<h3 align="center"><a href="../game.php"><span style="color:white">start play now!</span></a></h3>'; echo '</div><!--loginarea-->'; } else { DisplayLoginForm(); /* default to showing a login form */ //echo '<br>the account sting is *'.$accountemail .'*<br>'; /* DEBUG */ echo '<p align="center">login to play now!<br>or sign up for free!</p>'; } ?> </div><!--mainpage--> </body> </html>
See code at team.php.
See code at teamfunctions.php.
This is the code for the team directory. I am just showing the start. Additional team entries of the same kind are implied.
<!--hard coded index--> <h3 align="center">college teams</h3> <ul> <li><a href="./team.php?team=1">Alabama Crimson Tide</a></li> <li><a href="./team.php?team=5">Florida Gators</a></li> <li><a href="./team.php?team=12">Florida St Seminoles</a></li> <li><a href="./team.php?team=4">Georgia Bulldogs</a></li> <li><a href="./team.php?team=7">LSU Tigers</a></li> <li><a href="./team.php?team=14">Michigan Wolverines</a></li> <li><a href="./team.php?team=2">Ohio State Buckeyes</a></li> <li><a href="./team.php?team=8">Oklahoma Sooners</a></li> <li><a href="./team.php?team=3">Oregon Ducks</a></li> <li><a href="./team.php?team=11">Penn St Nittany Lions</a></li> <li><a href="./team.php?team=6">Texas Longhorns</a></li> <li><a href="./team.php?team=9">Texas A&M Aggies</a></li> <li><a href="./team.php?team=13">USC Trojans</a></li> <li><a href="./team.php?team=10">Washington Huskies</a></li> </ul>
Add a function to give bowl game information.
See code at team.php.
See code at teamfunctions.php.
OSdata.com is used in more than 300 colleges and universities around the worldFind out how to get similar high web traffic and search engine placement. |
OSdata.com is used in more than 300 colleges and universities around the world |
Tweets by @osdata |
A web site on dozens of operating systems simply cant be maintained by one person. This is a cooperative effort. If you spot an error in fact, grammar, syntax, or spelling, or a broken link, or have additional information, commentary, or constructive criticism, please e-mail Milo. If you have any extra copies of docs, manuals, or other materials that can assist in accuracy and completeness, please send them to Milo, PO Box 1361, Tustin, CA, USA, 92781.
Click here for our privacy policy.
previous page | next page |
This web site handcrafted on Macintosh computers using Tom Benders Tex-Edit Plus and served using FreeBSD .
Names and logos of various OSs are trademarks of their respective owners.
Copyright © 2013 Milo
Last Updated: December 26, 2013
Created: December 21, 2013
previous page | next page |