This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#26 2013-01-09 16:55:33

Lorddalron
New Scratcher
Registered: 2013-01-06
Posts: 27

Re: Using pick_random block

Sorry, forgot to post the above link:

http://farm9.staticflickr.com/8464/8364756425_272a42b2ec_b.jpg

Offline

 

#27 2013-01-09 17:10:13

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Using pick_random block

Lorddalron wrote:

Sorry, forgot to post the above link:

http://farm9.staticflickr.com/8464/8364756425_272a42b2ec_b.jpg

Oh, no, you didn't have to do that. I already had your previous link to follow. Anyway, the problem I can see with your script is that you're gliding all the way to the bottom and doing your sensing when you hit the bottom, which you don't want. What you do want is to do the sensing while you're moving down, which'll mean that you need another repeat loop to move you down a pixel until you hit the bottom. Just to show you what I mean, here's a smaller project showing what you need:

Helpful Project

If you can't open it due to the fact that you have a mod, then here's a picture of the code/comments, which you'll have to zoom in on to see clearly:

http://i.imgur.com/9Z2e2.png

If you can't zoom in properly, just follow this link:

Link to Image

Last edited by ErnieParke (2013-01-09 17:12:14)


http://i46.tinypic.com/35ismmc.png

Offline

 

#28 2013-01-09 17:27:46

Lorddalron
New Scratcher
Registered: 2013-01-06
Posts: 27

Re: Using pick_random block

Oh boy we are getting there.  ive copied the script word for word, the only thing happening is some of the balls are hitting the peg and staying within the triangle

Does that make sense?

Also, what does the change y by -2 represent?

Offline

 

#29 2013-01-09 17:45:21

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Using pick_random block

Lorddalron wrote:

Oh boy we are getting there.  ive copied the script word for word, the only thing happening is some of the balls are hitting the peg and staying within the triangle

Does that make sense?

Also, what does the change y by -2 represent?

Not entirely, though to make sure, in your [change x by ()] block, you did use the operation that looks like this?

(((pick random (1) to (2)) * (20)) - (30))

Oh, and the [change y by (-2)] is what makes the ball move down.


http://i46.tinypic.com/35ismmc.png

Offline

 

#30 2013-01-09 18:56:56

Lorddalron
New Scratcher
Registered: 2013-01-06
Posts: 27

Re: Using pick_random block

Sorry for delayed response.  I had to go back over every thing and remove that stupid glide block i had in.  Im sure im doing good though up until now.

ok, in regards to the pick random block.  Could you tell me the process of how you linked them together,   i thought i had it but till no effect.

See where it says pick random, its sitting on top of two other blocks, i think im mixing them up to get the pick 1 to 2 * 20 -30 formula

Offline

 

#31 2013-01-09 19:01:21

Lorddalron
New Scratcher
Registered: 2013-01-06
Posts: 27

Re: Using pick_random block

Never mind..I take it was the mod block

You gotta love this * really....when it works

Time to test..................SUCCESS!!

I'll be back in 5, im off to run round the street naked

Offline

 

#32 2013-01-09 19:06:16

Lorddalron
New Scratcher
Registered: 2013-01-06
Posts: 27

Re: Using pick_random block

Right, although im a very happy and grateful chap right now.  It needs to do one last thing.

At the bottom of the stage, the balls are supposed to pile on top of one another to indicate how many balls have fallen to that particular path?

Offline

 

#33 2013-01-09 19:22:13

RenOkshadia3537
New Scratcher
Registered: 2013-01-09
Posts: 33

Re: Using pick_random block

Do you want it to stack where it stops 1 block ontop of another, or can they stamp themselves over eachother?

Offline

 

#34 2013-01-09 19:23:53

Lorddalron
New Scratcher
Registered: 2013-01-06
Posts: 27

Re: Using pick_random block

There currently stamping over each over. I need it to stamp one of top of the other :-)

Offline

 

#35 2013-01-09 19:28:28

RenOkshadia3537
New Scratcher
Registered: 2013-01-09
Posts: 33

