Map Flipping and Tweaking Collision

http://www.youtube.com/watch?v=93qzG6ulogQ

Updated map flipping, fixed offset collision issue, added title safe overlay image.

More Bounds Checking

Noticed that the right bounds wasn’t symmetric with the left bounds.  I had 200 pixels for each bounds, but forgot that I needed to subtract off 48 for the right bounds to account for the player’s width.  This set the right bounds at a location that was not a multiple of 5 (1032 = 1280 – 200 – 48), which caused problems since the player’s walk speed is 5 pixels.  Thefore, when the player’s location and velocity passes the right bounds, then I have to calculate the difference between the bounds and the new location.  I set the player’s location to the right bounds, and add the difference to the level scroll offset.

The flipping between maps was working really well, but I forgot one case which is really noticeable when it happens.  I am only checking for map flips when the player is at either the left or right bounds.  However, it is possible for the player to backtrack and cross the boundary between rooms, when the boundary in the middle of the screen between the two bounds.  However, this is fairly simple to calculate.  If is between the two bounds, and the player’s X position is less than room offset, then flip back to the map on the left.  If the player’s position and the negative offset are greater than the room size, then flip back to the map on the right.

Title Safe Overlay

Found a nice PNG layover on the XBox Creators Club forums which shows the title safe area for a 1280×720 screen, which can just be drawn over the game screen, since the center of the image is transparent.

Collision Offset

Since the player falls at a rate of 5 pixels per update, there is a small problem when the user falls to the ground which may not be noticeable.  Since the tiles are not multiples of 5, then the calculation of the next fall frame may indicate a collision and the player should stop falling.  However, this will cause the player to stop at the multiple of 5, which may be a few pixels above the actual ground.  This is not really noticeable until the hit box is drawn around the player graphic.

This is also a problem when running into blocks, since the player runs at 5 pixels per update.  Turning up the run and jump speed to a higher value (like 20) makes this issue more noticeable.

 

   

To fix this, I went ahead and updated the player’s location to the block boundary in the collision method.  Originally, I just had the collision method return true or false, based on if they have collided with a block.  Updating the player’s location in the collision method probably isn’t the best programming style, but I really didn’t feel like calculating the number of offset pixels, making new variables, and passing out the number of offset pixels to the calling method which is bad style in itself.  Probably the most elegant solution would be to return a Vector (x, y pair) containing the number of offset pixels, or null if the player has not collided with any blocks.

 

Manifest Universe

Manifest Universe is a space trading game that I developed.  It simulates the gameplay of classic BBS DOOR games like Trade Wars 2002.  The player can land on planets and ports, loading resources into their ship.  Warp between the sectors and explore the entire universe!

This game was my first attempt at using SQLite as a data store for a video game.

 

Released

Mahjong Drop

Play online

 

Mahjong Drop is a game where you make melds (combinations) of three tiles to score. The three tiles must be together either horizontally or vertically.

Mahjong Drop uses a standard mahjong tile set, without the honor tiles. There are three suits (bamboo, wheel, and character) and each suit has a value from 1 to 9. There are four tiles for each suit/value combination. Once all tiles are used, a new bag of tiles is generated and shuffled and added to the queue of upcoming tiles.

There are two types of melds in Mahjong Drop.

Chi – Three tiles of the same suit in sequence of value, but the tiles don’t have to be in order.

  • Example: bamboo 3, bamboo 4, bamboo 5
  • Example: wheel 8, wheel 6, wheel 7

Pon – The same three tiles together.

  • Example: character 1, character 1, character 1
  • Example: bamboo 8, bamboo 8, bamboo 8

These are the configurable options in Mahjong Drop before starting the game

  • Columns (default 10) – The number of columns on the game board
  • Rows (default 14) – The number of rows on the game board
  • Highlight meld matches – If your current piece completes a meld on the board, then the matching pieces will flash
  • Colored tiles – Uses shades of red, green and blue to differentiate the three suits. Otherwise, all tiles will be white.
  • Preview Count – The number of upcoming tiles to display (0 through 5)
  • Show Guide – Shows a guide indicating where the tile will drop

The following objectives are tracked by the game. Can you get them all?

  • Chi 1 – create 1 chi meld
  • Chi 5 – create 5 chi melds
  • Chi 20 – create 20 chi melds
  • Pon 1 – create 1 pon meld
  • Pon 5 – create 5 pon melds
  • Total Tiles 25 – drop 25 total tiles on the board
  • Total Tiles 100 – drop 100 total tiles on the board

Tools Used

  • Unity 2019.2.8f1
  • Blender 2.80
  • Gimp 2.10
  • GarageBand 10.3.2
  • iPhone for taking photo of mahjong tiles (Yellow Mountain Imports) and curtain
  • Audacity 2.3.1
  • Bfxr 1.4.1

 

Released