Feature request > 2D

Pixel Collision with Rotated Sprites

(1/2) > >>

Seems an obvious one to me but having SPRITE and ANIM COLL that works on the ROTATED sprite would be cool rather than based on the original sprite.

Ian Price:
It was suggested years ago.

There are work arounds, although none as smooth or as elegant as a built in rotation collision commands.

In one game I did (Balloonacy for Wiz, GP2X and pc) I drew my roto'd sprite in real-time onto a virtual sprite and used that for collision checking. Worked really well, even on a GP2X. I wouldn't recommend this for lots of roto-collsions though.

The alternative is to pre-render all rotations (if possible) - either as a spritesheet or at the start of the code.

Had already thought of pre-rendering as it's a technique I have used before sprite rotation was even quick enough on certain other languages :D However firstly don't like the memory overhead especially for a smooth rotation and secondly it should be in there. A real oversight to have roto commands and no roto related collision. Will have to continue making ball games lol.

Ian Price:
If you don't like pre-rendering then the virtual screen in real-time is the only option right now.

I've been noticing that a lot of commercial games don't use pixel-perfect collision detection.

It would be cool to have a new feature (or create a sprite library) that offers adding (multiple?) colliders to sprites.
The basic circular and rectangular colliders would probably be enough for most games.

For example, a typical car sprite, with a body and two wheels:  (total size is 128x64)

--- Code: (glbasic) ---car.AddCollider_Box(0,0,  128,32)   // Main body - top half of sprite
car.AddCollider_Circle(32,48, 16)   // Left Wheel, radius 16
car.AddCollider_Circle(96,48, 16)   // Right Wheel, radius 16
--- End code ---

And then have these colliders scale and rotate with the sprite.
Should be much faster and simpler to implement than pixel perfect sprite scaling and rotations.

Just a 'dream' request of course! 
One day I may create my own 2D sprite library, but not any time soon!


[0] Message Index

[#] Next page

Go to full version