Does anyone know how to make a selection box?like those that you have to click and drag with the mouse in strategy games...
i think this link will help you ^^
You can save the position you start clicking in two variables, then set the create a sprite and set it's size to the distance between the mouse position an those variables.
Like this: SelectionBox.capx (r97)
the only problem with this kinda thing is you dont want the sprite used for the selection box to stretch. If you make a 1 pixel thick hollow square on an image then stretch that sprite to twice its original size then that 1 pixel thick border becomes 2 pixels thick.
Maybe not a huge problem... possibly a very a big problem depending on the project. Either way it looks bad
The way its normally drawn is with frame images. 1 for each corner 1 for each side and 1 for the middle which is usually tiled not stretched. Not an easy solution to setup in c2 tho
Yeah I see the problem, but if you use a single coloured image with opacity set down it looks OK in my opinion. You don't get any border around the selection though.
Develop games in your browser. Powerful, performant & highly capable.
But i have a little problem,when i try making the following event:
If units collide with selection box - units variable change to selected
but the units just get selected when i directly click them,but not when i drag the box to them
I made this capx the first time I read this thread but didn't post it for some reason. It's an expanded version of Nimtrix's capx. I think I had that same problem that you're talking about at one point but I can't remember the cause. If you can't get it working post up your capx or a screenshot anyway.
that's just awesome,thanks