Blog

Newest Post
Blog Archives
Blog Categories

Portfolio

3D Models
Banners
Brochures
Business Cards
Custom Programming
Environments
Flash Projects
Game Design
Image Altering
Web Design

About

Resume
Recommendation Letters

Contact

April 22, 2009

Learning C# for XNA

Filed under: General — admin @ 6:08 pm

I have decided to teach myself C# so I can create games using XNA. WOOT!

I have a good start and will hope I can develop a game for the XNA constest where I can hopefully win (with a lot of luck) and get a small game published.

:)

February 9, 2009

Format Phone Number Fields with PHP

Filed under: PHP, The Coding World — admin @ 1:39 pm

Below is a function I wrote to take a phone number entered by a user and convert it into a desired format. The one shown below is 555-555-5555.

function phn_numb($numb) {
if (!is_numeric(substr($numb, 0, 1)) && !is_numeric(substr($numb, 1, 1))) { return $numb; }
 
$chars = array(' ', '(', ')', '-', '.');
$numb = str_replace($chars, "", $numb);
if (strlen($numb) > 10) {
//you must dial "1" before dialing this number
$numb = substr($numb, 0, 1).'-'.substr($numb, 1, 3).'-'.substr($numb, 4, 3).'-'.substr($numb, 7, 4);
}
else
{
$numb = substr($numb, 0, 3).'-'.substr($numb, 3, 3).'-'.substr($numb, 5, 4);
}
 
return $numb;
}

Therefore to see it in action:

$phonenumber = 2345678901;
 
echo phn_num($phonenumber);
 
//the resulting echo would be 234-567-8901

November 28, 2008

The Epiphany Engine

Filed under: DE Games — admin @ 11:51 pm

After the creation (or rather the start) of Dragon Seed. I really like the coding that went into it. So I decided to build an online game engine that would let people create simple top down view games – just like the way I made the rough of Dragon Seed.

I went to work on the Epiphany Engine.

Some features:

  • General Settings
    • Customize starting health, mana, gold
    • Create character classes with starting attributes
  • Elements
    • Create your own elements
    • Manage your own elemental strengths and weaknesses
  • Magic
    • Upload an image to match the magic
    • Complete control over the stats and effects of the magic
    • Controlling condition type such as damage, healing, condition or hex
  • Items
    • Some thing as magic, complete control over effects, image, value, rarity
    • Allows customization of weapons, armors and shields as well
  • Maps
    • This will be top down view
    • Maps will be uploaded by the creator
    • These will be explorable by the four cardinal directions on a grid
  • Enemies
    • Fully customizable from elements, to items carried, to items dropped, attributes, spells

August 5, 2008

Javascript broke with multiple line variables from PHP

Filed under: JavaScript, PHP, The Coding World — admin @ 7:26 am

I have several sites where I use a pop up table to display information if the user rolls over and image. Example, if the user wants to view notes on a certain client, they can roll over a little “note” image to view the notes about the client pulled from a SQL database. The code I use for a message may be:

View Code JAVASCRIPT
note[0] = new Array("","<?php echo $message; ?>;");

That would work if $message was all one line. But as with all notes fields, you can never determine when the person entering data hits “Enter”. If the person did hit enter, your javascript would be broke and it would look like this in the source code.

View Code JAVASCRIPT
note[0] = new Array("","This is the start of the note field. I hit enter after this sentence twice.
 
Then I started typeing again");

This broke the Javascript. To fix this you can just swap the hidden special characters with a html line break.

Working code:

View Code JAVASCRIPT
note[0] = new Array("","<?php echo str_replace("\r\n","<br>;", $message); ?>;");

This would return:

View Code JAVASCRIPT
note[0] = new Array("","This is the start of the note field. I hit enter after this sentence twice<br><br>;Then I started typeing again");

July 18, 2008

Page Forwarding using Meta Tag

Filed under: The Coding World — admin @ 11:22 am

This code goes in the <Header> along with all other Meta info.

<meta http-equiv="REFRESH" content="0; url=page.php">

Creating a Pop Up Window with Javascript

Filed under: JavaScript, The Coding World — admin @ 10:37 am

Here is how to create a simple pop-up window using java script.

This will create a pop-up window on page load:
Place this javascript in the <head>  section of the webpage.

View Code JAVASCRIPT
onload = function () {
  PopUpURL    = "page.php";
  PopUpLeft   =  100;
  PopUpTop    =  100;
  PopUpWidth  =  600;
  PopUpHeight =  300;
   popO='left='+PopUpLeft+',top='+PopUpTop+',width='+PopUpWidth+',height='+PopUpHeight
  window.open(PopUpURL,'nrc',popO);
}

Here is how to create a Pop Up Window from a link:
Place the following code in the <head> section

View Code JAVASCRIPT
var newwindow;
function popup(url)
{
newwindow=window.open(url,'name','height=500,width=333');
if (window.focus) {newwindow.focus()}
}

This part goes in the link tag:

 <a href="javascript:popup('poppedexample.html');">Pop it</a>

July 1, 2008

Creating a perminent redirect in the .htaccess file

Filed under: .htaccess — admin @ 9:32 am

A search engine friendly way to redirect an old page to a new one is to add the following line in your .htaccess file.

“Redirect permanent /old-page.html http://www.newsite.com/new-page.html”

Direct the ErrorDocument 404 to a webpage

Filed under: .htaccess — admin @ 9:31 am

If you would like the “404 Webpage Not Found” error to redirect to another page on your website – just simply create (or edit) your .htaccess file. This file should be at the root level of your site’s directory where your root webpages are stored.

Add the following line: “ErrorDocument 404 /pagename.html”

May 23, 2008

PHP Dynamic Variables

Filed under: PHP, The Coding World — admin @ 9:21 am

Let’s say that you have a bunch of data in a recordset and you want to populate that data into a list of variables. In my example we will draw 20 items from a players inventory from a MySQL table which stores all the items for a player in rows we call “slot_1, slot_2, slot_3, … all the way to 20″. So when we pull all of the items from the MySQL table we want to assign them to variables respectively. For example, our variable of “slot_1″ that we are creating will equal “slot_1″ from the MySQL table.

//the recordset
 
mysql_select_db($database_connect, $connect);
$query_Recordset1 = sprintf("SELECT * FROM inventory WHERE player_id='$hero_id'");
$Recordset1 = mysql_query($query_Recordset1, $connect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
 
//Loop and assign the variables accordingly
 
$i=1; do {
${"slot_{$i}"} = $row_Recordset1['slot_'.$i];
$i++;} while ($i&lt;=20);

If we were to update the MySQL table with a dynamic variable, it would look like this.

 
$updateItemSQL = sprintf("UPDATE inventory SET slot_$slot=%s WHERE player_id='$hero_id'",
GetSQLValueString($new_item, "int"));

Merchant System and Guard Ability

Filed under: DE Games — admin @ 9:10 am

I have added a Merchant System and Guard Ability to the game now. The player can now purchase and sell items. If they player tries to sell a weapon, shield, magic, or armor that is the only one left in their inventory – a warning message will appear letting them know if they sell it it will be unequipped and removed from inventory.  This prevents the player from accidentally selling an item they have equipped.

The player will also have the option of buying any common weapons, shields, armors, or magics in the game. If they do not have enough money or if all their inventory is full the player is notified.

A guard option is now available in battle in case the players other commands are rendered useless. In example, if the player has no mana to cast a spell and their attackhas been rendered useless by a spell. The player can guard to boost their armor by 33% for that turn.

« Previous PageNext Page »
© - Digital Epiphany Designs, Online Portfolio for Web Design, Custom Programming, Grapic Design and Game Design.