Re: Using pick_random block

Lorddalron wrote:

There currently stamping over each over. I need it to stamp one of top of the other :-)

That is much harder than you'd think.
You'd need to have a way of collision detecting, with just one object.
It would be possible to have all of the end points saved in lists (possibly named "previousBallX" and "previousBallY"). You would then have to have a variable called imgH and imgW. Each one holding the height and width of the circle image respectively. It would be insanely slow, and I'll get to posting the necessary script in a little while (as it's quite long).

Offline

 

#36 2013-01-09 19:34:20

Lorddalron
New Scratcher
Registered: 2013-01-06
Posts: 27

Re: Using pick_random block

I would very much appreciate that, do you want a copy of the code so far to get you to where i am at?

Offline

 

#37 2013-01-09 20:43:14

Lorddalron
New Scratcher
Registered: 2013-01-06
Posts: 27

Re: Using pick_random block

i think i am going to have to go ahead and submit my work as the deadline is noon tomorrow and i'll not get time to do so in the morning.  i havent had much sleep this week and working again in the morning.

I could however go and catch up with a couple of shows on tv?  I dont want to step on your toes

Offline

 

#38 2013-01-09 20:56:12

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Using pick_random block

Lorddalron wrote:

I would very much appreciate that, do you want a copy of the code so far to get you to where i am at?

You do know that there's a different, much easier way? In your repeat until loop, you just repeat until you're touching the edge or the color of a ball. Then, if your touching the color of a ball, then you just move up till you're not touching the color of your ball. Then you repeat the process over again. Now that I noticied that this was a HW assignment, I won't give you the script, though you should be able to fix it from what I've told you.


http://i46.tinypic.com/35ismmc.png

Offline

 

#39 2013-01-09 21:02:54

Lorddalron
New Scratcher
Registered: 2013-01-06
Posts: 27

Re: Using pick_random block

I appreciate that Ernie.  I have struggled with this for days and is only part of a very large assignment. i study form home so i dont have the privilege of speaking to teachers face to face. Its all for one and one for all so thats why i came seeking help if anything.

Offline

 

#40 2013-01-09 21:28:50

Lorddalron
New Scratcher
Registered: 2013-01-06
Posts: 27

Re: Using pick_random block

ErnieParke wrote:

Lorddalron wrote:

I would very much appreciate that, do you want a copy of the code so far to get you to where i am at?

You do know that there's a different, much easier way? In your repeat until loop, you just repeat until you're touching the edge or the color of a ball. Then, if your touching the color of a ball, then you just move up till you're not touching the color of your ball. Then you repeat the process over again. Now that I noticied that this was a HW assignment, I won't give you the script, though you should be able to fix it from what I've told you.

im getting it to stack but only 2 at a time. If a third goes down the same path it ust gets re-stamped?

Offline

 

#41 2013-01-09 21:34:17

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Using pick_random block

Lorddalron wrote:

ErnieParke wrote:

Lorddalron wrote:

I would very much appreciate that, do you want a copy of the code so far to get you to where i am at?

You do know that there's a different, much easier way? In your repeat until loop, you just repeat until you're touching the edge or the color of a ball. Then, if your touching the color of a ball, then you just move up till you're not touching the color of your ball. Then you repeat the process over again. Now that I noticied that this was a HW assignment, I won't give you the script, though you should be able to fix it from what I've told you.

im getting it to stack but only 2 at a time. If a third goes down the same path it ust gets re-stamped?

Normally I don't like to give code for HW for obvious reasons, but since you can't see a teacher, I sympathsize. I'd like to look at your scripts again, though I won't  be able to see them till tomorrow because I have to go to bed now. Also, I won't be able to help till late tomorrow, so all I can say now is good luck!


http://i46.tinypic.com/35ismmc.png

Offline

 

#42 2013-01-09 21:40:42

Lorddalron
New Scratcher
Registered: 2013-01-06
Posts: 27

Re: Using pick_random block

ErnieParke wrote:

Lorddalron wrote:

