http://scratch.mit.edu/forums/viewtopic.php?id=6428#req_message
http://scratch.mit.edu/forums/viewtopic.php?id=6428#req_messagehttp://scratch.mit.edu/forums/viewtopic.php?id=6428#req_message
1http://scratch.mit.edu/forums/viewtopic.php?id=6428#req_message2http://scratch.mit.edu/forums/viewtopic.php?id=6428#req_message
Offline
These are really good tips. Here's another that i found out just a week ago that i could have used in a lot of my platformer games that would make it run a lot smoother.
Instead of having to have costumes for a sprite facing both right AND left, you could just have one set of costumes facing one way and then click the the little arrow button to the top near where it says the sprites name that looks like this: <->
Then you would just add a script:
when flag clicked
forever
if right arrow key pressed point in direction 90
if left arrow key pressed point in direction -90
Offline
oh no i didn't want that minus sign to appear! the button looks like a line with to arrows on the end of it. <----->
Offline
DrSuper wrote:
I have tried unlocking sprites and moving them I have the following issues:
1. I need a way to dynamically lock or unlock a sprite.
2. A locked sprite considers mouse down as a click but for an unlocked sprite "clicked" means the mouse has been pressed and has come up in a short (?) time interval. If I just drag an unlocked sprite it is not considered "clicked" and the scripts will not start firing until you actually click the sprite. Do you know a way around this. I really need a mouse down event for unlocked sprites;=<
Regards
Dr. Super
1. One good, less glitchy [than the set x and y answer] answer is to have your own custom code for dragging, which only executes
[blocks]
<when[ Sprite ]clicked>
<if><( <{ unlocked? }> <=> 0 )>
DRAGGING CODE 1
<repeat until><< <not> <mouse down?> >>
DRAGGING CODE 2
<end>
<end>
[/blocks]
It could be as simple as:
[blocks]
DRAGGING CODE 2:
<go to[ mouse-pointer ]>
[/blocks]
or just keep its x and y positions relative to the mouse pointer using:
[blocks]
DRAGGING CODE 1:
<set{ dragrelx }to( (( <x position> <-> <mouse x> ))
<set{ dragrely }to( (( <y position> <-> <mouse y> ))
DRAGGING CODE 2:
[/blocks]
Sorry I've got to go.
Offline
DrSuper wrote:
Thanks for sharing. I did not know about lock/unlock ;=< I am new to Scratch and reinvented it as follows (It may come in handy if you want a locked sprite that you can drag under certain conditions)
in a forever loop set x and y of the selected sprite to the x and y of the mouse
Inside this loop it keep the equality as long and the mouse is pressed (the sprite is getting dragged) as soon as the mouse is released stop the script.
One question for you. Do you know how we can get the shadow that sprites have in design at run time when they are selected?
All you have to do to make it drag correctly is to make it only execute when the mouse is touching the object you want to drag.
Offline
bosox397 wrote:
These are really good tips. Here's another that i found out just a week ago that i could have used in a lot of my platformer games that would make it run a lot smoother.
Instead of having to have costumes for a sprite facing both right AND left, you could just have one set of costumes facing one way and then click the the little arrow button to the top near where it says the sprites name that looks like this: <->
Then you would just add a script:
when flag clicked
forever
if right arrow key pressed point in direction 90
if left arrow key pressed point in direction -90
nice i actually was looking for this thanks.
Offline
Here's a little trick I've been using. If you have a really long script and you want to move a block to a different part of it, instead of dragging it there a little bit at a time, just delete it, scroll to the right place, then click undo. It's like cut-and-paste.
You can also copy-and-paste (kind of). Duplicate a block then dump it into the list of blocks on the left (delete it, in other words). Again, go wherever you want it (including a different sprite) and click undo.
Offline
I found the list concatenation very useful - this allows you to construct a list, and then 'say' the whole list. The only problem is that a space is inserted between every item in the list.
Offline
Well, I already knew all of these but one thing to mention:
fullmoon wrote:
The Lost Video Support
In Scratch 1.0.1, you can shift-click on Extras to enable some experimental blocks in Sensing and Sound. They don't do anything, but they're fun to ponder.
Not just 1.0.1, but 1.3.1 also has it. You can press "write project summary" and "write multiple project summaries" or "set single stepping".
Anways, if you put that above, remember to give me credit.

Offline
PetertheGeek wrote:
You can right click the stage and click "Grab Screen Region for New Sprite" and then select any region in the Scratch program and it will turn it into a new sprite. This is good for making tutorials if you want a picture of the scripts you used.
For making a picture without having to fill in all those little lines, drop a comment and size it to fit the scripts you want to copy and put them in. Easy!
Offline
fullmoon wrote:
One-Dimensional Dragging
For whatever intristic reason, blocks seem to override the lock/unlock feature that lets you drag sprites. This means that if you want something to only be draggable up and down, just put code like this on the sprite and "unlock" it:
When Flag Clicked:
Forever:
Set x to 168
End Forever
Be careful with this one: It does not work on the website.
See below.
Last edited by billyedward (2009-07-29 17:38:31)
Offline
The one dimensional dragging doesn't work on the java. Here's how to make it:
<when green flag clicked>
<forever if><< <touching[ mouse pointer <and> <mouse down?> >>
<set x to( <mouse x> )
<end>
[/blocks]
Last edited by billyedward (2009-07-29 17:44:50)
Offline
Wow!!! That's cool. Especially the 1.0.1 trick.
Offline
i didn't know about the lock/unlock thing either (that will help a lot). and i have a question. how do you have a "click screen to continue" and then not have the game go to the same place every time that you accidentally click the screen?
Offline
fluterock wrote:
i didn't know about the lock/unlock thing either (that will help a lot). and i have a question. how do you have a "click screen to continue" and then not have the game go to the same place every time that you accidentally click the screen?
var clicked=0
when stage clicked{
if(clicked = 0){
broadcast [continue]
clicked=1
}
}
Offline
fullmoon how did you get your signature?
http://scratch.mit.edu/projects/MrMunchkin/808516
Offline
fullmoon wrote:
neksus wrote:
Use variables for numbers you use more than 2-3 times.
Then, if you're testing or want to change something, you only need to change the variable and not all 50 instances of the number!Good point; many of us have learned this the hard way.
Exactly what I have explained here:
http://scratch.mit.edu/projects/Morphed/819784
It says as part of animation tips to make a variable like Animation Delay or such and set it to the time that seems most practical as the timing for your Animation, then put it in the Wait ___ Secs Block.
Scratch on
<clear graphic effects>
Offline
heres one more thing u may wanna add is that if the programmer wants to make a sprite follow the mouse simply
when "gren flag clicked"
Forever
set sprite x to {mouse x}
set sprite y to {mouse y}
simple but some dont know that!
hope it helps
Offline
Hi,
I am trying to use control and it is always executing the else statement. Here is the control flow:-
<forever>
<if>
<key[ 1]pressed?>
<change{ score }by( 1)
<else>
<change{opponent }by( 1)
Now, everytime, I the keyboard 1 is pressed the variable opponent is incresaed by 1.
Any help would be appreciated.
-Thanks,
Aroosh
Offline
fullmoon wrote:
I think I'll make this into a project someday, but I thought I'd share some of the fruits of my Scratch addiction with the world. Here are some tips that I'm sure very few people know of; I found one of them today!
Quick Local>Global Variable Switch:
NOTE: Global variables are "for all sprites" and local (or private) variables are "for this sprite only" (using the phrases from the "make a variable" dialog).
Ever spend three hours on a project, making some single sprite use global variables, then decide that you want to add more sprites, but they all have to have their own? Sorry, can't help with that. However, you CAN go in the other direction. If you have a local variable you want to make global, just drag the scripts that contains blocks that deal with the locals you want to make global onto the Stage. It'll automatically create globals of the same name.
Say <Boolean> for 2 seconds
It's possible to put a boolean (triangle-cornered) block into "say" or "think" blocks. The sprite will say either "true" or "false".
One-Dimensional Dragging
For whatever reason, blocks seem to override the lock/unlock feature that lets you drag sprites. This means that if you want something to only be draggable up and down, just put code like this on the sprite and "unlock" it:
When Flag Clicked:
Forever:
Set x to 168
End Forever
Voodoo Fix for Sound Issue
On my admittedly ancient computer, Scratch often speeds up my sounds just for the heck of it. This really ticks me off. Today, while trying to fix Scratch and my microphone at the same time, I found that opening Sound Recorder in Windows, recording sounds for a few seconds, then closing it without saving causes Scratch to play sounds at normal speed (for a while, at least).
The Lost Video Support
In Scratch 1.0.1 (download here), you can shift-click on Extras to enable some experimental blocks in Sensing and Sound. They don't do anything, but the're fun to ponder.
I'll put any more on as I find them. Thanks for reading!
Awesome!Why do you call the sound bug 'Voodoo' though?
Offline