Purple is a tiled sprite. It gets the angle and distance from the center to the top left corner and puts it in angle and distance . It gets the x, y from the center and then uses x, y to calculate x1 and y1. Drawing a circle in both positions.
I tested it with a slider. Oh, distance1 is the width. Im assuming the width changes as it rotates.
Edit 2: you could probably get the angle and dist to both corners like for the first instead if the 2nd from the first. . It might even be a mirrored angle. IDK. I’m assuming the distance is the same to each corner.
Last edit. Calculating the distance once and the angle between the other 2 corners would be simplier.
I need it for minimap (i gonna make template out of it then try to turn it into extension)
I can’t expect any1 to create new object for each layer (layers in minimap display various stuff like on one layer you put all platforms on other enemies on another your player and so go on)
And i can’t use Object.PointX(“blablabla”)
Since it only works in change position action
And when i try to use it as expression either in text object or as coordinates for draw something with shape painter
It gives me error that it can’t find expression PointX
If the rectangle is already rotated by an angle θ:
- (x, y) as the center point of the rotated rectangle
- w and h are the width and height (they stay the same after rotation)
- θ is the rotation angle in radians
The corner points will be:
bottom-left: x - (w/2)*cos(angleRads) - (h/2)*sin(angleRads), y - (w/2)*sin(angleRads) + (h/2)*cos(angleRads)
bottom-left: x + (w/2)*cos(angleRads) - (h/2)*sin(angleRads), y + (w/2)*sin(angleRads) + (h/2)*cos(angleRads)
top-left: x - (w/2)*cos(angleRads) + (h/2)*sin(angleRads), y - (w/2)*sin(angleRads) - (h/2)*cos(angleRads)
top-right: x + (w/2)*cos(angleRads) + (h/2)*sin(angleRads), y + (w/2)*sin(angleRads) - (h/2)*cos(angleRads)
- x, y is center point
- w, h are width and height
- angleRads is the rotation angle in radians
It can probably be simplified by make w and h as the values of w/2 and h/2
Would the Sprite Snapshot extension be of any use to what you are doing? Could you use that to take a snapshot of the scene (or part of it), put it onto a sprite, scale that sprite down and display it as a mini map?
My method uses object masking to mask what is beyond white border of map BTW in my 3rd post here you have link to that minimap template
And it have comments on each part explaining what they are for and what they do even how to adapt it to your game
So you can check it out yourself
But that begs the question
How much of dynamic (Real Time) it would be?
Cause right now i am able to track position of anything in real time
Enemies or player even weapons thrown/bullets
Basically every single object
I can adjust colors/opacity of anything and/or give them outline even draw it as circles in their center instead of drawing their shapes as rectangles
And set how much distance from ANY point of what you see anything should be drawn
For example like only draw objects that are 100 pixels away from player
So it does not draw any single object in your scene
So that gives a lot of control
I did not check how much performance heavy it is
But how much performance heavy would be constantly taking snapshot of something and printing it in real time?
Also imagine you would wish to take snapshot of only platforms but not of enemies
Would that be possible without breaking them into different layers in editor?
As i understand that sprite snapshot extension you mention would make kinda like screenshot or am i wrong?
But if i am right then would you wish have small image of what you see normally as your minimap?
Cause i think for a reason minimaps are made of simple solid objects
Instead of miniature of what you actually see
But that is also debatable from game to game
I gonna look into sprite snapshot and tell you of what use it can be
Sprite snapshot would be good for save slots icons or something like that
Like you make farming game and you have saves
And now you take snapshot and put next to save slot
Or to display small part of map
But not as minimap
I mean it could be used for it and adjusted to anyone needs
But i think effect would vary on what ppl expect from minimap
Another problem i just noticed
Probably can be solved somehow but i could not figure it out
Look this is me taking snapshot 4 times
It just pasted over 4 times same exact crap as you see there are 4 skeletons on the bottom which are copies of that ones skeleton above them
IDK how to clear snapshot after taking one so they do not overlap
You did in fact answer my question how to find corners THX
But i think now my problems comes more from with what action i try to draw it
Rather than what values i can provide
It only wants position of sides
Unless there is some way to shove there coordinates for both X and Y position at once
For example in 1st field it asks for Left X Position
Well i can give that
But for your method to work i would also need to be able to shove in there Y of that top left corner
I mean action is expecting position of walls so to speak
And i would need to provide position of exact points
The rectangle action is only going to draw unrotated rectangles.
If you want rotated ones then you could build a rectangle with lines.
I didn’t even need to retype anything. Change the first to a begin…, change the others to add to a path and add close the path. I had to move the last line up a spot so the points are added in the correct order.
THX Keith but that is not an option
Since it will be empty inside
So minimap would look kinda strange
I only wanted it so it accounts for platforms but are rotated
But i guess not many ppl will need it