ErnieParke wrote:


You do know that there's a different, much easier way? In your repeat until loop, you just repeat until you're touching the edge or the color of a ball. Then, if your touching the color of a ball, then you just move up till you're not touching the color of your ball. Then you repeat the process over again. Now that I noticied that this was a HW assignment, I won't give you the script, though you should be able to fix it from what I've told you.

im getting it to stack but only 2 at a time. If a third goes down the same path it ust gets re-stamped?

Normally I don't like to give code for HW for obvious reasons, but since you can't see a teacher, I sympathsize. I'd like to look at your scripts again, though I won't  be able to see them till tomorrow because I have to go to bed now. Also, I won't be able to help till late tomorrow, so all I can say now is good luck!

I'll quite while im ahead Ernie.  I have done as much as i can and like you, i need to sleep.

Im happy with what ive got, i need to get it sent in the morning so not to worry.
Thanks for all your help plus the others.

I'll be about as ive started my son with scratch and he's pretty good for a 12 yr old. 

Thanks again and good night

Offline

 

#43 2013-01-09 21:52:57

RenOkshadia3537
New Scratcher
Registered: 2013-01-09
Posts: 33

Re: Using pick_random block

I'm sorry about not posting the script, I had to go somewhere and didn't think it would really fit to say "g2g" on a forum.
Sorry, and it seems like you have it under control.
ErnieParke's way can be good, but there can be a few glitches that happen with it.
Some may be (I don't know really, as I haven't seen your project):
• The ball going through walls
• The ball not stopping
• Stamping over one another
• Going upwards when not supposed to

But those can happen in only certain scenarios, and it's WAY easier to start with his way.

Offline

 

#44 2013-01-10 20:50:05

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Using pick_random block

Lorddalron wrote:

ErnieParke wrote:

Lorddalron wrote:

im getting it to stack but only 2 at a time. If a third goes down the same path it ust gets re-stamped?

Normally I don't like to give code for HW for obvious reasons, but since you can't see a teacher, I sympathsize. I'd like to look at your scripts again, though I won't  be able to see them till tomorrow because I have to go to bed now. Also, I won't be able to help till late tomorrow, so all I can say now is good luck!

I'll quite while im ahead Ernie.  I have done as much as i can and like you, i need to sleep.

Im happy with what ive got, i need to get it sent in the morning so not to worry.
Thanks for all your help plus the others.

I'll be about as ive started my son with scratch and he's pretty good for a 12 yr old. 

Thanks again and good night

It's already past that night, though again, good night. Also, I wish you good luck with your project, and your class!

Last edited by ErnieParke (2013-01-10 20:50:34)


http://i46.tinypic.com/35ismmc.png

Offline

 

#45 2013-01-16 17:39:50

Lightnin
Scratch Team
Registered: 2008-11-03
Posts: 1000+

Re: Using pick_random block

Hi Lorddalron. We've been informed by representatives from OU that you are very likely a student taking coursework there.  This raises some interesting moral issues. 

On the one hand, it appears as though getting help on our forums is a violation of an agreement you have made with OU. On the other, getting help from online forums is an important skill for programmers to develop.

We want our forums to be a place for people everywhere to get help learning to program.  Speaking for myself here - and not the Scratch Team, whom I've yet to consult --  I don't think it makes sense for us to try to detect or prevent learning that may be in the service of completing a school assignment. In fact, I think finding outside resources to help with a school assignment is something that schools should reward. If an employee got help on a forum, and completed his task better and more efficiently, would their employer punish them for not doing it entirely on their own?

But this is a complex issue, born out of the increasing openness of a connected world, and there are many valid perspectives that should be heard. And my arguments above don't absolve you of responsibility for breaking an agreement with OU ( I'm assuming there is an explicit agreement about this. )

Given that you have an anonymous channel with which to share your thoughts on the issue,  what do you think?


Help Scratchers make the leap to 2.0!
http://img818.imageshack.us/img818/6844/transitionteam.jpg

Offline

 

Board footer