Discuss Scratch

jbhcoder
New to Scratch
3 posts

position comparison

Till yesterday, I was able to check position with
<(x position) = [40]>  
or any integer, and it worked. But now it is suddenly stopped working. I now have to perform
<([ceiling v] of ((x position))) = [40]>  
Has this behavior just changed?
Thingied
Scratcher
1000+ posts

position comparison

Check if it has some decimals at the end by clicking the x position reporter.
jbhcoder
New to Scratch
3 posts

position comparison

Yes, it has. That's why I have to now use the ceiling function. But I did not have to do that earlier. Is there a way to make it not have those decimal places?
MasterofTheBrick
Scratcher
1000+ posts

position comparison

You can round off decimals to whole numbers using the round () operator.

(round ())
Thingied
Scratcher
1000+ posts

position comparison

jbhcoder wrote:

Is there a way to make it not have those decimal places?
set x to (0) // Reset the position to a whole number so it won't have any decimals

Last edited by Thingied (Aug. 23, 2021 14:29:20)

jbhcoder
New to Scratch
3 posts

position comparison

Thingied wrote:

jbhcoder wrote:

Is there a way to make it not have those decimal places?
set x to (0) // Reset the position to a whole number so it won't have any decimals
Already doing that, but I am also doing a
move (15) steps 
after which it always adds the decimal places
Thingied
Scratcher
1000+ posts

position comparison

jbhcoder wrote:

Thingied wrote:

jbhcoder wrote:

Is there a way to make it not have those decimal places?
set x to (0) // Reset the position to a whole number so it won't have any decimals
Already doing that, but I am also doing a
move (15) steps 
after which it always adds the decimal places
The round off the coordinates after.
move (15) steps
go to x:(round(x position))y:(round(y position))
If this gets too tedious, make a custom block to do it instead.
move (15) steps :: custom
define move (steps) steps
move (steps) steps
go to x:(round(x position))y:(round(y position))

Last edited by Thingied (Aug. 23, 2021 15:38:40)

Powered by DjangoBB