Jump to content

  • Log In with Google      Sign In   
  • Create Account


drharv

Member Since 15 Jun 2012
Offline Last Active Jun 21 2012 07:15 AM
-----

Topics I've Started

A couple of basic 2d tile questions

15 June 2012 - 08:23 AM

I have programmed business software for a while and have decided to try making a game. I get stuck a lot because I worry that I may not be doing something the "best" way. After searching, I am still stumped on the best way to solve the following 2 problems.

1) I have a randomly generated map. After the map is generated, I generate 2 arrays to keep track of spots where sides and corners should blend from 1 tile to another. While painting, I paint the background and then paint any transitions. The arrays store an offset to determine which transition to paint.

Posted Image

This works, but I hit a problem when transitioning and collision detection. You can see here that my guy is "floating" in sand because the actual tile at that location is water.

Posted Image

My only thought is to add padding to the collision detection when I am in a tile that has transitions. Is there some better way of handling the collision or even an easier way to handle the rounding/corners that I am missing?

2) Collision detection and paint depth on objects bigger than a single tile. I have trees that are 2 tiles high, and I'm sure I will have wider objects in the future. What is the best way to handle the paint depth and collision detection? Should I break it up into multiple tiles and only have part of them paint above the player paint depth and only part of them block in collision detection? This seems like the most straight forward answer, but it seems like a mess in the texture sheet. Right now I am using the second tree in the image shown here, but I am having a problem with painting above the player when he is behind the tree and below the player when he is in front of it.

Posted Image


I think I could solve both of these problems, but I don't want a bad solution that creates messy code to come back and haunt me later. Any suggestions or insight would be very helpful. I am really new to all of these concepts.

Thanks!

P.S. These graphics are just temp stuff that I found online. Not trying to steal anyone's work, just need something while learning to code.

PARTNERS