What is Resistor for XBLIG?

The objective of Resistor is to build connections to carry electrical flow to activate LEDs (light emitting diodes). To avoid damaging these components, the flow level must be reduced using resistors. Each level is graded upon number of pieces used, the luminosity of the LEDs, and the time required to complete the level. This game teaches the basics of resistor color code values.

Each level has a power source with an electric flow level.  Use wires (A button) to connect this power source to all of the LEDs on the level.  Be careful to not connect a wire that has a higher electrical flow value than the number displayed on the LED, otherwise the LED will be destroyed and the game will end.  To lower the electrical flow, use a resistor (X button) to lower the electrical flow of the wire.  The target is to use a resistor that will lower the electrical flow just enough to activate the LED.  Lowering the electrical flow too much will still activate the LED, but the luminosity grade for the stage will be penalized.  After every ten levels, a new higher level resistor will be awarded.  The currently selected resistor can be changed using the bumper buttons (LB and RB).  Complete the levels as quickly as possible with the fewest number of pieces to get the best grade rankings.

http://www.youtube.com/watch?v=34Qp6-tC5CA

Graphical and Music Assets

screen069

I took a break from engine programming, and I started working on some of the graphical and audio aspects of the game.  I would like to have a small playable demo in the near future.  For now I am just using royalty free assets, but I would like to go back later and make my own custom art and music.  The font I used is called Ethnocentric, which was downloaded from 1001freefonts.com.  Be careful to read the license agreement for any font downloaded form this site, because not all give you permission to use the font for sale in commercial works.  However, most fonts allow inclusion in commercial works as long as the font is not modified or sold as a part of a font compilation.  The title background texture was acquired from CGTextures.com, which allow use of their textures as long as those are not sold as a part of a texture compilation and it is not used in an open source project.  For the background music, I used two songs from Kevin MacLeod’s incompetech site.  Again, I would like to make my own music in the future, but for now I will use those pieces which only require attribution in the credits screen.

Again, writing good code to play music can be more difficult than it looks.  When going from the game to a menu, I would like the music to change.  However, I don’t want to game music to start all over again when going back to the game.  I could just have the game music play through the menu at a lower volume.  One idea I had was to create a Song variable in the ResistorKit screen class, since usually one only song is associated with each Screen type.  I would just need to have methods to modify it, so that the music could be changed for each game screen.  Additionally, it would be nice to have a way for the music to fade from one song to another when changing areas in the game world.

I reworked some of the screen handling code to add the new credits screen.  One problem is that the “QUIT” state did not have a corresponding screen, so I made a dummy quit screen so that the game states are aligned with the game screens.  I can probably also use the quit screen to display information as the game is closing, such as “thank you for playing” or information on how to buy if the game is running in trial mode.

On the title screen, I went ahead and implemented a scrolling background.  This seems to be a running theme in my games.  I set the scroll rate to 8 pixels per frame, so it scrolls really quickly.  I may need to slow it down if it makes people dizzy.

On the game screen, I went ahead and updated the bounding box display code so that when the instance variable that controls its display is set to true, then the bounding boxes for all game objects (player, enemies, collectibles, projectiles) are displayed.  I also updated the graphic for the player’s projectile, using a supernova effect that I created with Gimp but I’m still not happy with it.

Equipment Menu

screen066

In the player class, I added instance variables to hold the equipped helmet, chest piece, gloves, and boots.  These start out as null, but I added logic to automatically equip one of those items if the equipment slot for it is null when an item for that slot is collected.  I also decided to go ahead and make separate lists for each item type, which will make looping those those lists much easier for the menu.  The collection code was updated to handle these items in the same way that weapons are collected, which adds each piece of armor to the appropriate list.  A method to calculate the total defense was also added, which is the sum of the defense values for each armor equipped.

I recreated almost all of the equipment menu, so that it now handles armor.  Now, the player must select the weapon or armor to replace it.  When selecting a piece of equipment, it will display a selectable list with all of the items that can replace it.

The Weapon and Armor classes were updated to accept a new parameter in the constructor, which is the number of socket slots for each item.  The player will not be able to equip more sockets than this value.  Unfortunately, since the socket for each item is implemented as List, I can only add the socket to the end of the list.  This means that it works in a stack fashion.  I believe I can insert an item into a list at a specific index, but I can’t insert null into the list.  Null signifies that a socket location is empty.  Alternatively, I could implement the Socket list as an array, but that will limit the maximum number of socketable abilities.  Pressing the action (X) button will bring up the list of socket abilities that can be equipped for the currently selected item.  For now, any socket can be equipped into any item.  I already have constants defined for the body location of each socket ability, so I will just need to modify the code to only display the sockets for the selected body location.  All acquired socket abilities are currently stored in one list, but I may want to make separate lists of sockets for each body location to make generating the menus simpler.

I have updated the ResistorKit menu to accept a texture image as part of a menu item.  Unfortunately, I didn’t have any way to access the texture array from the method where the equipment menu is created.

screen067

The player’s current attack and defense values are displayed below the character model.  When equipping an item, if the new value is greater than the current value, then the text is displayed in blue.  If the new value is lower, then the text is red.  If the value is the same, then the text is white.  Currently, all collected items for the selected slot are displayed, so the player’s equipped item for that slot is also displayed in the list.  Removing the currently equipped item would be a slight improvement for later, but will probably be a headache to keep the menu indexes straight since it is currently parallel with the list of acquired items for that body slot.  Alternatively, I could just remove the equipped item from the acquired list whenever it is equipped, which is probably the simplest solution.

screen068