Alice Community  

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

Reply
 
Thread Tools Display Modes
Using While for an object to follow, and fall into a blackhole.
Old
Vickiisiu
Junior Member
 
Status: Offline
Posts: 2
Join Date: Feb 2012
Default 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?
   
Reply With Quote
Old
sfunk
Senior Member
 
sfunk's Avatar
 
Status: Offline
Posts: 1,112
Join Date: Mar 2011
Location: I don't know
Default 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
   
Reply With Quote
Old
Vickiisiu
Junior Member
 
Status: Offline
Posts: 2
Join Date: Feb 2012
Default 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
File Type: a2w LAB3Q2.a2w (604.1 KB, 11 views)
   
Reply With Quote
Old
sfunk
Senior Member
 
sfunk's Avatar
 
Status: Offline
Posts: 1,112
Join Date: Mar 2011
Location: I don't know
Default 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
File Type: jpg help.jpg (90.5 KB, 30 views)


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
   
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 ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.