[Solved] Area selection by sprite

For questions about using Classic.

Post » Tue Sep 13, 2011 4:09 am

Might check out the rts basics template that comes with Construct.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Tue Sep 13, 2011 4:20 am

well you dont need to "spawn" a bunch of stuff, you can set the width/height to the x,y size of the box.

in essence you just need to store the initial position of your click when you click using (((floor ((MouseX/Y) / 32) * 32) +16))like you have already (and seem to understand) in a variable like INITIAL CLICK X, INITIAL CLICK Y, for x y respectively, then from there on if mouse button is down set the width of the box to ((floor ((MouseX) / 32) * 32) +32)-'INITIAL CLICK X') and height to ((floor ((MouseY) / 32) * 32) +32)-'INITIAL CLICK Y'). you might need to adjust the +32 part depending on how your sprite is positioned, but you seem like you'll be able to figure that out.
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Tue Sep 13, 2011 8:30 am

Very good job, Alspal, is exactly the result I expected.

As I could not solve this problem, I have everything taken from zero while trying to serve me a sprite instead of "TiledBackgroud" based on the mechanisms that you made me understand in your solution.

And joy, I got it to work perfectly.

SpriteBox.cap

So this morning I just post my solution (French time) and I also see that you solved the problem.
Looking your .cap, I realize that our solutions are very close even though in the end, yours is simpler, more elegant and above half as long .

I think my solution and that of Aspal put into practice what you said, QuaziGNRLnose, and finally the difference is only the use of a sprite for my part, and "TiledBackground" for Alspal.

I looked a bit the template RTS, Newt, but it was not really what I was looking for.

Anyway, a big thank you, especially Alspal.
Anxious2011-09-13 08:46:07
B
4
G
2
Posts: 9
Reputation: 1,243

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests