On Activity 11 I can not get counter to work but can get sprite to get larger


#1

For Lesson 13, Activity 11

I followed the teacher notes exactly and the red sprite gets larger but the click counter stays at zero.
I have tried so many different combinations but I can’t get the counter to work.
My class is going over this on Monday so any assistance about what I’m doing wrong would be greatly appreciated. Thank you. Elaine


New member guide me
New member guide me
Https://studio.code.org/s/csd3-2018/stage/13/puzzle/11?section_id=1676192
#2

Update- I was able to get it count but I do not know why I did what I did except that is how it was done in Activity 12.

When I completed activity 12 I saw that the var mouseMoveCount = 0 block did not use a sprite.x
So I went aha I bet I should not have used that code (sprite.x renamed clicks) in the purple non var block with a sprite.x changed to clicks.x = sprite.x changed to clicks.x +1. I took the sprite.x named clicks out and just typed in clicks and it worked.

So the million dollar question is when do you use a sprite.x in a orange math-numbers block and when do you just type in the name of the variable in a orange math-numbers block?

I have a feeling this is a very important concept that is totally over my head :slight_smile: until someone nice can explain it to me.


#3

Miss W,

Can you share the code with the forum so more people can see it? You shared the level, rather than your code - use the “Share” button in the top left corner. The sprite.x is only referring to the sprites x position, the counter is increasing based on adding one each time a condition happens in the draw loop.

Thanks, and looking forward to figuring this out with you!

Brad


#4

Hi Bradley,
I found the share button and the link , I tried to edit and share but it would not work. I am going to a Saturday class this weekend and will ask how to share. On the earlier post it, I believe I copied and pasted but it would not let me work for this one. Thank you for your help.

I’m also going to ask my million dollar question because I understand that sprite.x is sprite x’s position but I don’t understand what it is when I just type a name or number in the math block. Total newbie on coding but I love it more than some of my students :slight_smile:

Have a nice day! Elaine


#5

Elaine,

So, I think I understand the million dollar question. Sprite.x is a built in variable that the system knows because it is a keyword. Other variables are defined by the user and so you need to declare/assign them before you use them in the code.

Does that answer? Sorry if it doesn’t but let’s continue to figure it out together!
Brad


#6

Thank you so much for answer. I appreciated your help.