Alice Community Using While for an object to follow, and fall into a blackhole.

 Using While for an object to follow, and fall into a blackhole.
 Vickiisiu Junior Member   Status: Offline Posts: 2 Join Date: Feb 2012 Using While for an object to follow, and fall into a blackhole. - 02-03-2012, 06:56 AM Help! I need to have an animation where a penguin follows a black hole on the ground, which moves in random distances on the ground, and ultimately fall inside. I need to use the While to walk into the circles, have the circle move to random positions, and of course, allow the penguin to jump inside the black hole. I'm not sure how to do this because I'm a bit behind in my class. Can anyone help please?
 sfunk Senior Member     Status: Offline Posts: 1,112 Join Date: Mar 2011 Location: I don't know 02-03-2012, 12:10 PM First off, you need to break up your problem into smaller parts, such as how to make the black hole move randomly. How to make the penguin move, and lastly, how to get the penguin into the hole. Let's start with the random distance, this is pretty easy, all you do is your normal method to make the object move, then go to your world functions, there should be a random number function, now you can control what numbers that will be considered for use, I can't remember exactly how it goes but it should be min and max, min will be the lowest value it can choose, and max is obviously the largest number it can choose from, and once those are set a random number will be chosen by alice for the movement. Now you just need to make a method to make the penguin move towards the hole lastly, once the penguin is "with in" certain distance, it drops, which if you go to your penguins "functions" there should be a "with in" function. this refers to distance from the objects center. so now use an if/else statement, saying if the penguin is with in whatever distance, do drop method hope this helps If you are stuck on a project, check out the tutorials I made here at this link: http://alice.org/community/showthread.php?p=36778#post36778 There are lots of tutorials on it so far, including some youtube videos, check it out Or.. Go to my youtube channel to check out my alice 2.2 tutorials I have there.. http://www.youtube.com/user/sfunk1992?feature=mhsn
Vickiisiu
Junior Member

Status: Offline
Posts: 2
Join Date: Feb 2012
02-03-2012, 04:02 PM

Hey Sfunk, thanks so much for giving out a hand!! I managed to get the object I want to move at random locations on the ground, but I'm still stuck on another part.

I have two objects, one which a circle, moves around the ground at a random number. My "penguin", is supposed to turn and follow the to where it is at. Then once it arrives to the hole, it drops down.

I managed to link my penguin and circle together by making the circle's vehicle as the penguin, but I need to use WHILE in order for the pengiun to walk towards the hole. How do I do that? I went to your youtube videos, but I don't even know where you got the WHILEevent in the first place?

Here's what I got so far
Attached Files
 LAB3Q2.a2w (604.1 KB, 11 views)

sfunk
Senior Member

Status: Offline
Posts: 1,112
Join Date: Mar 2011
Location: I don't know
02-04-2012, 03:01 AM

well as you can see, there are two ways of using "while" since you were not clear on which one you had to choose, I showed both ways of getting it. the event is obviously an event and the one on the bottom is a method.

Normally this kind of event or method works bet with the use of variables. but since you should now be able to find where these are located, try it on your own
Attached Images
 help.jpg (90.5 KB, 30 views)

If you are stuck on a project, check out the tutorials I made here at this link:

There are lots of tutorials on it so far, including some youtube videos, check it out

Or..

Go to my youtube channel to check out my alice 2.2 tutorials I have there..