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

#1 2010-06-08 17:55:23

iTest-747
Scratcher
Registered: 2010-05-24
Posts: 13

abs error

The abs function seems not to work on my newest Scratch project:

http://img251.imageshack.us/img251/6430/screenshot20100609at653.png

http://img59.imageshack.us/img59/6430/screenshot20100609at653.png


http://is.gd/dxYnC
You'll notice this is not iCode, it's iTest.  tongue

Offline

 

#2 2010-06-08 18:15:16

iCode-747
Scratcher
Registered: 2009-11-21
Posts: 1000+

Re: abs error

bump!

Why is this happening?  yikes

My newest, most epic game ever won't work without it!  yikes

EDIT: 1300th post!  tongue

Last edited by iCode-747 (2010-06-08 18:15:34)


-End Transmission-

Offline

 

#3 2010-06-08 19:55:15

climber59
Scratcher
Registered: 2009-12-15
Posts: 100+

Re: abs error

Abs reports the "distance" from zero so the abs of 142 is 142.


Check out my projects if you have a chance.

Offline

 

#4 2010-06-08 20:02:55

coka
Scratcher
Registered: 2007-11-03
Posts: 1000+

Re: abs error

climber59 wrote:

Abs reports the "distance" from zero so the abs of 142 is 142.

Exactly, so the distance of 142 from 0 is 142, and the distance of -142 from 0 is 142. I like to remember it as that it always makes numbers positive, so the positive numbers stay positive, and the negative numbers become positive. If you want to be able to change 142 between negative and positive, multiply 142 * -1 = -142, and -142 * -1 = 142. Hope this helps!  tongue


http://i42.tinypic.com/2rot8c2.png

Offline

 

#5 2010-06-08 21:47:59

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: abs error

I don't see anything wrong with what's happening. As climber59 and coka stated, it's doing exactly what it should be doing  big_smile  If you want to change it between negative and positive, like Coka said, multiply it by negative one. I can't stress how often I use that particular strategy.

Offline

 

#6 2010-06-09 01:47:00

iCode-747
Scratcher
Registered: 2009-11-21
Posts: 1000+

Re: abs error

coolstuff wrote:

I don't see anything wrong with what's happening. As climber59 and coka stated, it's doing exactly what it should be doing  big_smile  If you want to change it between negative and positive, like Coka said, multiply it by negative one. I can't stress how often I use that particular strategy.

OMG.

You guys are lifesavers. Deleting thread.  wink


-End Transmission-

Offline

 

#7 2010-06-09 05:16:58

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: abs error

coolstuff wrote:

I don't see anything wrong with what's happening. As climber59 and coka stated, it's doing exactly what it should be doing  big_smile  If you want to change it between negative and positive, like Coka said, multiply it by negative one. I can't stress how often I use that particular strategy.

Or, you can subtract it from zero.  It might be microscopically faster to do a subtract operation rather than a multiply operation  smile


http://i39.tinypic.com/2nav6o7.gif

Offline

 

Board footer