This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#76 2009-07-02 05:57:56

Berry122
Scratcher
Registered: 2008-11-23
Posts: 500+

Re: How can I learn about Variables?

I know I think they are so confusing, but I'm beginning to understand them more now  smile

Berry


https://p.twimg.com/Am8IhUsCAAAfgNs.jpg

Offline

 

#77 2009-07-18 18:39:44

billyedward
Scratcher
Registered: 2008-01-03
Posts: 500+

Re: How can I learn about Variables?

They are kind of like boxes.
You can put something into the box, and then see what it is later.
If you want to put anything else in, then the first thing that was in the box is removed.
Hope this little analogy helps!


"I'd love to change the world, but they haven't released the source code yet."
Check out the latest version of Streak --> http://billy.scienceontheweb.net/Streak

Offline

 

#78 2009-07-21 13:25:28

nmhawley
Scratcher
Registered: 2009-07-21
Posts: 7

Re: How can I learn about Variables?

What about sliding variables

Offline

 

#79 2009-07-25 05:16:22

Soranhawke
Scratcher
Registered: 2009-07-25
Posts: 4

Re: How can I learn about Variables?

Currently I'm working on a quite good 1v1 fighting game, and I have some variables. Every character has HP and MP that signs informations the player needs, but I can't place them. When i put them to their place and i save and quit and then open it again they are back at the place they appeared. I can't find anything to place them finally and without it, it'll be a bit [removed], because you won't be able to see some of the skill buttons and stuff. Could you help me in my issue?

Last edited by Paddle2See (2009-07-26 05:11:57)

Offline

 

#80 2009-07-26 05:14:05

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: How can I learn about Variables?

Soranhawke wrote:

Currently I'm working on a quite good 1v1 fighting game, and I have some variables. Every character has HP and MP that signs informations the player needs, but I can't place them. When i put them to their place and i save and quit and then open it again they are back at the place they appeared. I can't find anything to place them finally and without it, it'll be a bit [removed], because you won't be able to see some of the skill buttons and stuff. Could you help me in my issue?

There have been some bugs with the Show/Hide blocks.  Try saving the project with the variables showing.  I think Scratch gets confused when the variables are hiding when it is saved or shared.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#81 2009-07-27 21:46:25

billyedward
Scratcher
Registered: 2008-01-03
Posts: 500+

Re: How can I learn about Variables?

nmhawley wrote:

What about sliding variables

These are just controls to let the user easily set the value.
They can be used in conjunction with variable setting blocks to create very advanced projects.


"I'd love to change the world, but they haven't released the source code yet."
Check out the latest version of Streak --> http://billy.scienceontheweb.net/Streak

Offline

 

#82 2009-07-28 18:41:22

real-pokemon
Scratcher
Registered: 2009-02-21
Posts: 100+

Re: How can I learn about Variables?

me too!


http://scratch.mit.edu/static/icons/buddy/240416_med.png?t=2009-04-14+18%3A35%3A52 http://1.bp.blogspot.com/_655pxnK-l3s/STtTzji19oI/AAAAAAAAABE/prr9X3jKa9Y/S226/Jigglypuff.jpg

Offline

 

#83 2009-08-02 10:15:19

aweman
Scratcher
Registered: 2008-06-22
Posts: 100+

Re: How can I learn about Variables?

The technical term for "variable" is a number that can change or vary. You probably know to find the area of a rectangle or square, you do the simple equation length x width. If you replace the length with an L and width with a W, you would see the equation L x W. L still means length, it just looks different. W still means width, it just looks different. Gee, this is harder to explain than I thought! Anyway, in this case length and width are two variables. Wow, I almost forgot a very important variable for this situation! Area is also a variable. Let's shorten it to A. Our new formula (equation) is L x W=A.

Offline

 

#84 2009-08-02 10:16:25

aweman
Scratcher
Registered: 2008-06-22
Posts: 100+

Re: How can I learn about Variables?

nmhawley wrote:

What about sliding variables

A sliding variable is one you can manually change.

Offline

 

#85 2009-09-29 10:43:34

IwonaIcee321
Scratcher
Registered: 2008-12-21
Posts: 18

Re: How can I learn about Variables?

Larry828 wrote:

Archmage, how would you construct the phrase "if touching 'ground' grounded = 1" using Scratch blocks? 

"If" requires an insert with pointed ends.  The "=" relationship is built within an insert with ROUNDED ends.  I can build "grounded = 1" but I can't combine it with the "if" block.
IF TOUCHING |sprite4|         (....assuming Sprite4 is the ground)
.........
<(grounded) = (1)>
but I can't combine those two blocks to express THEN.

(I tried to use the "blocks" at the bottom of this form but didn't succeed. When I previewed my result it wasn't what I intended, so I'll have to learn the syntax of using the blocks in these messages.  I kinda got the blocks in there, but didn't know the syntax for filling the blank spaces with names of variables, names of sprites, and numbers....  Oh well, just another challenge....)   :-) 

I hope my verbal try made sense....

BTW, I was able to build your second set of commands.
    IF <(grounded) = (1)>
        BROADCAST |jump|

Thanks!  Larry

    P.S.  it says Smilies are on, but my typed smilies never turn into graphical ones....  yet another challenge.   :-)
    PP.S.  Even worse, when I previewed this message the messaging program substituted partial green blocks for my typed )> characters.  I don't know how to retype it to prevent that, so I hope it's comprehensible.   There must be an easier way.  Or maybe I need to find a "pre-Scratch" language!!  :-)

