Sliding Socket

Updated ResistorKit to detect LT and RT presses.  These triggers are different than other buttons, because they return a value representing how far the trigger is pulled, instead of an pressed/not pressed value like the other buttons.  It functions similarly to one axis of the thumbstick, by returning a float between 0.0 and 1.0.  Methods for trigger pressed and trigger released for both triggers were added to the RessitorKit screen class.  Therefore, I had to update all of the classes in the game to implement those four methods.  I also added a property in the ResistorKit menu to draw the text with a small drop shadow.

With the LT and RT now implemented, I was able to update the gun shoot code to allow the player to aim up and aim down.  When aiming up, the player will shoot their gun at a 45 degree angle upward in the direction that they are facing.  The same goes for aiming down, except that they are shooting at a 45 degree angle downward.  Holding both LT and RT will cause the player to shoot directly upward.  One issue that I’ve noticed is that if the player is standing next to a block  on the right and shoots upward, then the projectile will immediately collide with the block.  So to fix this I moved the starting position of the projectile to the center of the player horizontally.  Now shooting upward will not collide with blocks to the left or right.

For the Health sockets, I noticed that it was only using the lowest equipped health socket.    This is because the lowest health socket was being checked first in the if/else/elseif statement.  I reversed the order of the health socket check so now it looks for the highest socket first.  This also prevents stacking of the health sockets, but stacking could be implemented by keeping a counter of the sum of the values of the health sockets.  Ideally, there will be a  warning message that will prevent the player from equipping more than one health socket.  It would warn the player that any other health socket will be removed if a health socket is already equipped.

screen061

Added new sockets to the game, which are the sliding sockets.  The player can no longer slide by default, so they now have to equip one of the sliding sockets to get into areas only one block high.  The higher level sliding sockets will allow the player to slide longer.  There may be obstacles such as overhead spikes which will require the player to slide longer to pass.  The text next to the “A” display has also been update to not display if the player can not slide.

Noticed a few issues with some of the sockets.  The level 3 fire socket didn’t work properly, which was due to an incorrect socket ID used in the shoot gun code.  The radiant plus 4 socket didn’t work, because I had not added that level yet.  Also, the weapon list would not populate the first the the player goes to the equipment menu.  This is because the setPlayer method was being set after the activeScreen method is called on the Equipment screen.  Moving the setPlayer before fixed this problem, which ensures that the EquipmentScreen has a reference to the Player to access the Player’s weapons.