Results 1 to 9 of 9

Thread: Collision and Spriteengine

  1. #1

    Collision and Spriteengine

    I've just started on a small breakout game to test out Phoenix and I'm a bit puzzled now.
    Phoenix has a pretty good collision engine using polygons, but the sprite engine doesn't make use of it as far as I can see. It just checks on bounding rects which it gets from the sprites given pattern.
    Why is that?
    I suppose I'll now have to mantain my own collisionengine as well now and make synced with the sprite engine, or have I overlooked something.
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

  2. #2

    Collision and Spriteengine

    I recall that i read somewhere that the sprite-engine was made similair to the delphix sprite engine, so you could easily port your project over to Phoenix. Delphix has no polygon collision checking so the sprite-engine hasn't it either

    Think you have to expand the sprite-engine or just write it from scratch. :?

    BTW: I remenber the TestCollision method that delphix had (think it was in the TSprite class).
    This was used to intergrate extra collision checking methods (other then bounding rect). It first checks the bouding rect, if the test passes "Testcollsion" is called, wich normally returns true until you override it in a TSprite descendant.

    You could add the extra polygon collsion there, maybe

    Hope to have helped you
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  3. #3

    Collision and Spriteengine

    OK - I'll take a closer look at it tomorrow.
    However I still think it's weird since one of the earlier releases of Phoenix used polygonal collision in the sprite engine as far as I remember.
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

  4. #4

    Collision and Spriteengine

    The collision engine and sprite engine isn't connected to make things easier (and faster). Just let you'r sprites have a collision object that you add to the collision engine and you're set.
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  5. #5

    Collision and Spriteengine

    I don't know if it's easier, but it's probably faster.

    OK I have added collisionobjects to my Sprites and it works fine. Now I'm wondering if there is an easy way to see which line of the collision polygon there has been a collision? It would be a nice an easy way to locate where exactly the collision happened.

    btw. I rendered the collision objects for debugging purposes and used the fill color clrNone. I may be wrong, but I thought that it would mean that my drawn objects only where outlined, but instead they had a white fill colour.
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

  6. #6

    Collision and Spriteengine

    clrNone is transparent, so by enabling blending or alpha testing they will be invisible.

    For the sprites i'm refering easy as in a design and extension point of view, not necessary user code

    I'm working on improving theese areas with quadtrees and other optimizations.
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  7. #7

    Collision and Spriteengine

    clrNone is transparent, so by enabling blending or alpha testing they will be invisible.
    Seems reasonable. Just assumed that blending was on by default.

    But there is no way right now in the collisionobjects that tell you were exactly the collision happened? If not it would be a nice feature in a future release. Sometimes it doesn't matter, but sometimes it's nice to know exactly where two objects collided.
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

  8. #8

    Collision and Spriteengine

    Quote Originally Posted by pstudio
    But there is no way right now in the collisionobjects that tell you were exactly the collision happened? If not it would be a nice feature in a future release. Sometimes it doesn't matter, but sometimes it's nice to know exactly where two objects collided.
    Sadly not, that is not as easy as it first may seem, i've spent alot of time getting that to work but without any satisfying results. Detecting the collisions is quite easy, getting the location, vectors and time of the collision is not that trivial...
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  9. #9

    Collision and Spriteengine

    Detecting the collisions is quite easy, getting the location, vectors and time of the collision is not that trivial...
    I know. That's why I hoped that it was already implemented

    Well, it's not that crucial for this small game, so I'm just gonna do without it.
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

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
  •  
Comodo SSL