i know varibles and im a begginner
Offline
Sawman3 wrote:
You can't really reverse a forever loop, Larry828, but you can use the following options instead:<repeat(
or
<forever if>
or
<repeat until>
Used along with broadcasts and sets of 'true' and 'untrue' (0 and 1) variable configurations, these can be even more effective than the forever loop. Hope that helps! If you want more extensive advice, you can email me at [ADDRESS DELETED]. Good Luck!
...Off Topic, but There's an e-mail address in here.
{DELETED here and in the original post-kjk]
Last edited by kevin_karplus (2008-04-09 09:36:15)
Offline
They also can be used to do something randomly
<when[ space ]key pressed>
<set{ variable }to( <pick random( 1 )to( 2
<when green flag clicked>
<forever>
<if><( <{ variable }> <=> 1 )>
<say[ Yes ]for( 3 )secs>
<when green flag clicked>
<forever>
<if><( <{ variable }> <=> 2 )>
<say[ No ]for( 3 )secs>
See my projectSprite Mixer as an example
Hope this helped!
Last edited by Jacobo (2008-04-23 14:52:26)
Offline
Larry828 wrote:
So it sounds as if variables help one deal with QUANTITIES. If no ammo, you can't shoot. If someone is walking, then it will take a long time to get somewhere. If someone scores 5 or more points they win the game.
Or, if there are no seconds left on the clock, then the game is over.
Or, with a variable "PeopleNumber" if there are 3 or more people, then you get CROWD behavior! If PeopleNumber = 2, then nobody can keep a secret.
That just gave me an idea to tell you! I made a project about a secret and ilovescratch1 flagged it! Oh-no! I just started it again!
Offline
(/b)
Offline
Larry828 wrote:
Never having programmed, I'm puzzled by the use of variables. "Score" as a variable is clear and I've used that several times in projects. But when I look at the use of variables in other peoples' projects the variables are often puzzling. The Wikipedia entry on variables in computer science was too brief and too general to be of help. Is there a helpful book, or are there projects here at Scratch that would introduce variables to a real beginner? I need a basic idea of how they function in scripting a project. Thanks!!
Don't know if this will add anything to what has already been said, but at least it is a new resource that some might find useful. See http://www.dickbaldwin.com/homeschool/Hs00102.htm
Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free Scratch tutorials: http://www.dickbaldwin.com/tocHomeSchool.htm
Free Java/C#, etc. tutorials: http://www.dickbaldwin.com/toc.htm
Offline
Well, if I remeber, a variable is something that stands for a number. Like 6 + a = 34 - 29 , in which the answer is a = -1
Offline
archmage wrote:
Really you don't need a book to learn variables. Variables are simply just numbers that you can control and use to control your program. Variables are most useful for if statements and you can check the variables values to determine what script to execute. for example
If score > 1000
say "you got over 1000 points"
if score > 100
say "you got over 100 points''
if score = 0
say "You are really bad at this game"
Variables are not really confusing, what can be confusing is the ways that they are put to use. And don't worry when I started programming variables and if statements confused the hell outta me tooYou will get better with practice.
Me too, archmage, now i'm clear with them, but it took a long time, because i thoguht you drag it on the screen and it'll do whatever i want the project to do. I'm not dumb like that anymore...but trust me, it takes practice
Offline
The best way to learn about variables and everything else in programming is to start at the beginning and learn one step at a time. If you do that, before you know it, you will be programming in a modern powerful object-oriented programming language such as C++, Java, or C#.
Offline
In my new Pokemon™ Game, I used variables to remember which Pokemon you had chose, your health, etc. They come really useful for remembering things, whether it's Pokemon™ or time or simply if your touching a wall. Variables are Very useful
Offline
redsooty9 wrote:
Bluestribute, please dont spam the forums with your signature.
???? It's the smallest one of them all
Offline
when I recieve [shoot]
if [ammo > -1]
do shooting blahdeblah scripty thing
change ammo by [-1]
=======
when I recieve [refill ammo]
set ammo to 10 (or whatever your number is)
Change it to suit your needs
Offline
SO if the thing is a true thing it will jump and false made it land right????? Like this....
<when green flag clicked><when green flag clicked>
<forever><if><set{ground}to(1<else><set{ ground}to(o
Offline
Lately I wrote a small tutorial "Learn to program with Scratch" (Okay it is German, but I will translate it into English ;-) )
There I took variables to draw spirales. Every step you change the length of the edge.
Last edited by SaltAndVinegar (2008-07-01 09:10:30)
Offline
ok variables are things that show up on your project
Offline
ben2 wrote:
Larry828 wrote:
So it sounds as if variables help one deal with QUANTITIES. If no ammo, you can't shoot. If someone is walking, then it will take a long time to get somewhere. If someone scores 5 or more points they win the game.
Or, if there are no seconds left on the clock, then the game is over.
Or, with a variable "PeopleNumber" if there are 3 or more people, then you get CROWD behavior! If PeopleNumber = 2, then nobody can keep a secret.That just gave me an idea to tell you! I made a project about a secret and ilovescratch1 flagged it! Oh-no! I just started it again!
![]()
poor u
Offline
well on my other acount i did a project to say i hate noatwin and alanprojects flagged it.
Offline
is it possible to create a volume variable to make a really quiet soundtrack louder?
any help appreciated...
thanks
Offline
andresmh wrote:
A variable can also be used to determine the state of a sprite. For example, if a sprite is walking could be equal to 1, if running equal to 2 and if it's standing equal to 3. Just an example.
Pretty much to monitor when a various monitor(variable) for example, health will monitor if health is zero you die and if health isn't 0 then you don't die! etc.
Offline