I apologize for posting another topic so soon after my last one, but I've spent the better part of an hour trying to find a solution for what seems like it should be really simple. Basically, in this same pong clone I made the last topic about, I want a player's score to go up by 1 when the ball hits the wall behind the enemy's bar. No matter what I try, I can't get the number to go up. I've tried making a colored bar as a goal of sorts and increasing the variable when they touch, and I've tried broadcasting a switch upon contact with the goal. Even trying to just put it as a score whenever it hits any edge doesn't change the score variable for some reason.
I'm sure it's really simple but has somehow deceived me, but how do I make it so when it hits the goal the score goes up?
Offline
[blocks]<if><touching color[ goal color ]
<broadcast[ Score on 1 ][/blocks]
and i've tried replacing that "if" bracket with a "forever if" bracket
Then in the stage script (it could be in any, right?)
[/blocks]<when I receive[ Score on 1 ]
<change{ P2 }by(1)[/blocks]
Offline
Interesting… And you have the green flag atop the first script, correct?
Make sure the first script is a "forever if" - and insidei it, place this script:
Change score by 1
Wait until <not <touching colour of goal> >
And everything should work… You don't need to use broadcasts.
Offline
M303MTL wrote:
Thanks a lot for the help man, sorry for my incompetence
![]()
Are you kidding? Don't bring yourself down- everyone has to learn at some point! People aren't just born able to do things! Don't be so hard on yourself
Offline
M303MTL wrote:
Thanks a lot for the help man, sorry for my incompetence
![]()
No problem - but you're nowhere near being incompetent. Keep in mind that my first game was absolute rubbish, and look at my last game, and you'll see where learning takes you.
Offline