Please create an account to participate in the Slashdot moderation system

typodupeerror
DEAL: For \$25 - Add A Second Phone Number To Your Smartphone for life! Use promo code SLASHDOT25. Also, Slashdot's Facebook page has a chat bot now. Message it for stories and more. Check out the new SourceForge HTML5 Internet speed test! ×

## JournalJournal: ARGHHHH!!!!!

WHY DOESN'T THIS WORK@%\$#@#\$^@!!!!!

on moveChar whichsprite, dx, dy

ox = sprite(whichsprite).locH
oy = sprite(whichsprite).locV

--find the slope of the line between the two points
--and reduce it

slopeN = (ox - dx)
slopeD = (oy - dy)

gcd = getGCD(slopeN, slopeD)

rorX = (slopeN/gcd)
rorY = (slopeD/gcd)

put ox, oy, dx, dy, slopeN, slopeD, gcd, rorX, rorY

--move the character based on the rise over run

repeat while ((sprite(whichsprite).locH <> dx) OR (sprite(whichsprite).locV <> dy))
if (sprite(whichsprite).locH <> dx) then
sprite(whichsprite).locH = (sprite(whichsprite).locH + rorX)
end if
if (sprite(whichsprite).locV <> dy) then
sprite(whichsprite).locV = (sprite(whichsprite).locV + rorY)
end if
end repeat

end moveChar

sigh. maybe director is ghetto and cant handle adding negative numbers?

## JournalJournal: Pay attention in class kids

See, this is why you should always pay attention in class, no matter how boring things seem.

So my last idea didn't work, but then I thought "why not just calculate each next point on the line between those two points"? So simple, so fscking obvious that I literally kicked myself for not thinking of it sooner.

Then came my next problem "how do I graph the next point on the line". I was sure I learned this in h.s. geometry, but since that was awhile ago (and about 3 1/2 years of funtime college ago), I embarked on a mathematical quest to figure out how to graph the next point of the line. So I figure out that I can subtract my destination x from my origin x, and destination y from my origin y, and the resutling numbers give me a rough plot point. Wow. Amazing.

Yea. Considering that every 7th grader learns how to do that under the name "rise over run", or the more technical term "slope", I think I will be encouraging youngsters not to fall asleep in algebra and geometry.

DOH! DOH! DOH!.

## JournalJournal: Movement Mathematics

Defining math equations to create movement in a matrix is harder than it looks. If you have a square matrix which is numbered sequentially from the first position from 1 to 81, how do you define a diagnol (or similar single line) path to go from point A in the matrix to point B?

Tried using a "touch" based formula which defines the values in an ever increasing square from the origin and the destination until a common point is found, which is then used as the first point in the line.

why do i have a feeling this isn't going to work?

# Slashdot Top Deals

Executive ability is deciding quickly and getting somebody else to do the work. -- John G. Pollard

Working...