Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Draw chained rotated rectangles next to each other

$
0
0
Hi! I am developing a 2D game in Java where top-left corner is (0,0) and bottom-right is (max x, max y). I want to render rotated rectangles next to each other. Say I have the following image(rotation 0): If I wanted to draw an other one of this next to this one so that the green line connects(or "chains"), I would simply draw it at previous rectangle position + rectangle with. Easy. If it however was rotated, like this(30 degrees): Then I would somehow have to recalculate both the x and y coordinate. Not sure how to do this. Any help would be appropriated.

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>