Alice Community  

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

Reply
 
Thread Tools Display Modes
How can I make a frog move forward with user's help?
Old
HalBen18
Junior Member
 
Status: Offline
Posts: 12
Join Date: Jan 2014
Location: Cedar Hill, TX
Post How can I make a frog move forward with user's help? - 02-25-2014, 02:59 PM

I'm trying write a hop method that makes a frog hop in a realistic fashion with a parameter that lets the sender of the message specify how far the animal should hop. I'm not sure how to do this. Help please?
   
Reply With Quote
Actions in general
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default Actions in general - 02-26-2014, 09:54 AM

Quote:
Originally Posted by HalBen18 View Post
I'm trying write a hop method that makes a frog hop in a realistic fashion with a parameter that lets the sender of the message specify how far the animal should hop. I'm not sure how to do this. Help please?
I am not sure what "the sender of the message" means, but in general add a hop method to the frog and include a numeric parameter that will determine how far the frog jumps. The name of the parameter should be something descriptive like 'distance' or 'howFar'
When you are done you will have a frog with a new method 'hop' that takes a parameter 'howFar' and uses that value to determine how far the frog should jump. If you need to get a users input then make a numeric variable in the world, again called something descriptive maybe 'hopDistance'. Set the value of 'hopDistance' to whatever the user gives you and then call frog.hop hopDistance.

As far as how to make the frog look like it is hopping, below is my generic advice for these kinds of actions:

Actions in general.
  1. Do some hops and think about what is changing / moving at different stages during the exercise. Also look at frogs hopping - google, youtube ...
  2. Method 1 - Programming the action
    1. Translate those movements into individual steps for the object you are using.
    2. Try to use roll and turn actions on sub-objects whenever possible.
    3. Be VERY careful when moving sub-objects. Sub-objects usually have their vehicle set to the next highest sub-object in the object, or to the object itself. Moving a leg for instance usually results in the leg becoming detached from the character but still moving when the character does.
    4. Look for what actions have to happen at the same time - do together - and what groups of actions happen one after another - do in order.
    5. Start out ruff and get it working. Break your action down into 3 or 4 major steps and get those working. Then go back and look at each step and see what you can do to make it better.
    6. CRUCIAL when your movement is done ensure that the object is back in its initial position. It may have moved, turned around or whatever but the sub-objects should all be positioned with respect to the main object as they were before the move.
    7. If this is not the case your movement will cause the object to gradually "fall apart" in some way. One or two repetitions of your actions might look okay but 100 reps will cause some weird behaviors.
    8. This is especially true if you have moved a sub-object.
  3. Method 2 - Use Poses.
    1. Alice allows you to position a character the way you want and then capture that position as a pose. When, during the movie you change from one pose to the next Alice will not just "flip" from one position to the other but will morph giving a smoother appearance than you would expect.
    2. Caveats
    3. Before you move the object capture an initial pose. This allows you to return to the objects initial "configuration" i.e. all the sub-parts are back in place.
    4. Before capturing a pose ensure the object you want is selected. If you move an arm, an leg and a foot and then capture the pose, that pose will likely be created on the object's foot. Later when you look for it on the object it won't be there. The pose still exists but you are looking at the whole object if you navigate to the foot you will see the pose.
    5. Name the pose. While pose 1 and pose 2 might be fine if you only have two poses in the movie, when you have 6 poses you will be tearing your hair out trying to remember whether it was pose 2 or pose 4 that you want to use. This is especially true when you are trying to use something in week 7 that you created in week 4.
    6. Remember you can move an object or sub-object during development either by using the mouse or by right clicking on the object/sub-object, selecting the action (turn, roll...) I find that sometimes the mouse is better and sometimes using the instruction is better depending on what I am trying to do.
  4. You can use a blend of instructions and poses to accomplish your objectives.
