Sorry for the probably stupid question, but I've just started and decided to first try my hand at making a pong game from scratch (no pun intended). I have mostly everything down, but I want to make it so the background switches if you hit an object that appears in the middle of the screen after 30 seconds. The if -> touching (ball) only counts if it is continuously touching the object. I want it so it only needs to hit the object to change the background, i.e. the ball only has to travel through the object.
Thanks.
Offline
You could use something like
Hide
wait (30) seconds
show
wait until (touching (ball))
broadcast (next background)
You can put this script in a forever block if you want to.
Offline
If I understand correctly, you have a sprite in the middle, and you want the background to change when the ball hits it? Then just have this on the sprite:
When green flag clicked repeat until < game over > if touching [ball] broadcast [switch] wait until <not <touching ball> > EndIf EndRepeat
And on the stage...
When I receive [switch] next background
Hope that helps!
P.S. <game over> is whatever condition(s) triggers a game over. (or a game over variable)
Last edited by Harakou (2010-09-03 22:09:04)
Offline
M303MTL wrote:
Sorry for the probably stupid question, but I've just started and decided to first try my hand at making a pong game from scratch (no pun intended). I have mostly everything down, but I want to make it so the background switches if you hit an object that appears in the middle of the screen after 30 seconds. The if -> touching (ball) only counts if it is continuously touching the object. I want it so it only needs to hit the object to change the background, i.e. the ball only has to travel through the object.
Thanks.
Use if touching, but put a 'Wait until [not <touching [object]>>]
Offline
Sprite:
Background:
I got epicly outposted!
Last edited by scratch_yoshi (2010-09-03 22:08:44)
Offline
M303MTL wrote:
Thanks for all the prompt responses guys, it works perfectly.
You're welcome!
Offline