Mole Mash game help! I have two sprites one adds the score and the other minuses the score, i also have trouble speeding up and slowing down the game

i keep getting this whenever i'm trying to subtract the score : (
Runtime Error
The operation - cannot accept the arguments: , [""], [-1]
Note: You will not see another error reported for 5 seconds.


i'm also a beginner, i have no idea what i'm doing lol

Math blocks "hate" blank so most probably HitsCountLabel text is blank, set it to 0

image

3 Likes

thank u!! but i already have it on 0 tho D:

  1. You should be subtracting by 1, not by -1 (subtracting by -1 will result in the number being added by 1)
  2. What happens when you initialize global score to 0?
1 Like

thank you!! i've done both of that now but whenever i touch the second sprite the score just becomes "-1" instead of actually subtracting the score..

Even when the score is 0, the code tries to subtract 1 from it, making the score -1. You should check to see if it is 0 before subtracting:

Also, when Mole.Touched, you should increment the score by 1 (or the score will stay at 0).

1 Like

ooh i've tried that now but now the score stays at either 1 or -1! D: did i do it right?

I apologize, I had not seen the Canvas1.Touched event. Please undo the changes you've made, and implement only my first suggestion in the Mole2.Touched event.
Disregard the second as it was wrong.

1 Like

oh that's alright! i've undone the changes now, the hits are working now! but the second sprite still won't subtract properly..

Here's what the Mole2.Touched event should look like:

...unless you want to reset the score...?

1 Like

OH MY GOSH IT WORKED NOW!!!!!! THANK YOU SOOOO MUCH I'M SO GRATEFUL FOR YOU!! YOU HAVE NO IDEA! i've been wracking my head for days now on how to fix it and NOW IT'S FIXED!! THANK YOU SO SO SOSOSOS MUCHHHHH!! YOU'VE HELPED ME ALOOOTT!!! <3
all i have to do now is fix the speeding up and slowing down aswell as the first screen!!

How do I make mole mash sprites go faster and slower?

i've checked other posts and it won't work for me : (

Speed is the speed at which the ImageSprite moves. The ImageSprite moves this many pixels every Interval milliseconds if Enabled is true.

You tried

speed1

which does not reset the Mole's actual speed.

Perhaps
Slower should set Mole.Speed to the new speed.
Faster should set Mole.Speed to new speed.
and your code does not do that. :cry:

aw : ( how do i do that?.. i apologize, i'm still new to this..

I guess

speed1

might work.

you need a set mole.speed to speed in slower block too.

Reading Drawing and Animation might help.

ah thank you! it worked but they only go to one directon instead of popping up everywhere.. and when i press the buttons again it won't become more slower/faster
did i do it right?
image

No. You also need a set speed to speed - 15 in the Slower.Click

minus

ohh okay fixed it now! but how do i fix the way they're moving? or is that just natural that they move to one side?
image

You need to supply the information to tell the sprite the direction where you want it to go

Heading is the ImageSprite’s heading in degrees above the positive x-axis. Zero degrees is toward the right of the screen; 90 degrees is toward the top of the screen.

ahh so like this?