Putting Objects in Motion Using Method Calls Copyright © 2005-2011 Curt Hill Overview • Each object is prepared to do certain things • A method call uses one of these behaviors • Since Alice is mostly about 3D animations these are mostly about moving in some way • This presentation uses existing methods – We later see creating our own Copyright © 2005-2011 Curt Hill Objects Again • Each actor, such as a fish, is an object • Any object may have methods that cause it to do something useful, such as move in some direction • An object may actually be composed of objects – A hand has actions different than the whole body – Yet moving the whole body must also move the hand Copyright © 2005-2011 Curt Hill Screen Shot • The next two screens show a program in the process of creation • The objects to be manipulated are listed • The first shows the fish as selected – It is surrounded by its bounding box • Bottom left shows the methods that can be used • After that the sub-object of the fish are shown Copyright © 2005-2011 Curt Hill Copyright © 2005-2011 Curt Hill Copyright © 2005-2011 Curt Hill Programming • The programming of this system is causing the actors to move properly • Errors are called bugs • A bug in Alice results in a scene that does not unfold as intended • Causing an object to move is to execute the move method • This is done using drag and drop Copyright © 2005-2011 Curt Hill Getting things to move • Click on the object to select it • Drag the action from the details pane to the method pane • Fill in the needed parameters if there are any • Test it by hitting the play button • The order of the actions in the method pane determine how they are executed Copyright © 2005-2011 Curt Hill Adding an Action • What follows are four screens that show how to add action to a scene • Select the object to be acted on • Drag the move method to the Method Pane • Choose Forward and the distance • Finally what the program looks like when this instruction has been added Copyright © 2005-2011 Curt Hill Copyright © 2005-2011 Curt Hill Copyright © 2005-2011 Curt Hill Copyright © 2005-2011 Curt Hill Copyright © 2005-2011 Curt Hill Concurrency • Concurrency is two or more things happening at the same time • It is a fancy Computer Science term that we usually do not teach until students are quite experienced • Except in Alice! • Here we have a Do Together that does concurrency – Makes it look easy Copyright © 2005-2011 Curt Hill Do Together • The Do Together tab is at the bottom of the Method pane along with: – – – – – Do In Order If Else Loop While etc • All of these are containers for other statements Copyright © 2005-2011 Curt Hill Containers • A container is a statement that contains other statements • When it is drug onto the pane it contains nothing • You then drag statements into it – These can be existing statements or new ones Copyright © 2005-2011 Curt Hill Do in Order • Another container • This forces actions to be performed in order • Use Do Together to do things simultaneously and Do in Order to do things sequentially • Any of the containers may be in another – A Do in Order could be inside a Do Together Copyright © 2005-2011 Curt Hill Demo • Now lets get things moving • Instead of a 3D post card we get a 3D animation • Use methods of move, roll, turn • Use Do Together and Do In Order Copyright © 2005-2011 Curt Hill
© Copyright 2026 Paperzz