Use these steps incrementally. Don't try to get everything working at the start concentrate on one part. Once that is done start looking at the next part.
This means that in general the mistakes you see are a result of the code you just wrote. Since you know the last step was working. Going for the all in one approach leads to a situation where, if the action does not work as expected, you have no idea where to start looking for the problem.


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
Sure
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Cool Sure - 02-26-2014, 10:23 AM

Good and Professional Advice From Mark!!!

As you have already guessed, an animator's job is making it look realistic.
Start by finding a slow-motion video of a jumping frog on YouTube. I found at least two great ones.

Next, drag in a frog and create a pose that you can use to get back to original if you mess up completely.

Next create a Frog "hop" Method, and click "create new parameter" to create the distance variable. You won't need it for a while.

Now you have to figure out how recreate what you see in the videos.

As Mark mentioned, Some chose to use the editor to manipulate subparts, and save multiple poses for the object. As a programmer, I prefer to retain control by writing code to make it happen because it gives me more control over timing of individual subpart movements. Basically, you have three parts: Takeoff, Fly, and Landing with each hop, and unless you're creating a Super-Frog, you will have to make more that one hop to get to the destination.

I've attached a Quick Demo for you to examine. Yes, He's in the air, but look to see where his feet end up. Also pay attention to what can happen sometimes when using poses by clicking "Restart" a few times.

Fixing it is up to you.
Attached Files
File Type: a2w JumpingFrogDemo.a2w (472.1 KB, 5 views)

Last edited by MrMoke; 02-26-2014 at 03:45 PM.
   
Reply With Quote
Still stuck
Old
HalBen18
Junior Member
 
Status: Offline
Posts: 12
Join Date: Jan 2014
Location: Cedar Hill, TX
Question Still stuck - 02-26-2014, 04:00 PM

Thanks for the helpful posts! I have the frog moving the way I want but I can't get it to move forward the distance that the user enters. I have the parameter set and I made a variable that asks the user for a number but it doesn't move the amount entered. Am I missing a step?
   
Reply With Quote
Ok
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default Ok - 02-26-2014, 10:12 PM

The idea behind a parameter is to pass information from the outside into the Method. The name of World variable, and the name of the Method parameter don't have to be the same, because the value of the variable is passed.

Also, telling the frog to jump the entire distance, say 5 meters, at once might not work. You might have to make a loop that jumps a meter at a time until the frog gets too close to the total distance to do it again.
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default 02-27-2014, 09:34 AM

Quote:
Originally Posted by HalBen18 View Post
Thanks for the helpful posts! I have the frog moving the way I want but I can't get it to move forward the distance that the user enters. I have the parameter set and I made a variable that asks the user for a number but it doesn't move the amount entered. Am I missing a step?
My guess is that in the hop method the parameter is not being used. Look at hop and find where you cause the frog to move forward, if there is a number there replace it with the parameter (just click on the parameter and drag it to where the number is.) Do this any place your move forward appears in the hop method. If anything else depends on the distance forward you are moving, make sure and use the parameter there as well. For instance, if the height the frog moves up and down depends on how far it is jumping then you would want to use the parameter in your calculations. Something like:
Code:
frog move up (howFar/4)


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
OK, I Couldn't Resist
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Red face OK, I Couldn't Resist - 02-27-2014, 02:17 PM

The attached vid Frog Jump

Method has two parameters: (Distance and Speed)

Hops are one meter apiece, but will stop if remaining distance is < 1.
Thought Speed would be good for Slow Mo.
Attached Files
File Type: zip FrogJump.zip (761.5 KB, 5 views)
   
Reply With Quote
Got it! Thanks!
Old
HalBen18
Junior Member
 
Status: Offline
Posts: 12
Join Date: Jan 2014
Location: Cedar Hill, TX
Smile Got it! Thanks! - 02-27-2014, 03:20 PM

I got it to work! Thank you both for your help!
   
Reply With Quote
No Problem
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default No Problem - 02-27-2014, 03:24 PM

The Logical thinking skills and the desire to experiment that you are using will serve you well in any future career.

Last edited by MrMoke; 03-02-2014 at 03:51 PM.
   
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.