Joe the Box

Dual Platform

Found an article which provides an example of how to create a project that will run on both XBox and Windows.  It’s fairly simple, because all you need to do is right click the project in the Solution Explorer (the one with the XBox logo icon) and select Create Copy of Project for Windows.  The trick is that if you run Debug (F5) while an XBox is not connected, you will get an error about not being able to connect to the XBox.  Therefore, you just have to use Build Solution (F6) with x86 selected as the platform.  Then using Windows Explorer, dig down to the project > bin > x86 > Debug folder, and the Windows executable should be there.  A shortcut to this folder on the desktop will be helpful.  Of course, a wired USB Microsoft controller is required as the input device for the Windows build.  I’m not sure at this time if there is a simple way to get the project to run in debug mode for Windows.  Using the Windows build should dramatically speed up the development cycle time, because the XBox system does not have to be running and connected.

 

 


Moving Joe the Box

After about an hour of programming, I was able to get a simple cursor moving on the game board.  In the game level, I keep track of the current selected cell’s coordinates.  I have eight methods which can be called for the four directions (up, down, left, right) for pressed and released.  I determine if a direction is pressed or released (just on the D-pad for now) by comparing the current Game Pad state with the Game Pad state from the previous call to the update function.  If one of the button states have changed, then I call the appropriate method in the game level class.  Basically, I keep an x velocity and y velocity for the cursor, and those velocities are set when a directional button is pressed.  The actual selected cell value is updated by the velocity value, if the pause value I have defined is zero, then the pause value is set to a constant number of frames before the cursor is moved again.  Without the pause, the cursor will zip across the screen (move one cell for each frame).  If the pause value  is positive, then it will be decremented by one for each frame until it reaches zero again.

I have set a constant (32) for the cell size in pixels, and I set an x-y coordinate for the offset of the game board.  The cursor is just another tile for now, using a blue value for the third parameter when blitting the sprite.   The cursor is offset by the selected row times the cell size and the selected column times the cell size.

The update function also checks to ensure that applying the velocity value to the cursor doesn’t make the new cell value less than zero or greater than the number of rows or columns.  If that happens, then the cursor just retains the old position.  This keeps the selected cell from going off the game board.

[youtube=http://www.youtube.com/watch?v=Mb1B_GImIrs]

Jewel Swapper

Jewel Swapper
Play online

Jewel Swapper is short game that I developed as a warm-up.  I used the addon for Blender to generate the different jewel models.  Jewels will rotate when hovering over them.  There are four types of jewels, which are the red ruby, green emerald, purple diamond, and gold chalice.  I was able to build the game for my Nexus Android tablet.  I am hoping to develop this game further and publish it on the Google Play store.  Currently, swapping jewels will cause all adjacent matching jewels to disappear and new jewels will fall from the top to replace them.

 

 

Released

It’s Time for a Change

Bust Condition Handled

Added code to detect if an LED has busted, which makes the game transition to the GAMEOVER state.  Added a GameOverScreen class to handle the display of the game over state.  Need to determine if I should give a warning to the player if the wire connected to the light is higher than its bust value, and allow the player to put a resistor there before the light has filled to avoid losing the stage.  Currently, once the light starts filling it is locked to that value, which doesn’t give the player a chance to fix their mistake.

Will add a meter to the lower right corner to display the Elex flow value of the currently selected cell.

Time Variables Added

I was able to get the current game time using the TotalGameTime.TotalMilliseconds property of the GameTime object that is passed to the update method.  However, I had to update all the update methods of all classes that extend Screen to accept GameTime as a parameter.  Created three new instance variables to the GameLevel class for holding the level start time, the current time, and the end time.  The end time is now displayed on the game win screen.

Level Definition

Created LevelDefinition class to hold the definition of the layout of each level along with the requirements for each piece/time/luminosity rank.  Created arrays of size 3 for holding each grade threshold.  Index 0 is for the S rank, index 1 is for A rank, 2 is for B rank, and all greater values are assigned C rank.

Fixed the getPieceCount method that returns the Pieces Used end level statistic to not count the LED and battery pieces, but only wires and resistors.

Added methods to the LevelDefinition class to take a piece count, luminosity value, or time and it will return the grade rank for each of those values.  The grade ranks are now displayed on the game win screen.  Using yellow for S, blue for A, green for B, and red for C.

Just thought I would reiterate the fact that I’m trying to make a fun game that is as scientifically accurate as possible, instead of trying to make a scientific simulation as fun as possible.