-1

Hello recently i started to mess around with SDL. Since i was interested in some 2D/2.5D games.So i started messing around with SDL in C++, I was looking to recreate something similar to Original Zelda. So as far as i understand those game work with some kind of isometric prespective, or standard Orthogonal view but one thing i do not understand is how can you generate 3D-like Collisions between those objects on the map (tiles, sprites etc which are in 2D). Have a look at the video link below. Is this created purely in SDL, is it PerPixel collision or rectangular ? Or it might involve OpenGL as well ? Link: https://www.youtube.com/watch?v=wFvAByqAuk0

user2742982
  • 21
  • 2
  • 5
  • 3D-like collisions? What do you mean? Looks pretty 2D to me, as did the originial lttp. And how should we know anything about the engine of that game? – Benjamin Lindley Feb 10 '15 at 21:32
  • well his bush and tree collisions here : https://www.youtube.com/watch?v=K7TdIW6oYdg. How are they implemented ? I would like some in depth explanation by someone who is more experienced than me , so i can maybe grasp the idea. Thanks in advance :) – user2742982 Feb 10 '15 at 21:45
  • There is nothing isometric about original Zelda. It's 2D with tiles rendered in order to give depth feel. – Martin G Feb 12 '15 at 04:24

1 Answers1

0

The original was probably a simple Rectangular collision. I believe that your "3D collision" is the partial collision present in some objects. For example, Link can go through the leaves, but not through the trunk.

You can do it easily in 2 ways:

  1. Layers of rendering and collision. The trunk is located in one layer and is covered by some collision boxes. Link is present in a intermediary layer. And the leaves are in another layer, on top of Link. Then you can check collision between Link's Layer and the layer with the trunk and other objects, for example.
  2. Additionally you can create a property for your tiles in which you can store the type of collision you hope to obtain. For example, 'box' collision will tell your engine that the object is collidable on every side. Or 'bottom' collision will tell your engine that Link will collide with this object only if he is walking down into the object (this is the effect of you will see on some 2D sidescrollers: jump through a tile but then fall into it solid.

Per pixel collision in those simple cases is not worth it. I find it much better to personalize the collision ourselves, using creativity, masks and layers.

BTW: This topic would fit better on https://gamedev.stackexchange.com/

Community
  • 1
  • 1
gibertoni
  • 1,368
  • 12
  • 21