TOUR
PRICING
HELP
Stencylpedia
Blocks Guide
Sample Games
Developer Center
FORUMS
CHAT
#MADEINSTENCYL
EDUCATION
SIGN IN
×
Welcome back!
Username or E-mail
Password
(
Forgot?
)
C
OMMUNITY
Home
Issue Tracker
Inbox [0]
New Posts
New Replies
Search
Stencyl Community
→
Stencyl
→
Ask a Question
→
Drawing a polygon
Pages:
1
Drawing a polygon
00george
Posts: 161
June 10, 2012, 11:09:22 am
Hi im trying to make it so when the user clicks and drags a rectangle will be drawn to the size the user drags but for some reason the polygon will not show up. I posted a picture of the behaviour below.
« Last Edit: June 10, 2012, 12:51:02 pm by 00george »
Ryusui
Posts: 827
June 10, 2012, 11:12:15 am
"Was pressed/released" is only valid once per click/release. Set/unset a boolean to indicate whether the mouse is being held down, and have the drawing routine check that instead.
In the event of a firestorm, the salad bar will remain open.
00george
Posts: 161
June 10, 2012, 12:50:33 pm
Hi I made some changes but the shape isnt a rectangle it comes out as some weird diamond shape I will post updated images above.
Ryusui
Posts: 827
June 10, 2012, 01:16:48 pm
What's wrong with the draw/fill rect blocks?
As for why you're getting an hourglass shape, that's because you're not defining your coordinates in the right order. It'll draw the vertices in the polygon in the order you provide; you've got the last two backwards.
In the event of a firestorm, the salad bar will remain open.
00george
Posts: 161
June 10, 2012, 01:34:51 pm
Um I wanted to make it so you can draw the size of the rectangle and I wasnt sure how to do this with the fill rect blocks. Edit: For some reason when drawing the polygon the rectangle comes out in strange sizes. All I want to do is make a selection rectangle like in real time stratedgy games.
« Last Edit: June 10, 2012, 01:39:06 pm by 00george »
Ryusui
Posts: 827
June 10, 2012, 01:43:44 pm
With the rect blocks, you'd calculate the width and height by subtracting the start point from the end point.
EDIT:
Check out the attached game.
« Last Edit: June 10, 2012, 01:50:41 pm by Ryusui »
In the event of a firestorm, the salad bar will remain open.
Pages:
1