Discuss Scratch

sotosbic
New to Scratch
12 posts

I can't get scratch to return the subtraction of 2 x positions

if <[((([abs] of (x1)) - ([abs] of (x2)))] > [30]> then

end

Why is that subtraction not working?

Last edited by sotosbic (Dec. 5, 2017 19:55:11)

Despicable_Dad
Scratcher
500+ posts

I can't get scratch to return the subtraction of 2 x positions

Have you made sure x1 is bigger than x2 beforehand?




I'm a Scratch Wiki contributor, and always keen to know which bits of the wiki are unclear. If I can, I'll try to improve things; otherwise, I'll make sure it's brought to the attention of someone who actually knows what they're talking about.
if <not <touching color [#3d4fe4] ?>> then
return true anyway cos computers are vague, innit
change [scratchFoibles v] by (1)
end
if <[a] = [A]> then
think [What???]
change [scratchFoibles v] by (1)
end



sotosbic
New to Scratch
12 posts

I can't get scratch to return the subtraction of 2 x positions

It doesn't matter because I took the subtraction and tried to output it in a variable
sotosbic
New to Scratch
12 posts

I can't get scratch to return the subtraction of 2 x positions

Despicable_Dad wrote:

Have you made sure x1 is bigger than x2 beforehand?
It seams like the subtraction it's never happening because i tested with this thing https://imgur.com/a/uAvdN. And the variable it's not changing
asivi
Scratcher
1000+ posts

I can't get scratch to return the subtraction of 2 x positions

Despicable_Dad wrote:

Have you made sure x1 is bigger than x2 beforehand?
sotosbic
New to Scratch
12 posts

I can't get scratch to return the subtraction of 2 x positions

asivi wrote:

Despicable_Dad wrote:

Have you made sure x1 is bigger than x2 beforehand?

It doesn't matter because we have put “absolute” for every x
deck26
Scratcher
1000+ posts

I can't get scratch to return the subtraction of 2 x positions

sotosbic wrote:

asivi wrote:

Despicable_Dad wrote:

Have you made sure x1 is bigger than x2 beforehand?

It doesn't matter because we have put “absolute” for every x
So if x1 is 20 and x2 is -30? If you want the difference between two x values subtract one from the other and then use the abs function on the result.
sotosbic
New to Scratch
12 posts

I can't get scratch to return the subtraction of 2 x positions

deck26 wrote:

sotosbic wrote:

asivi wrote:

Despicable_Dad wrote:

Have you made sure x1 is bigger than x2 beforehand?

It doesn't matter because we have put “absolute” for every x
So if x1 is 20 and x2 is -30? If you want the difference between two x values subtract one from the other and then use the abs function on the result.

exactly that. I want the result 10 to use it in an if condition like here https://i.imgur.com/gHpB9AI.jpg
deck26
Scratcher
1000+ posts

I can't get scratch to return the subtraction of 2 x positions

So do as I say, abs(x1-x2)
sotosbic
New to Scratch
12 posts

I can't get scratch to return the subtraction of 2 x positions

deck26 wrote:

So do as I say, abs(x1-x2)
oh i see so it's the abs of x1 - x2 not the abs of x1 minus the abs of x2. get it. thank you very much

Powered by DjangoBB