Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: 2d-platforms game

  1. #11

    2d-platforms game

    Sorry Partoclus, not been able to find the time but I am here now. Anyway, I read your last message where you said that a bounding box would not be best and that your current method is causing you problems with diagonal movement. I thought this might cause you problems but I because I don't know exactly how you've coded it, it is hard to find a suitable solution. Could you explain in as much detail as possible how it is going wrong and I'll see if I can come up with an answer.
    Isometric game development blog http://isoenginedev.blogspot.com/

  2. #12

    2d-platforms game

    Glad to see you again

    Well, I already solved some problems and now I have a pretty good 45 A¬? diagonal platforms collision detection.
    Anyway, what I said in my last message is that I use 2 different methods for collision (for collsions between sprites I use a DelphiX/Omega function, hope you know this libraries). But I made my own method for platform collision. And I explained how I do this in the second point of my last message. I only wanted to know if it is a good way of doing it.

    Now I'm wondering how to "create" the enemy sprites. Create all of them at the begining of the level? or create them as they appear on the screen?

  3. #13

    2d-platforms game

    Hi

    I tried to build a pinball once, and I never made it because of the collisions problems. Sometimes the ball rolled fine, sometimes it went through walls... Now I've been thinking this more, but anyway, here is how I would do it now:

    The main ideas has already been discussed:
    - have a bounding rect for your sprite, or another shape like circle for a ball but it costs more time to calculate.
    - have a loop which tests whether you collided something or not.

    But for my pinball I had other problems:
    - walls can be VERY thin, thus allowing the ball to get through them very easily
    - walls can have random angles

    So I had to find maths formula. Actually I changed the loop system, and I replaced it with the calculation of the intersection between two segments: [AB], where A is the ball position before it moves, and B the ball position after it moved, and [CD] which is the segment symbolizing the wall.
    This can handle every angle and "go through" issue.

    But then you have to figure out what to do with the moving sprite, so as to prevent it from going through the wall, AND to prevent it from being stuck. This is done by stopping the sprite right before the collision, as with the loop method. It's not too hard to find this position if you know [AB] and P where P is the collision point.
    Then you need to modify the speed. It's hard, because it depends on the collision angle. For a platform game, you don't want the player to be stopped whenever he collides something, as he always collide the ground when walking.
    But I have no solution for these problems.

    It might be interesting to discuss this in a tutorial if you manage to use it. I realize that I don't really help here, I just highlight some possible collision problems
    DooM shall never die, only the players.

  4. #14

    2d-platforms game

    Thanks for your ideas
    Anyway, they don't fit my purposes.
    I'll try to get on and see what can I do.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •