I think it would be cool to have a block that instead of always rounding to the nearest one, it could round to the nearest 10, 100, etc. It would look like this:
round (5) to nearest (10)or this:
round (5) to nearest [ten v]This could be useful for making games that involve placing buildings in a city, a level creator like Mario, word searches, and more. It could be used for rounding the mouse x or y or another sprite's x or y to go there or point there. I think it would be very useful. Don't you think?
mitchboy
Clank23
Lucario621
scimonster
veggieman001
K-Jam
PencilFactory
Haiming
muppetds
JabberJay
turkey3
ImagineIt
TorbyFork234
Daroach1
360-International
James07
Last edited by mitchboy (2012-04-07 11:19:18)
Offline
There is already a way to do it. Heres how:
round (5/10 * 10)
Last edited by bobbybee (2012-02-07 19:33:08)
Offline
bobbybee wrote:
There is already a way to do it. Heres how:
round (5/10 * 10)
I'll try to clarify this...
Let's say I have a number, 17.283. I want to round it to the nearest tenth. So I do this:
set [number v] to ( (round ( (17.283) * (10) ) ) / (10) )17.283 times 10 is 172.83, and 172.83 rounded is 173, and 173 divided by 10 is 17.3.
set [hundreds v] to ( (round ( (x) / (100) ) ) * (100) ) set [tens v] to ( (round ( (x) / (10) ) ) * (10) ) set [ones v] to (round (x)) set [tenth v] to ( (round ( (x) * (10) ) ) / (10) ) set [hundredth v] to ( (round ( (x) * (100) ) ) / (100) )However, I agree, a block for rounding to specific places would be handy.
Offline
Thanks for the workaround Lucario; I was wondering how to do that.
And I agree, it would be better to have a block. Also (round () [up/down v])
Offline
scimonster wrote:
Thanks for the workaround Lucario; I was wondering how to do that.
And I agree, it would be better to have a block. Also (round () [up/down v])
Add 0.5/0.05/0.005 before rounding to round up, subtract 0.5/0.05/0.005 before rounding to round down.
Offline
trinary wrote:
scimonster wrote:
Thanks for the workaround Lucario; I was wondering how to do that.
And I agree, it would be better to have a block. Also (round () [up/down v])Add 0.5/0.05/0.005 before rounding to round up, subtract 0.5/0.05/0.005 before rounding to round down.
Yeah, I found that out already too, but still, a block might be useful.
Offline
I support. They should add these blocks as well:
floor () ceil ()
Offline
veggieman001 wrote:
I support. They should add these blocks as well:
floor () ceil ()
That can be done already For floor, it's
(round((Number)-[0.5]))and for ceiling it's
(round((Number)+[0.5]))
Last edited by RedRocker227 (2012-02-08 10:56:12)
Offline
But there should be separate blocks for it anyway!
Offline
Ehh, I guess it would be more convenient. I never need to use those functions anyway though.
Last edited by RedRocker227 (2012-02-08 11:26:22)
Offline
RedRocker227 wrote:
Ehh, I guess it would be more convenient. I never need to use those functions anyway though.
Offline
veggieman001 wrote:
RedRocker227 wrote:
Ehh, I guess it would be more convenient. I never need to use those functions anyway though.
I know what they are, silly :> I mean that the chances are, I'll never need to use either of them in my project :3
Offline
RedRocker227 wrote:
veggieman001 wrote:
RedRocker227 wrote:
Ehh, I guess it would be more convenient. I never need to use those functions anyway though.
I know what they are, silly :> I mean that the chances are, I'll never need to use either of them in my project :3
Oh I know, but you can never be sure
Offline
Bklecka wrote:
its is in the exparamental viewer
but they took that down
Really? I don't see it. Click here and see if you can find it.
Offline
legoscratch wrote:
Bklecka wrote:
its is in the exparamental viewer
but they took that downReally? I don't see it. Click here and see if you can find it.
That takes me to the home page for some reason.
Offline
Cause They Took The Viewer Down!
EDIT: you can still find it here http://scratch.mit.edu//static/experimental/Scratch.swf
Last edited by Bklecka (2012-02-09 15:52:33)
Offline
veggieman001 wrote:
I support. They should add these blocks as well:
floor () ceil ()
Ooh that's a good idea. It is possible to do that right now, as shown below:
set [floor v] to (round ( (number) - (0.5) )) set [ceil v] to (round ( (number) + (0.5) ))But it's a bit of a hassle.
Offline
mitchboy wrote:
legoscratch wrote:
Bklecka wrote:
its is in the exparamental viewer
but they took that downReally? I don't see it. Click here and see if you can find it.
That takes me to the home page for some reason.
Yeah, me too. I'm on my iPod, so it may be something to do with that...
Offline
mitchboy wrote:
legoscratch wrote:
Bklecka wrote:
its is in the exparamental viewer
but they took that downReally? I don't see it. Click here and see if you can find it.
That takes me to the home page for some reason.
Weird... it works for me. Maybe it logs you out for some reason...?
Last edited by legoscratch (2012-02-09 18:34:55)
Offline
legoscratch wrote:
mitchboy wrote:
legoscratch wrote:
Really? I don't see it. Click here and see if you can find it.That takes me to the home page for some reason.
Weird... it works for me. Maybe it logs you out for some reason...?
I am using a Windows XP computer and it doesn't log me out. Some other people have reported this too. I've tried Chrome, Firefox, and IE, so it's not the browser.
Offline