I need some help figuring out how to get the point and live variables to change. My game is a memory game, where the player has to remember the food items on the shopping list and then catch the right food in the cart. If they catch the right food, I want a point to be added, but if they catch the wrong food I want a live to be lost. I am wondering how this coding is possible. I have attached the link below and if you could take a look and help me out this would be greatly appreciated. Please comment with any suggestions. Thank you!
http://scratch.mit.edu/projects/alisonwong7/2200334
Offline
Here's a clickable link to make it easier for people to check out your project:
http://scratch.mit.edu/projects/alisonwong7/2200334
This would be a good application to use a List. Under the Variables tab, you have the option "Make a list". I'd make it for All Sprites and call it something like Shopping List. Delete all items from it at the start of the project and add the three things you are looking for when they are randomly picked, such as "Bread", "Cheese", "Cherries" or whatever.
Each item that is to be dropped picks a costume and assigns a local variable (this sprite only) called maybe "Me" with the name of the food that it is going to be. Then, have the dropped objects that hit the cart check to see if they are on the list with the
<Shopping List contains "Me">
block and assign points or lives lost accordingly.
Offline
This is a good idea and it would probably work well for my game, but now I don't think that this is the main thing I am doing wrong. I have posted a more updated version "Cart Catcher updated". The point variable is now working, however, the live variable is not. Every time I get the right food a point will be added however, lives are still being lost. As well as this, every time a food is caught a different amount of lives are lost, usually 5,4 or 3. I would like only one life to be lost.
Please download my game and help me find the error in my coding! This would be much appreciated!!
link: http://scratch.mit.edu/projects/alisonwong7/2204500
Sorry if this link is not the right one.
Offline
Well, for one, the food that comes down are too close together and come down at the same time. You might want to time them differently to make it easier to catch the correct food. That is probably why it is losing 5 lives at a time. Try spreading them out more and see if that helps.
Offline
That took me forever... TONES of scripts you have there! But I managed to fix some of it.
Here is the revised project
Offline
I tried your game, and it was very fun! In your project notes, you added that your live variables are still not working, and I definitely see that. I think you might have a script that goes similarly to...
[blocks]<when green flag clicked>
<forever>
<if><touching[ your sprite]>
<change{ lives }by( -1)>
<end>
<end>[/blocks]
This is a common error with variables that I often have a lot. This script repeatedly changes your lives -1 because it's still touching that sprite, even if it looks like a short amount of time.
Try adding a block like [blocks]<wait until<< <not> <touching[ >>>[/blocks] so that this won't happen. (after the change lives block)
Last edited by fuz50 (2011-12-09 18:51:18)
Offline