I really need some assistant. I'm trying to do a project about dragging and dropping some maps of the states. I'm having trouble doing the script part. I have tried the process of elimination and gottin nowhere. I have been doing this for almost a month now. Please help, I can't seem to get this going. All the script I have tried is not working. I really appreciate this. Thank you.
pusoko
Offline
I don't really understand your problem. You could try to share the project and then I could look at it and try to help you.
From what I can understand, the problem is with the dropping and dragging? Well, if you want sprites to be draggable online, you could use the unlock button.
Offline
How do I show you what I have. This is the first time doing anything like this. Well this is what I have. I have the map of the West Coast. I cropped and made copies of the states. I block each state name on the map. Now what I'd like to do is take a state, like CA with the mouse, drag it and drop on the map of the state. If the kids are right, then it will stay there, if not, it will move back to it's original place. Thats the main objective. I appreciate your help, thank you.
Offline
to show him what u have press the "Share" button on your Scratch program fill the things out and tell him.
maybe u should try this note: this is for dragging
<when green flag clicked>
<forever if><< <mouse down?> <and> <touching[ mouse pointer >>
<go to[ mouse pointer
Last edited by 47fg74 (2008-03-08 21:08:09)
Offline
So the name CA is only allowed to sit within the outline of California or in some initial "safe" location? If you set up something like this
Forever If (Not Mouse Down) AND Touching (Washington Or Oregon Or ... )
Glide back to original position
will work. I'm assuming that you have sprites for each of the states...
Offline
This is my script-
when flag is click
forever if mouse down and touching mouse pointer
go to mouse-pointer
if touching color purple ( California color)
set x to 1
stop script
else
go to x:204 y:-121 (original place)
The script is not working. What I would like to do is when I pick up sprite CA and put
it on map of CA, I would like it drop, if the mouse drops it else where, then it would
go back to it's original place. Thanks guys.
Offline
You are moving the sprite while it is trying to go to a set X pos. Use this script:
<when green flag clicked>
<forever>
<if> << <touching[ mouse-pointer <and> <mouse down?> <and> <not> <touching color[ purple >> >>
<go to[ mouse-pointer
<else>
<if> <touching color[ purple
<set x to( 0
<stop script>
<end>
<end>
Offline
ihaveamac, thank you for your help, it almost worked. I put in your script but it only did half of what I wanted it to do. I was able to pick up the CA (state) and drag it to the map but it wouldn't drop on CA itself. Even dropping it on the wrong state, it wouldn't go back to it's original place. I tried messing around with your script but I couldn't find the right script. It look so easy and yet hard to figure out. I made all the sprite and the only thing that stopping the project from taking off is the script. I bet you it's so simple, but for the 'script' in me, I can't see it. If anyone else has any suggestion, please don't hesitate to script me. Thanks
Offline
Can you please Share the project? I can take a look at it for you.
How about:
[block]
<when green flag clicked>
<forever>
<if><touching[ California
I <if><< <not> <mouse down?> >>
I I <if><touching[ California Outline
I I <go to[ California Outline
I I <else>
I I <go to[ Original Spot
I I <end>
I <end>
<end>
<when green flag clicked>
<forever>
<if><< <mouse down?> <and> <touching[ mouse pointer >>
<go to[ mouse pointer
[/block]
That's 2 script. It should work.
By the way, the I's are for you. They take no part in the script.
Replace the Names with your sprite names.
Last edited by Rukqo (2008-03-12 01:59:06)
Offline
Rukqo, I did your script and I still can't make it work. I'm sharing my project so you could see what I'm trying to do. I really don't know if I am putting the script in right. Thank you for your help. You can look at my project and maybe you can make sense of the script. Thanks for your help..
Offline
I just posted up a version that I think works quite well. I went to a different approach...rather than doing color testing, I am using target sprites that the states have to land close to, or they are returned to their start positions. That way, we don't have to worry about states being slightly misaligned when they are dropped.
I'm using the new draggable sprites (available with Scratch 1.2) to handle the dragging operation. I just clicked on the little padlock symbol to make them draggable, no coding required. Green flag sends all the states back to their initial positions.
http://scratch.mit.edu/projects/Paddle2SeeFixIt/121872
Offline
what about this script?
<when green flag clicked>
<forever if<< << <not> <touching[ mouse pointer] >> <and><< <not> <mouse down?> >> >>>
<glide( 1 )secs to x start pos )y start pos )
<end>
<when green flag clicked>
<forever if<touching[ CA on map >
<hide>
<broadcast[ shade ]and wait c>
<end>
CA block
<when green flag clicked>
<forever>
<if><touching[ CA block ]
<show>
<else>
<hide>
CA on map
Last edited by D97 (2008-03-17 14:02:02)
Offline