<(  <=>  )> it does have pointed ends dude  wink


http://verydemotivational.files.wordpress.com/2010/04/129163658534850677.jpg
http://scratch.mit.edu/static/icons/buddy/208085_med.png?t=2010-05-10+20%3A23%3A39

Offline

 

#86 2009-09-29 10:46:14

IwonaIcee321
Scratcher
Registered: 2008-12-21
Posts: 18

Re: How can I learn about Variables?

<change{Scrollx  }by( 5               waaa i dont get it. HELP ME. i mean, i know the easy ones like score but i mean ones that contribute to the sprites movement. like that danny phantom on the frontpage. its hard to figure those out dang it! someone make a project on how to do it. thanks.


http://verydemotivational.files.wordpress.com/2010/04/129163658534850677.jpg
http://scratch.mit.edu/static/icons/buddy/208085_med.png?t=2010-05-10+20%3A23%3A39

Offline

 

#87 2009-09-30 16:59:32

JaggedJoystick
Scratcher
Registered: 2009-09-29
Posts: 51

Re: How can I learn about Variables?

http://scratch.mit.edu/projects/greenflash/673855


http://i653.photobucket.com/albums/uu259/The-Whiz_photos/Picture50.png

Offline

 

#88 2009-11-27 14:38:41

Usmanproductions
Scratcher
Registered: 2009-11-26
Posts: 11

Re: How can I learn about Variables?

pedroskivich wrote:

You can use it for a game like for ammo if you shoot whenever you shoot take away one and if it gets to zero you can't shoot.

How do you make it stop shooting? Please explain

Offline

 

#89 2010-04-04 20:18:40

Usmanproductions
Scratcher
Registered: 2009-11-26
Posts: 11

Re: How can I learn about Variables?

Usmanproductions wrote:

pedroskivich wrote:

You can use it for a game like for ammo if you shoot whenever you shoot take away one and if it gets to zero you can't shoot.

How do you make it stop shooting? Please explain

Nevermind, I know now you do this:

<if> <( ammo <=> 0 )>
<hide> bullet

Offline

 

#90 2010-06-01 18:58:09

pow123
Scratcher
Registered: 2010-05-22
Posts: 2

Re: How can I learn about Variables?

how do you make health and mana bars? I need to know the scripts!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Offline

 

#91 2010-08-15 06:03:04

17588
New Scratcher
Registered: 2010-07-12
Posts: 5

Re: How can I learn about Variables?

midnightleopard in the game Night Parkour how did you make your stick man fall when he wasn't touching black?

I am make a maze type game and can't get my sprite to fall of a ledge, instead it just stands mid air.

Please help!! I am desperate!

Thx

Offline

 

#92 2010-08-15 06:51:09

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: How can I learn about Variables?

I'm not midnightleopard, but I'll try answering anyway.  smile

Try the following script:

When Flag Clicked
forever
repeat until touching color [black]
   change y by (-2)
endrepeat

You can change the value - the less it is, the faster the sprite will fall. Just don't go positive; your sprite will start flying.  wink


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#93 2010-08-15 08:11:17

midnightleopard
Scratcher
Registered: 2007-09-13
Posts: 1000+

Re: How can I learn about Variables?

Okay, first of all, thanks for looking at my project! Second of all, I actually used an old advanced trick I learned from a user called The-Genius. The script is[blocks]
<when green flag clicked>
<set{ Y velocity }to( <{ Y velocity }>
<forever>
<if><touching color[ black]
<set{ Y velocity  }to( 1
<if><key[ Space ]pressed?>
<change{ Y Velocity }by( 15
<end>
<end>
<change{ y Velocity }by( -1
<change y by( <{ Y velocity }>
[/blocks]
but, if you want a simpler way to do that, try
[blocks]
<when green flag clicked>
<forever>
<repeat until><touching color[ black
<change y by( -3
<end>
<end>
[/blocks]
(The script above may need to be adapted to fit your project, but I think you could do it  smile
Remember, if you want to see how a project works you can download it and open it in scratch! You could also try the new Expieremental Viewer to see the code online! Hope this helps!

Last edited by midnightleopard (2010-08-15 08:11:46)


http://pwp.wizards.com/5103673563/Scorecards/Landscape.png

Offline

 

#94 2010-08-15 08:45:07

Lellowsfuzz
Scratcher
Registered: 2009-04-17
Posts: 500+

Re: How can I learn about Variables?

A variable is a placeholder for numbers, letters, or strings. Strings are a group of letters. They can be used for score, and on/off switch, data in a computer, the position of a sprite, or anything that stored numbers/letters/strings can be used for.

Offline

 

#95 2010-08-15 09:35:19

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: How can I learn about Variables?

Please note that this topic was originally posted 2007-08-16. I'm pretty sure both the forums and the Scratch application itself have gone through changes/updates since then so keep in that in mind.  smile


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#96 2010-08-15 10:54:24

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: How can I learn about Variables?

Locomule wrote:

Please note that this topic was originally posted 2007-08-16. I'm pretty sure both the forums and the Scratch application itself have gone through changes/updates since then so keep in that in mind.  smile

Indeed, there have been! I first started out using Scratch 1.1 back in July of 2007 - we had no lists, no hide/show variable blocks, and each variable had its own set of blocks. See how we have a dropdown list for each variable in the "change [variable] by [x]" and "set [variable] to [y]" blocks? Before, there wasn't: each and every block had its own blocks of the like  big_smile

Offline

 

Board footer