In my game of breakout, i have blocks that need to be hit to got rid of and although the ball will generally bounce off of the bricks, the bricks quit often o not react (they are meant to crack 1st time and hide 2nd time. Hitting the bricks at the side seems to work better but it sometimes works head on. Also the trampoline rarely reacts to the ball, but does when it is hit on the side.
Is there anything I can do or is this a bug?
Offline
Trob, it's not a bug, it's a race condition between threads. Depending on how the Scratch interpreter schedules the threads, the program stack of the block may never have a chance to "see" the ball bouncing off of it, because the program stack of the ball causes the ball to move away from the block immediately.
To fix the problem, just add a "wait 0 secs" block in all the ball stacks between the "forever if touching..." block and the "point in direction 180 - direction" block. The zero-delay causes the Scratch scheduler to dispatch the other threads that are ready to execute.
Hope this helps
--Alex
Offline