Board game with pieces / scrolling images in sync?

Scott Rossi scott at tactilemedia.com
Wed Jan 9 14:49:13 EST 2008


Recently, Joshua Lawrence wrote:

> how does adding/removing pieces during play work when the
> pieces are grouped with the board?  Are 'out-of-play'
> pieces actually on the board at all times, but you
> make them invisible when necessary?  Or do you
> add/remove pieces to the group via scripting
> throughout a game session?

I would suggest changing the visibility of the pieces or moving them off
screen but keep them in the group.  Moving objects in and out of groups is
more complicated and probably not worth the effort in your case.  Remember
that moving an object outside the current rect of a group will cause the
group to scale to encompass the object, so you may want to lock the group
first to maintain its dimensions.

  hide graphic "myCoolPiece"
  set top of graphic "myCoolPiece" to -100

> Also, is there a good tutorial on using relative
> positions?  The Rev docs seem to be skimpy on the
> subject.

If I understand what you're asking, this is easy.  The following examples
create instantaneous moves:

[move an object upward 20 pixels]
  set the top of graphic "coolPiece" to the top of graphic "coolPiece" - 20

[move an object to another object's position]
  set the loc of graphic "bot1" to the loc of graphic "bot2"

Keep in mind you have 9 positional descriptors for objects you can
reference:
- topLeft   top   topRight
- left   loc   right
- bottomLeft   bottom   bottomRight

If you want to achieve more animated movement, see the move command in the
docs.  There are also tons of examples in folks' User Spaces on RevOnline.
If you want to dive deep, take a look at Animation Engine:
http://revstudio.runrev.com/section/revselect/arcadeengine/

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design





More information about the use-livecode mailing list