Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
move along a track?
Old
axeraider131
Guest
 
Status:
Posts: n/a
Lightbulb move along a track? - 02-10-2007, 12:33 PM

hello again,

my new idea was to have a game where a character moves along a hidden track (that isnt in a straight line). somewhat like Kirby 64. with curves and turns. if it is possible to do this, please respond, any help would be greatly appreciated. thank you.
   
Reply With Quote
See example in text for a start.
Old
DrJim
Guest
 
Status:
Posts: n/a
Lightbulb See example in text for a start. - 02-11-2007, 05:49 PM

This will take a little work, but is definitely possible.

For a start, I suggest you look at problem 4 in Chapter 6 of the textbook by Dunn, et all. This outlines the basic approach, which is to have the object move from point to point along a mathematically defined curve. This works well for some motions - swimming with sine waves per the example, ringing effects with sine waves that also decrease with time, parabolic curves for missle or cannon shells, etc.

For arbitrary curves, you will need to do curve fitting of some type - for a start, see the links at http://en.wikipedia.org/wiki/Curve_fitting. These generally do point by point fits - however this is still quite helpful, since it doesn't take a lot of points to define a fairly complex path. You just have to experiment a bit. It would be nice however to be able to simply fit to a drawn curve - anyone have any links for that?
   
Reply With Quote
The Tick?
Old
madden
Senior Member
 
madden's Avatar
 
Status: Offline
Posts: 322
Join Date: Mar 2006
Location: My own little world 0.0
Default The Tick? - 02-17-2007, 11:55 AM

What do you mean the Tick?
COOKIES!
   
Reply With Quote
Sorry
Old
madden
Senior Member
 
madden's Avatar
 
Status: Offline
Posts: 322
Join Date: Mar 2006
Location: My own little world 0.0
Red face Sorry - 02-17-2007, 01:04 PM

Sorry Wrong thread.
   
Reply With Quote
Old
chuck
Guest
 
Status:
Posts: n/a
Default 02-18-2007, 07:36 PM

I like the curve fitting method suggested by Dr. Jim, but is does require some math skills. Parametric equations work well for this. Think of it as plotting a curve, but the object will move from plotted point to plotted point. If you are only vaguely familiar with the math, then this is a good way to learn more about it while playing around with Alice.

A second approach is to place objects, such as the cone from the shapes gallery, along a path, then have the moving object move from one to the next, then the next, and so on, using the "move to" command together with the "turn to face" command. I suggest something like the cone because it is very simple object (only 2kb). You can leave it visible until you get the path the way you want it, then make the marker objects invisible by changing either the opacity property or the isShowing property for each of them.

You could also set up either a list or an array of the marker objects, then iterate through them with a loop. Chapter 8 in my first Alice book (An introduction to Programming using Alice) and chapter 5 in Joel Adams' first book (Alice in Action) cover arrays and lists. The Dann, Cooper and Pausch book (Learning to Program with Alice) does as well, but I don't have a copy handy to look up the chapter reference.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.