New Revision for Bakerman Released

The Bakerman's Revenge Version 1.1.0 is now available for download.






Click Here if you want to see:
  How to animate sprites in Java.
How to track a mouse in Java.
How to find the dimensions of the user's screen in Java.
How to play sound in Java.
How this menu works.
What's making the gingerbread men move?
Church Presentation
Love my Hound Presentation
In My Heart Presentation
Ridgeback Rescue of the US
     

Games and Puzzles

Gomez GamesTM is an independent software development company. We produce and sell whatever comes to mind in whatever language seems appropriate.

Current focus is on producing unique, challenging games and diversions for people who enjoy puzzles that just aren't the same old thing.

The Java examples/scripts were written up because there didn't seem to be any one site with all the things that were needed to make the gingerbread men jump. There ought to be. If you like the examples, cool. If you get a lot of use out of them, send money :).
Java Examples 

Games and Puzzles

Gomez GamesTM is an independent software development company. We produce and sell whatever comes to mind in whatever language seems appropriate.

Current focus is on producing unique, challenging games and diversions for people who enjoy puzzles that just aren't the same old thing.

The Java examples/scripts were written up because there didn't seem to be any one site with all the things that were needed to make the gingerbread men jump. There ought to be. If you like the examples, cool. If you get a lot of use out of them, send money :).
Java Examples 

Java Examples - Animating Sprites

Issues with animation - Transparency

Getting rid of the background on a sprite is relatively easy, once you figure out it can't be done.

What you can do is: Use most any gif file editor, set the background of the gif transparent and the browser will take care of the rest.

I used the Animagic GIF editor from http://tucows.mundofree.com/win2k/preview/38319.html I'd give the company site, but I couldn't find any place to download it there.

Issues with animation - Movement

Movement is easy once you get past the whole z-index thing.

First you use different z-orders to put the sprites on a different layer of the page.

<div id="SPART">
  <!-- Main page here (stationary content). z-index defaults to 0 -->
</div>

<div id="MPART1" style="position:absolute; z-index:1;left:-64">
  <!-- First sprite here (moving content). z-index of 1 renders sprite on top of the stationary part of the page -->
  <img src="./Bakerman/Users Manual/Image Files/ReadMe_html_m4c82d2e7.gif" alt="" width="64" height="64" border="0">
</div>

<div id="MPART2" style="position:absolute; z-index:1;left:-64">
  <!-- Second sprite here (moving content). z-index of 1 renders sprite on top of the stationary part of the page -->
  <img src="./Bakerman/Users Manual/Image Files/ReadMe_html_5a4e5d9d.gif" alt="" width="64" height="64" border="0">
</div>

<div id="MPART3" style="position:absolute; z-index:1;left:-64">
  <!-- Third sprite here (moving content). z-index of 1 renders sprite on top of the stationary part of the page -->
  <img src="./Bakerman/Users Manual/Image Files/ReadMe_html_6a789f5b.gif" alt="" width="64" height="64" border="0">
</div>

Then you move the sprites relative to the background by moving the layer that they are on.

<!-- First we put the layers elements into an array to make them easier to handle -->
<script>
  var MImage = Array(3);
  MImage[1] = MPART1;
  MImage[2] = MPART2;
  MImage[3] = MPART3;

<!-- Then we initialize variables to hold the current X and Y positions of the layers-->
  var XLoop = 1;
  var MLeft = Array(3);
  var MTop = Array(3);
  for(XLoop=1;XLoop<=3;XLoop++){
    MLeft[XLoop] = Math.random()*128+64;
    MTop[XLoop] = Math.random()*128+64;
  }

<!-- Then we animate the sprites by setting up a function that executes off a timer -->
  function AnimateMain(){
    for(XLoop=1;XLoop<=3;XLoop++){
      MLeft[XLoop] += Math.random()*3-2;
      MTop[XLoop] += Math.random()*3-2;
      MImage[XLoop].style.left = MLeft[XLoop];<!-- This actually moves the sprite. -->
      MImage[XLoop].style.top = MTop[XLoop];<!-- Note .style.left and .top always read 0 -->
    }
    setTimeout('AnimateMain()',100);<!-- AnimateMain will retrigger itself in 100 milliseconds -->
  }

<!-- Then we trigger our function to execute the first time -->
  setTimeout('AnimateMain()',100);<!-- AnimateMain will trigger in 100 milliseconds -->
</script>

That wasn't too bad, was it?

Next Topic  Home

Java Examples - Mouse

Intercepting mouse events

You can read the mouse position whenever there is a mouse action (ie. onclick,onMouseMove,etc...). The mouse positions are properties of the event object. Depending on what browser is being used, different syntax is needed to read them accurately, or at all.

<!-- First we initialize variables to hold the mouse positions -->
<script>
  var MX=0;
  var MY=0;
  var cMX=0;
  var cMY=0;
</script>

