Download presentation
Presentation is loading. Please wait.
1
Putting Objects in Motion
Using Method Calls Copyright © Curt Hill
2
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 © Curt Hill
3
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 © Curt Hill
4
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 © Curt Hill
5
Copyright © Curt Hill
6
Copyright © Curt Hill
7
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 © Curt Hill
8
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 © Curt Hill
9
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 © Curt Hill
10
Copyright © Curt Hill
11
Copyright © Curt Hill
12
Copyright © Curt Hill
13
Copyright © Curt Hill
14
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 © Curt Hill
15
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 © Curt Hill
16
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 © Curt Hill
17
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 © Curt Hill
18
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 © Curt Hill
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.