4
\$\begingroup\$

Ok so I'm trying to make a nice little RPG game in Java & Slick2D engine, the tiles are 16x16, so the collision array is also 16x16, how ever my character sprite is 16x20

What would be the best method of moving the character in relation to a 16x16 grid, also checking for collision?

\$\endgroup\$
2
  • \$\begingroup\$ How do you define "best method?" \$\endgroup\$ Apr 28, 2012 at 0:29
  • \$\begingroup\$ It depends on movement, does your character move by tiles? if sou then you probably want him to occupy just one tile (that tile that he has feet on, because why would you want to collide his head with something on ground) If he moves by pixels, then you probably want smaller rectangle then 16x16, because it would be stresful to go through narrow passages. (i noticed that you are using slick2d so if this questin is something engine specific, this probably is not an answer) \$\endgroup\$
    – Kikaimaru
    Apr 28, 2012 at 0:41

1 Answer 1

6
\$\begingroup\$

What you should do is keep characters separate from tiles, but in terms of placement, just have a position at like feet/bottom of the sprite and align that with the bottom edge of the tile. And for collision checking, you could use a rectangle intersection check based on maybe the bottom quarter of the player or the size of the tile even. Experiment

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .