Alice Community  

Go Back   Alice Community > General Discussion > The Lounge

Reply
 
Thread Tools Display Modes
Assignment 4
Old
Forumuser
Junior Member
 
Status: Offline
Posts: 12
Join Date: Jul 2018
Default Assignment 4 - 07-18-2018, 01:50 PM

For my assignment I did a pilgrim theme. Several pilgrims accused one of their own as a witch and burn her alive while she struggles, jumps up and down, and sings the silly boom boom song. It went fairly well. I can usually figure out any problems I have. First I had the other pilgrims do their "burn the witch" dialogue using simple, separate say methods. Then, I got to the tough stuff. There's a lot that goes on at once so I used one big Do Together statement. In the special effects section of the gallery you can find fire. I placed it ontop of my unfortunate victim and set the opacity to 0% to hide it. Later we'll make it appear by using a method to set it up to 50%. I did the same with a skeleton model to create the illusion of her being burned to bones towards the end. I placed it ontop of her and set opacity to 0%. The fire object comes with a built in method called Spin like crazy that uses random number functions and infinite loops to make the fire move. I combined that with a method to set opacity to 50%, named it Fire! and set it activate along with my struggle method.

Struggle is just a couple of set poses combined into a method and looped ten time using the loop statement.

I had her sing the song by making the boom boom method as suggested but also combining that method with lines from the verses to make boomboom1, boomboom2, and boomboom3. It saves space visually and makes my code easier to look at. These are spaced inbetween my jump methods which I copied from page 31 chapter 2 of the text book. Define a variable to determine the height of the jump, use the random number function in the world object to set the value of that variable in a method. Then plug that variable into the move up and move down methods in your jump method. I called mine, height.

After she finished her song I put in a method called death that sets her opacity to 0% causing her to disappear, moves her down 1.5 meters to drop her through the ground out of the view of the camera (Her invisible self was blocking the view of the skeleton object causing it to become partially invisible too.) Then the method hides the fire and reveals the burnt skeleton by changing opacity parameters. There are all set to do together so it looks more seamless.

Then I had one of the onlookers say lol.

Note: In order to do other things I had to set the infinite loops in the Spin like crazy method inside of my Fire! method to stop at ten. There may have been another way to do this, but it worked fine for what I needed. Alice didn't want to run any new methods while other ones were infinitely looping.
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default 07-18-2018, 03:29 PM

Quote:
Originally Posted by Forumuser View Post
For my assignment I did a pilgrim theme. Several pilgrims accused one of their own as a witch and burn her alive while she struggles, jumps up and down, and sings the silly boom boom song. It went fairly well. I can usually figure out any problems I have. First I had the other pilgrims do their "burn the witch" dialogue using simple, separate say methods. Then, I got to the tough stuff. There's a lot that goes on at once so I used one big Do Together statement. In the special effects section of the gallery you can find fire. I placed it ontop of my unfortunate victim and set the opacity to 0% to hide it. Later we'll make it appear by using a method to set it up to 50%. I did the same with a skeleton model to create the illusion of her being burned to bones towards the end. I placed it ontop of her and set opacity to 0%. The fire object comes with a built in method called Spin like crazy that uses random number functions and infinite loops to make the fire move. I combined that with a method to set opacity to 50%, named it Fire! and set it activate along with my struggle method.

Struggle is just a couple of set poses combined into a method and looped ten time using the loop statement.

I had her sing the song by making the boom boom method as suggested but also combining that method with lines from the verses to make boomboom1, boomboom2, and boomboom3. It saves space visually and makes my code easier to look at. These are spaced inbetween my jump methods which I copied from page 31 chapter 2 of the text book. Define a variable to determine the height of the jump, use the random number function in the world object to set the value of that variable in a method. Then plug that variable into the move up and move down methods in your jump method. I called mine, height.

After she finished her song I put in a method called death that sets her opacity to 0% causing her to disappear, moves her down 1.5 meters to drop her through the ground out of the view of the camera (Her invisible self was blocking the view of the skeleton object causing it to become partially invisible too.) Then the method hides the fire and reveals the burnt skeleton by changing opacity parameters. There are all set to do together so it looks more seamless.

Then I had one of the onlookers say lol.

Note: In order to do other things I had to set the infinite loops in the Spin like crazy method inside of my Fire! method to stop at ten. There may have been another way to do this, but it worked fine for what I needed. Alice didn't want to run any new methods while other ones were infinitely looping.
You have hit on the problem of infinite loops. This is not just in Alice but in almost all programming environments, once an infinite loop starts nothing else can happen until the loop ends - which in the general case is never.
One way around this in Alice is to use events instead of infinite loops. There is no need to have a loop as the event is called by Alice whenever Alice can run it.
Some events, like "While something is true" and "When a variable changes" can be controlled by using variables in the program so that they only act at certain times.
One event that is not obvious is the "While the world is running" this event will be called repeatedly as often as possible while the movie is running.
To use "While the world is running" you first drag a "When the world starts" event into the event list and then Right Click on the event and use the "change to" menu item to change "When the world starts" to "While the world is running." At this point you have an event that will call the method in its "during" section as long as the movie is running. The event has three "slots" any or all of which can be used by the programmer. They are:
  • Begin: Any initialization code goes here
  • During: The method or instructions you want called repeatedly.
  • End: Any event clean-up code that should be done before the movie ends.
One caveat, avoid loops in the event and in methods called by an event. Alice will repeatedly call the event thus giving you the same effect as a loop. While a loop within an event might seem to work it can also lead to several nasty bugs and cause the movie to slow down or even grind to a halt. So just include the code you would put inside a loop in the event and trust Alice to call it repeatedly.

Mark


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
Old
MBohnenstengel
Junior Member
 
Status: Offline
Posts: 13
Join Date: Jul 2018
Default 07-18-2018, 06:56 PM

Wow that was very creative of you to show death! And setting the opacity levels and such. I feel mine was simple with a cat that sings songs.
   
Reply With Quote
Old
Forumuser
Junior Member
 
Status: Offline
Posts: 12
Join Date: Jul 2018
Default 07-19-2018, 12:22 AM

Quote:
Originally Posted by chickentree View Post
You have hit on the problem of infinite loops. This is not just in Alice but in almost all programming environments, once an infinite loop starts nothing else can happen until the loop ends - which in the general case is never.
One way around this in Alice is to use events instead of infinite loops. There is no need to have a loop as the event is called by Alice whenever Alice can run it.
Some events, like "While something is true" and "When a variable changes" can be controlled by using variables in the program so that they only act at certain times.
One event that is not obvious is the "While the world is running" this event will be called repeatedly as often as possible while the movie is running.
To use "While the world is running" you first drag a "When the world starts" event into the event list and then Right Click on the event and use the "change to" menu item to change "When the world starts" to "While the world is running." At this point you have an event that will call the method in its "during" section as long as the movie is running. The event has three "slots" any or all of which can be used by the programmer. They are:
  • Begin: Any initialization code goes here
  • During: The method or instructions you want called repeatedly.
  • End: Any event clean-up code that should be done before the movie ends.
One caveat, avoid loops in the event and in methods called by an event. Alice will repeatedly call the event thus giving you the same effect as a loop. While a loop within an event might seem to work it can also lead to several nasty bugs and cause the movie to slow down or even grind to a halt. So just include the code you would put inside a loop in the event and trust Alice to call it repeatedly.

Mark
I had to read that a couple of times but I think I understand what you mean. Thanks for the information. I'll have to keep that in mind. I'll likely end up using it at some point in the future.
   
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.