Pages: 1
Topic closed
Hello all, im trying to make a program where you can select a group of sprites all at the same time by drawing somthing like a rectangle around them. I was wondering if this is possible? If so, how is it done?
any replies on this topic would be really appriciated!
bking0
Offline
I'm pretty sure it can be done. First, define a sprite specific variable, maybe called "Selected" on each of the selectable sprites. You can then define actions that happen to the sprites (movement, whatever) that are initiated by keys or messages but will only happen if the individual sprite has a Selected value of 1. You should also have the selectable sprites change apperance somehow when they are selected.
So then the task is to change the state of the Selected variable for the desired sprites. A simple approach would be to allow the user to build a collection of selected sprites by clicking on each sprite individually. Not as elegant as a selection rectangle, but easier to do. The selection rectangle could be done using the pen, I suppose, and remembering a couple of mouse click positions. Then, you would have to write the logic to decide if each sprite is "inside" or "outside" the rectangle, by testing the positions.
Offline
Here's one way to do it that seems to work, and which follows Paddle2See's suggestion:
http://scratch.mit.edu/projects/chalkmarrow/274109
Last edited by chalkmarrow (2008-09-25 14:58:27)
Offline
chalkmarrow wrote:
Here's one way to do it that seems to work, and which follows Paddle2See's suggestion:
http://scratch.mit.edu/projects/chalkmarrow/274109
...And if you don't like that one, here's the version I made before I saw that Chalkmarrow had beaten me to the punch!
http://scratch.mit.edu/projects/Paddle2SeeFixIt/274123
Offline
... And the one I made before I saw Paddle2see's
http://scratch.mit.edu/projects/JSOlabs/274142
It's almost exactly the same...
Offline
Topic closed
Pages: 1