How to move a ball on the surface of a line?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
alex298
Posts: 101
Joined: Mon May 01, 2006 1:17 pm

How to move a ball on the surface of a line?

Post by alex298 » Wed Apr 09, 2008 2:50 pm

Hi,

I use the following syntax to move a ball (center of ball) along a line:

move graphic "ball" to the points of graphic "Line"

I have some questions:

1. I wish the ball to move on the surface of the line. How can I do that?

2. I layout another button and use stop moving graphic "ball" to stop the ball moving. However when I clicked the button to move the ball again, the ball is always starting from the beginning, not from the stopped position. How can I make the ball resume the journey from the stopped position?

Best regards
Alex
Nice to meet all of you.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Wed Apr 09, 2008 3:38 pm

The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

alex298
Posts: 101
Joined: Mon May 01, 2006 1:17 pm

Post by alex298 » Thu Apr 10, 2008 5:10 am

Hi Mark,

Thanks for your kind assistance.

However I still cannot figure out how to resume the motion from the stopped location.

I have another question:

move graphic "ball" to the points of graphic "hexagon" in 15 seconds

I wish to trigger some actions when the ball move to the corners of the hexagon. For example, when the ball move to the first corner, stop, do something, then move again.... How can I do that?

Thanks and best regards
Alex
Nice to meet all of you.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Thu Apr 10, 2008 8:45 am

Hi Aex,

What is your current script, that makes the ball move?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

alex298
Posts: 101
Joined: Mon May 01, 2006 1:17 pm

Post by alex298 » Thu Apr 10, 2008 9:30 am

Hi Mark,

Actually I am doing a simple stuff for kids.

Here's the details of my project:

1. The card has the following objects:
- graphic "ball"
- graphic "hexagon"
- button "Move"
- button "Stop"
- field "Turn"

2. Button "Move" Script:

on mouseUp
move graphic "ball" to the points of graphic "hexagon"
end mouseUp

3. Button "Stop" Script:

on mouseUp
stop moving graphic "ball"
end mouseUp

Here's what I wish to do:

1. The graphic "ball" will move along graphic "hexagon" when click on the Button "Move".

2. The graphic "ball" will stop when click on Button "Stop"

3. The graphic "ball" will continue the move from the stopped location when click on the Button "Move"

4. When the graphic "ball" move to a corner of the graphic "hexagon", it will stop for 2 seconds, and a message will appear in the text field "Turn".

Thanks and best regards

Alex
Alex
Nice to meet all of you.

Post Reply