Overflowz Posted December 10, 2015 Share Posted December 10, 2015 Hello there! This is my first post and hope I'm not writing to wrong section.Anyways, I'm writing some board game, which uses cards (e.g Hearthstone).I'll be honest that I'm not that good in Math (I know, you would ask then why I'm doing it. Well, just to learn). I'm using simple cards, but I would like to place it like in Hearthstone (like a "fan")Here's the sample: Cards at bottom are aligned with rotation and not straight. Can anyone give me a point or formula how can I solve that?Also forgive my English skills as well. If you don't understood anything, let me know! Regards Link to comment Share on other sites More sharing options...
dimumurray Posted December 10, 2015 Share Posted December 10, 2015 You could use the circle equations: x = radius * Cos(theta);y = radius * Sin(theta); Those will help you position the cards but you'll also need to orient them so that they are at the right angle.You can use the Math.atan2() function for that. Link to comment Share on other sites More sharing options...
Overflowz Posted December 11, 2015 Author Share Posted December 11, 2015 Hi! Thanks for reply!I'm drawing cards with simple function like:for (var i = 0; i < 5; i++){ var card = game.sprite.add(..);}but as I mentioned in above post, I'm not that good in Math, I know only basics. Can you please provide more details if you don't mind?Regards! Link to comment Share on other sites More sharing options...
Recommended Posts