Pages: 1
What numbers should I use with the Pick random [] to []; to determine whether a ball falling down the screen vertically would deflect off a box in the middle of the stage, left or right? It has to deflect, move around it and then continue with it's decent towards the bottom of the screen, the ball cannot go over -175 Y and must stop there. Have been struggling with this, any ideas?
Offline
...
...
...
1. ENGLISH pl0x. me no speak your improper grammar talk.
Is this what you're trying to say?
FreaK001 wrote:
What numbers should I use with the Pick random [] to [] to determine whether a ball falling down the screen vertically would deflect off a box in the middle of the stage (making it go left or right)? It has to deflect, move around it and then continue towards the bottom of the screen, the ball cannot go over -175 Y and must stop there. I've been struggling with this, any ideas?
If that's what you want, just use the bounce block in the motion section...
If it goes straight down, make the random number 1-50 in terms of rotation in degrees so it'll bounce in different sections.
Offline
FreaK001 wrote:
What numbers should I use with the Pick random [] to []; to determine whether a ball falling down the screen vertically would deflect off a box in the middle of the stage, left or right? It has to deflect, move around it and then continue with it's decent towards the bottom of the screen, the ball cannot go over -175 Y and must stop there. Have been struggling with this, any ideas?
Well, I suggest putting in the numbers 1 and 2, and then using the (pick random () to () ) in an if statement that controls your ball's movement.
Well, I hope that this helps! Also, hello FreaK001 and welcome to Scratch! I hope that you'll have a great time here!
With regards,
ErnieParke
Last edited by ErnieParke (2013-04-26 20:37:16)
Offline
Pilplup wrote:
...
...
...
1. ENGLISH pl0x. me no speak your improper grammar talk.
Is this what you're trying to say?FreaK001 wrote:
What numbers should I use with the Pick random [] to [] to determine whether a ball falling down the screen vertically would deflect off a box in the middle of the stage (making it go left or right)? It has to deflect, move around it and then continue towards the bottom of the screen, the ball cannot go over -175 Y and must stop there. I've been struggling with this, any ideas?
If that's what you want, just use the bounce block in the motion section...
If it goes straight down, make the random number 1-50 in terms of rotation in degrees so it'll bounce in different sections.
No need to correct grammar, Pilplup. It's almost flawless, and he may speak English as his native language. Unless it's a formal paper, there's no need for pure grammar. If I wrote in pure grammar conventions all the time, it would actually be hard to read.
Welcome, FreaK! I hope you enjoy your stay here on Scratch! I would do pick random (1) to (2) and then set the direction accordingly, repeat until off the block, and continue.
Offline
Hey guys, thanks for your replies.. Even though that my grammar is very poor (apparently)
I'll add some more info that you guys will need to know, I have to set a variable which I use with the pick random box. I have called this whichWay.
So, I have to set whichWay to pick random [] or [] and use that within my script. I have taken a picture of it so you guys can see, unfortunately I cannot upload my project as I am using Sense and can't seem to open my project within scratch.
http://tinypic.com/r/35kncl0/5
Now, when I run the script. On occasion the ball will deflect off the box left or right at random, this is what I want it to do, but I believe because my ranges of pick random [] to [] are wrong. The problem is, this is the closest I have got to making this happen, using 1 or 2 seems to mess everything up! I'm not far off what I want it to do, it's just finalising it and making it perfect!
Hopefully this is enough for someone to crack, want this out the way.... Thanks anyway to everyone who greeted me to the scratch network, I say hello to you all too!
Offline
FreaK001 wrote:
Hey guys, thanks for your replies.. Even though that my grammar is very poor (apparently)
I'll add some more info that you guys will need to know, I have to set a variable which I use with the pick random box. I have called this whichWay.
So, I have to set whichWay to pick random [] or [] and use that within my script. I have taken a picture of it so you guys can see, unfortunately I cannot upload my project as I am using Sense and can't seem to open my project within scratch.
http://tinypic.com/r/35kncl0/5
Now, when I run the script. On occasion the ball will deflect off the box left or right at random, this is what I want it to do, but I believe because my ranges of pick random [] to [] are wrong. The problem is, this is the closest I have got to making this happen, using 1 or 2 seems to mess everything up! I'm not far off what I want it to do, it's just finalising it and making it perfect!
Hopefully this is enough for someone to crack, want this out the way.... Thanks anyway to everyone who greeted me to the scratch network, I say hello to you all too!
Well the issue I see with your script is that sometimes you don't turn a full 90º due to the pick random you've chosen. So to fix this, we'll either need to alter your variable or introduce a script. The first possibility is to set (whichWay) to:
(((pick random (1) to (2)) - (1.5)) * (180))
if <(pick random (1) to (2)) = (1)> Do something... else Do something else... end
Offline
ErnieParke wrote:
Well the issue I see with your script is that sometimes you don't turn a full 90º due to the pick random you've chosen. So to fix this, we'll either need to alter your variable or introduce a script. The first possibility is to set (whichWay) to:
(((pick random (1) to (2)) - (1.5)) * (180))
Ernie, thank you for your quick reply. I have to use the variable as part of my script, I have done the above however no luck, as it only bounces to the right.
Offline
FreaK001 wrote:
ErnieParke wrote:
Well the issue I see with your script is that sometimes you don't turn a full 90º due to the pick random you've chosen. So to fix this, we'll either need to alter your variable or introduce a script. The first possibility is to set (whichWay) to:
(((pick random (1) to (2)) - (1.5)) * (180))Ernie, thank you for your quick reply. I have to use the variable as part of my script, I have done the above however no luck, as it only bounces to the right.
Oh, wait... I forgot to point out another issue with your script. Along with the changes I suggested above, you have to move your [change [whichWay v] to ()] block into your if so that it looks more like this:
if (touching color [#FF0000] ?) set [whichWay v] to () Scripts... end
Offline
Pages: 1