Variable helping

user_icon pedroskivich shared it 1 year, 1 month ago
89 views, 1 person loves it, 1 tagger, 10 downloads
Add to my favorites?
Flag as inappropriate?

Comments

You need to be logged in to post comments

Add a Comment

Aikidoboy Aikidoboy 10 months, 3 weeks ago

pretty cool!

(view all replies)
Comment Reply

pedroskivich pedroskivich 1 year, 1 month ago

The variable for ammo makes it a lot simpler because if you used a sprites costumes you would have to have color sensing to tell what it was because there is no <if costume = > Variables save a lot of time and clutter from your projects though. About the targets disappearing I don't know why I did that. I guess I'll mod it and replace this version. I couldn't quite understand what you said about the directions but the difference between the scratch direction and my variable is: The scratch one can't have to do with 2 sprites so it would only do the laser however with a variable you can have the machine set the direction and the laser use it.

(view all replies)
Comment Reply

Larry828 Larry828 1 year, 1 month ago

The most complicated part for me is the use of the variable "direction". I downloaded your demo and made a second copy where I added the Scratch Motion expression (direction) to the screen. (Of course, it always says the same thing as your "direction" variable on screen.) But (direction) only says which way the laser is pointed right now, but you want the laser beam to travel in the right path WHICHEVER way the laser is pointed....hence the variable? (I haven't been able to think of another way to tell the beam which way to go.) Ever since I noticed variables in peoples' projects I've been trying to think of a coding situation where I would HAVE to use a variable...and this may be one. For the "ammo" one could use a sprite with 6 costumes: 5,4,3,2,1,0.) The "will drive" fuel situation could, I think, also be represented by a sprite whose size steadily decreases until it's gone.) But the direction of the beam seems to need a variable. Is this true? [Is there a glitch in the demo? When I press "1" to enable the laser to move, all the targets disappear. In my second copy I disabled those commands for the targets and it seems to work fine.] Thanks for such a thought-provoking demo project!!

(view all replies)
Comment Reply

pedroskivich pedroskivich 1 year, 1 month ago

Thanks

(view all replies)
Comment Reply

Jens Jens 1 year, 1 month ago

an excellent variable demo!

(view all replies)
Comment Reply