Project Folders
Teacher Resources
Student Resources
How Do I?
Site Map
Our Team

MWForum Message [Date Index] [Threads] [Authors] [Attachments] [Subscribe]

[Thread Prev] [Thread Next]

Subject: animated pegs
From: mwforum@xxxxxxxxxxxxxxxxxx (Jeff Knope)
Date: Sun, 20 Apr 2003 08:13:06 -0700

Mike Sandy wrote

> I attach a 15-peg game based on two pentagrams,
> but of less elegant design than J's.
> The labelling (starting with 1) is from top to bottom, 
> left to right, so the outer pentagram is (1 5 15 14 12)
> the inner one (3 4 12 13 9).

I've been tinkering with animation in MW.  Mike's game seemed a likely
candidate: a game board, pegs jumping each other and others flying off the
board.  (Actually, J's is a good candidate too.  Except so far I haven't been
able to solve his puzzle.)

I've left all of Mike's code exactly intact, only inserting the JUMP and
FLYOFF procedures at the appropriate places.  For some reason I don't quite
get, FLYOFF was getting called twice, so I added a flag to stop that.  And
Mike's toggle between the red peg and blue hole in his flash procedure looked
a bit pornographic in 3D, so I shifted the toggle to a different shape-pair,
so there is only a flashing color change in the peg shaft. My additions to
Mike's code is in all-caps, except the two new procedures at the bottom.

Mike's peg labelling from top to bottom was particularly fortuitous because
both JUMP and FLYOFF need to increase in scale as the action moves lower on
the screen.  So using the peg number as a factor in scaling both jumps and
flyoffs helped that problem.

I'm pretty sure I've repeated an earlier mistake Michael A pointed in clumsy
dealing with sign changes.  There are a couple long ifelse's whose only
difference between the if and the else is a "+" and a "-".  Maybe MA (or
anybody) can give me a hand here.


Attachment: Animated_Pegs.mw2
Description: Binary data

  • Previous by thread: CosmicPortal refined
  • Next by thread: Re: animated pegs

  • To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.

    © copyright 2001 - 2008