Alice Community  

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

Reply
 
Thread Tools Display Modes
Creating a method that asks user for two numbers?
Old
Wildflower
Junior Member
 
Status: Offline
Posts: 2
Join Date: Nov 2011
Unhappy Creating a method that asks user for two numbers? - 11-05-2011, 01:11 PM

I need to create a jump method that makes the character jump up a distance specified by the user, spin the number of times specified by the user, and come back down.

I used the character's move up and turn methods to accomplish the first two actions, dragging the "Ask user for a number" function on top of the height and turn parameters. When I play this part, the dialog appears asking how high I want the character to jump, I enter a number, and the character jumps up that distance. However, when the next dialog appears asking how many times I want the character to spin, I enter a number and click OK, but nothing happens. Then I can't cancel out of the dialog or access anything and have to cold shut my computer down. Then I'm thinking maybe the instructor wants the two questions asked one after the other so that the character doesn't have to jump and then ask another question before spinning, but I'm not sure.

Also, how do you get the character to come back down if you don't know what the user input will be for how high to make it jump? You need to specify how many meters it should jump back down.

So confused.
   
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 11-05-2011, 01:27 PM

you have to make a number variable for the height so the user can decide what the height will be, which in return makes the number variable stay that number then you make the method from there, here is a demo world on how to do it.

Remember: variables are just pieces of empty information that are waiting to be filled, so once they are filled they can be used over and over again.

Example: I set a number variable to be 5, that variable will stay 5, so If im making a car move with that variable it would go 5 meters, then if I used the same variable to make the car turn, it would turn 5 times. hope this helps
Attached Files
File Type: a2w 2 user input.a2w (483.4 KB, 7 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
Old
Powerhouse64
Senior Member
 
Powerhouse64's Avatar
 
Status: Offline
Posts: 54
Join Date: Nov 2011
Location: In ur base, movin ur stuffs
Default 11-05-2011, 03:55 PM

Quote:
Originally Posted by sfunk View Post
Remember: variables are just pieces of empty information that are waiting to be filled, so once they are filled they can be used over and over again.
This also applies to your brain. Very well put sfunk.


Hogwarts: Where everything is made up, and the points don't matter
   
Reply With Quote
Old
Wildflower
Junior Member
 
Status: Offline
Posts: 2
Join Date: Nov 2011
Default 11-05-2011, 08:00 PM

Wow. Yeah, I get it now.

The thing is - the class assignments where we have to write straight code I understand completely, but when it comes to using Alice I get lost - the software confuses me.

I really appreciate the help and thanx so much for the tutorial links - will definitely be checking these out!
   
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 ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.