<!-- Then we program the mouse events to capture and hold the mouse positions -->
<div id="SPART" onClick="
  if (document.all?true:false){  <!-- Test to see which browser syntax is valid -->
    MX = event.clientX + document.body.scrollLeft;
    MY = event.clientY + document.body.scrollTop;
  } else {
    MX = e.pageX;
    MY = e.pageY;
  }"
  onMouseMove="
  if (document.all?true:false) {  <!-- Test to see which browser syntax is valid -->
    cMX = event.clientX + document.body.scrollLeft;
    cMY = event.clientY + document.body.scrollTop;
  } else {
    cMX = e.pageX;
    cMY = e.pageY;
  }"
>  <!-- Note: This was a single DIV tag with a lot of in-line code -->

<!-- The cMX,xMY pair can now be used in any script as the last mouse position. -->
<!-- The MX,MY pair can be used for tracking the last clicked position. -->


Prev Topic  Next Topic  Home

Java Examples - Screen Dimensions

Calculating screen limits

Finding out how to get the limits of the screen seemed almost like a trade secret. It's actually pretty short and sweet.

<!-- It's best to run this function in the animation loop before anything else. -->

<script>
  function AnimateMain(){  <!-- This is the main animation loop for this page -->

    <!-- First, as always, we initialize the variables -->
    var windowwidth;
    var windowheight;
    var windowtop;
    var windowleft;
    var windowbottom;
    var windowright;

    <!-- Then we store the parameters using the correct syntax -->
    if (document.all?true:false) {  <!-- Test to see which browser syntax is valid -->
      windowleft = document.body.scrollLeft;
      windowtop = document.body.scrollTop;
      windowwidth = document.body.clientWidth;
      windowheight = document.body.clientHeight;
      windowright = windowleft+windowwidth;
      windowbottom = windowtop+windowheight;
    } else {
      windowleft = window.pageXOffset;
      windowtop = window.pageYOffset;
      windowwidth = window.innerWidth;
      windowheight = window.innerHeight;
      windowright = windowleft+windowwidth;
      windowbottom = windowtop+windowheight;
    }
</script>


Now the window variables can be used in any of the Java scripts to find the limits of the screen.

Prev Topic  Next Topic  Home

Java Examples - Sound

Adding sound to a web page

This method of generating sound seems to work with about 95% of the users.

<!-- First, set up the background sound tag to "sound" -->
<bgsound id="sound">

<!-- Then set up a function to play the wave file -->
<script>
  function PlaySound(url) {
    document.all.sound.src = url;
  }

  <!-- Then we execute the function to play the wave file -->
  PlaySound('./Bakerman/Audio Files/Wahoo.wav');
</script>


Nothing to it.

Prev Topic  Next Topic  Home

Java Examples - On the fly HTML changes

Making HTML dynamic

The innerHTML tag also seemed to be a trade secret. You can actually change the content of your page on the fly. Who knew?

<!-- First, set up a division with content to be exchanged -->

<div id="MainHeader">The content to be displayed initially is placed here.</div>

<!-- Then, set up some divisions to hold content for the different pages -->
<!-- Note: On the these divisions, The "z-index:-1" places them behind the main page. -->
<!-- Note: The "top:-1000" places them far enough above the page that they never show. -->

<div id="MainHeader0" style="position:absolute; z-index:-1;top=-1000>
  This is where the content is restored from
</div>

<div id="JavaHeader1" style="position:absolute; z-index:-1;top=-1000">
  This is the content of page 1
</div>

<div id="JavaHeader2" style="position:absolute; z-index:-1;top=-1000">
  This is the content of page 2
</div>

<div id="JavaHeader3" style="position:absolute; z-index:-1;top=-1000">
  This is the content of page 3
</div>

<!-- The following are used to navigate the pages of content -->

<span align="right" style="color:aqua; text-decoration: underline;" onClick="MainHeader.innerHTML=JavaHeader1.innerHTML">Prev Topic</span> 

<span align="right" style="color:aqua; text-decoration: underline;" onClick="MainHeader.innerHTML=JavaHeader3.innerHTML">Next Topic</span> 

<span align="right" style="color:aqua; text-decoration: underline;" onClick="MainHeader.innerHTML=MainHeader0.innerHTML">Home</span>

<!-- All this is doing is setting one division's innerHTML to another one's. -->

The effects of modifying this one property can be pretty dramatic.

Prev Topic  Home

Featured Games / Applications

The Bakerman's Revenge


Once upon a time,

There was a Bakerman...

Challenging and unique. An addictive pattern matching game with a slightly demented edge.

Race against time to help groups of animated gingerbread men escape being burned in the Bakerman's frying pan!

Try it out - You'll like it.

Click here to Download the Demo


Corelife -
The Linear Thinker's Nightmare

Dated DOS game, but still played by a few.

Challenging, 2D Corwar type game.

Pretty fun, but you'll need to be good at coding, corwars or both :)



Download the Demo
VDog
Stops applications. Intended to improve a game's performance by giving it access to all the PC's processing power.

Not Currently Available

Click Here to Register for $9.95
at BMTMicro's Secure Server


Registration opens hundreds more levels.

Registration enables networked, shared high score files for the truly competitive.

Registration allows high scoring players to rename levels. This is for folks that really like to tag their conquests.

Registration allows independents to keep writing.
Register for $9.95
at BMTMicro's Secure Server