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.
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!!
This is not a real game just to teach about variables.
At the game start I set ammo to 5 when space key pressed I had it check to see if ammo is over 0. If ammo is over 0 then it shoots the lazer and takes away 1 ammo.
to turn and aim at the blobs use the left and right arrow keys.
The can drive variable is for true or false to say if the machine can move. When you press the 1 key it sets the "can drive variable to 1 and lets the machine move with the up arrow key.
Any questions?
Comments
You need to be logged in to post comments
Add a Comment
pretty cool!
(view all replies)Comment Reply
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
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
Thanks
(view all replies)Comment Reply
an excellent variable demo!
(view all replies)Comment Reply