Re: [Algorithms] 2D Platform game problem:implementing cloud platforms
Brought to you by:
vexxed72
From: metanet s. <met...@ya...> - 2004-11-22 20:36:15
|
hi, the method i've used, which works quite well, is simply: -detect collision/intersection as you normally would (using swept tests or whatever) if(sprite collides with cloud platform) if([sprite's old position was above or equal to the platform's top edge] and [sprite is moving downward]) -sprite should "hit" the top of the platform (this must move the sprite's position to above or equal ot the platform's top edge) raigan in my case, the "sprites" were driven by a little physics sim, so their motion was a lot less well-behaved than normal platform sprites where you can set an upper and lwoer bound on movement. Alias <ali...@gm...> wrote: Hi guys, Wow, thanks for all your prompt and well reasoned responses. Yogiwp's reply made me realise I'd forgotten an important case: On Mon, 22 Nov 2004 20:20:23 +0700, yogiwp wrote: > For clouds: collision occurs anytime the ray intersects platform lines AND the ray direction is downward. There is one more case, which is to do with when the sprite reaches the top of its trajectory's parabola and decelerates to zero velocity: 5. When a sprite has penetrated a cloud object from underneath, without enough velocity to clear it completely, it will sometimes very briefly slow to a complete stop, to the point that its velocity on the up/down axis is exactly zero. In this case, it makes it difficult to determine on the next frame whether its previous direction is up or down, as it will technically not be moving. At this point, the checks based on previous velocity will fail. I hope that will help to illustrate the problem more completely. Thanks, Alias ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ GDAlgorithms-list mailing list GDA...@li... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=6188 --------------------------------- Post your free ad now! Yahoo! Canada Personals |