learning to program: part 1 - duke university · 2009. 6. 8. · alice, and choose a background for...

28
Learning to Program: Part 1 Scene Setup and Star4ng Anima4on by Ruthie Tucker and Jenna Hayes Under the direc4on of Professor Susan Rodger Duke University, July 2008 www.cs.duke.edu/csed/alice/aliceInSchools

Upload: others

Post on 14-Oct-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

LearningtoProgram:Part1SceneSetupandStar4ngAnima4on

byRuthieTuckerandJennaHayesUnderthedirec4onofProfessorSusanRodger

DukeUniversity,July2008www.cs.duke.edu/csed/alice/aliceInSchools

Page 2: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

OpenupAlice,andchooseabackgroundforyourAliceworld.Yourworldissomethingyoucanputobjectsinandmakethemdothings.Therearesixdifferentbackgroundop4ons.Choosegrass.

Alice is full of different kinds of objects to add to your world to make it interes7ng.  

ToaddanobjecttoyourAliceworld,clickonthegreenAddObjectsbuRon.

Setting Up

Page 3: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

Clickontheanimalsfolderofobjects.FindHorse1amongthetypesofobjectsandclickonit.ThenclickAddInstancetoWorld.Thehorsewillappearinyourworld.

Adding Objects

Onceyouhaveclickedon“addobjects”agalleryofobjectswillappear,onyourscreen,belowyourworld.

This is your local gallery of objects. There are lots of folders, each containing objects.  

Page 4: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

You may see that your horse looks like it’s halfway underground. When objects are added, some7mes they appear in strange places. We need to move the horse so he looks like he’s on the ground.  

WearegoingtousethesebuRonslocatedtotherightofthemainwindowtomovehimaround.

Positioning Objects – Controls

Page 5: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

The Move Objects Freely buEon looks like your mouse and will automa7cally be set. This buEon will move your horse further back from the camera or closer to the camera, to the right, or to the leF. 

Clickonyourhorseanddraghimaround.Trymovingyourhorseforwardsandbackwards.

Ifyoudon’tlikethewayyourhorselooksaXeryoumovehim,clicktheUndobuRoninthetopleXcornerofthescreen.

Positioning Objects – Freely & Undo

 Any7me you do something wrong in your Alice world you can click the undo buEon and Alice will undo the last command. 

Page 6: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

Positioning Objects – Up & Down

ThebuRonwiththeupanddownarrowswillmoveyourobjectupanddown.

Moveyourhorseupun4lheisstandingontheground.

Page 7: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

ThisbuRonturnsobjectsleXandright.UsethistoturnyourhorsealiRletotheleX.UseUndoifyoumakeamistake.

No7ce that your horse seems to turn around one point. This is your horse’s center.  

Positioning Objects – Turn

Page 8: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

center

center

Each object in Alice has a center. This is the point on an Alice object that determines where it is in the world, and around which the object will rotate if commanded. Every object’s center is different.  

centerNote:NotallhumancharactersinAlicehavetheircentersattheirfeet.Itvariesinposi4on.

Centers

Page 9: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

ThisbuRonrotatesanobjectforwardsorbackwardsarounditscenter.Tryrota4ngyourhorse,andthenputitbackinitsoriginalposi4onusingUndo.

Positioning Objects – Rotating

You can get a beEer idea of where the horse’s center is when you rotate him forwards and backwards.  

Page 10: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

ThisbuRontumblesanobjectinallkindsofcrazydirec4ons.TrythisbuRononyourhorse,andthenputitbacktoitsoriginalposi4onusingUndo.

Positioning Objects – Tumble

No7ce that there is one spot that doesn’t seem to move when you tumble. That’s the horse’s center.  

Page 11: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

ThisbuRonmakesanobjectbiggerorsmaller.Tryresizingyourhorse,soitisaliRlebigger,andthenmovehimupoutoftheground.

Positioning Objects – Resize

Page 12: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

ClickonFileintheupperleXcornerandgodowntoSaveWorldTypeinanamesuchas:horseWorld,andthen“save”

Saving

Now that we have the horse where we want him, let’s make sure we don’t lose our work. Alice will remind us to save our work every 15 minutes but you can also manually save. It’s a good idea to create a folder to put all your Alice worlds in. 

Page 13: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

 There is also a way to save your camera posi7on. To do that we need to add a dummy camera to the world. Dummy cameras are invisible objects that save the current view you have. 

Clickon“morecontrols”Clickon“dropdummyatcamera”Just click it once! 

ClickthegreenDonearrowontherighthandsideofthescreentogobacktothemainAlicewindow.

Dummy Cameras

Page 14: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

On the leF hand side of the main screen is a list of all the objects in the world. This is called the object tree. 

Clickonthe“+”bythefoldercalledDummyObjects

Thecameraposi4onsavedas“Dummy”

RightClickonitandselect“rename”andrenameit“originalposi4on”

Dummy Cameras

Page 15: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

Now we are going to show you how to create an event in Alice. An event is something that you tell Alice to do aFer something else happens, such as pressing a key or clicking on something.  

Events

In the top right hand corner of the screen is the Events Editor.  

Page 16: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

ClickonthecreateneweventbuRon.Choosethewhenakeyistypedop4on.WearegoingtocreateaneventwherewhenwepresstheNkey,ourhorsewillsay“NEEEEEEEIGH!”

Clickonanykey,thenchooseleRers,thenchooseN.

Events – Keyboard Event

Page 17: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

Nowclickonthehorseinthelistofobjects,andthenclickonthemethodstab.Findhorsesay,anddragituptotheeventseditorwhereitnowsaysNothing.

Events – Keyboard Event

Whenyoudropthesaycommand,youwillbepromptedtochoosewhatthehorsesays.Since“NEEEEEEEIGH!”isn’tonthelist,select“other…”

Page 18: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

Awindowwillpopupwhereyoucantypeinsomethingforthehorsetosay,type“NEEEEEEEEIGH!”

Playyourworld,andtrypressingN.Wheneveryoupressit,yourhorseshouldneigh.

Events – Keyboard Event

 When you are done, close the window to get back to the main screen. Now let’s add two people, a boy and a girl, to our world. 

Page 19: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

The hebuilder and shebuilder are for crea7ng your own characters in a world. You can find it under the “people” folder of your Local Gallery 

Letsstartwiththeshebuilder.

Clickonthe“AddObjects”buRontogettoyourlocalgallery.Scrollrightun4lyouseethe“People”Folder.

Scrolltotheveryend,clickonshebuilder.Whenyouopentheshebuilderfolder,thisscreenwillappear(youmayhavetowaitamomentforittoload).

Objects – He/She Builder

Page 20: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

Youcanchangetheleg,upperbodyandheadshapeofyourperson,usingtheredarrows.

He/She Builder – Body/Hair

Selectthe“haircolor”buRon.Youcanchangetheshapeandcolorofyourhair,usingarrows.

Page 21: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

Now,selectthetablabeled“skin/eyes”.Youshouldhavethreeop4ons:skincolor,eyesandlips.

Theskincoloriscontrolledbyaslideratthetop.

Theeyesandlipscanbeselectedbythearrows.

Allofthechangesyoumakewillappearonyourperson,totheleX.

He/She Builder – Skin/Eyes

Page 22: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

Byselec4ngthe“clothing”tab,youcanchooseshirts,pantsandshoesforyourperson.

Finally,youcangiveyourpersonanameattheboRomofthe“personbuilder”.

ClickOKwhenyouarefinished.

He/She Builder – Clothing/Name

Page 23: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

Trycrea4nganothercharacterbutthis4meusingthehebuilderfolder.

Objects – He/She Builder

Page 24: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

 Look over on the right side of your screen. There should be two types of camera views Single view and Quad view. Quad view is good for fixing the posi7oning of your characters in the world 

Positioning Objects – Quad View

UsingthecontrolbuRonswewentoverearlier,trytoposi4onyourcharacterssothattheyappearinallfourscreens.

Page 25: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

Lookoverontheright,underquadview.NotethebuRonthatlookslikeahand.ThisisthescrolltoolanditallowsyoutomovearoundthecamerainQuadView.

TheMagnifyingglassallowsyoutozoominandoutwhileinquadview,tobeRerposi4onyourcharacters

You’llneedtoclickanddragonyourviewingwindowswhenusingbothofthesebuRons.Trythemoutnowtocenteryourcharactersineachview.

Positioning Objects – Quad View

Note:YoucannotusethescrollandzoomtoolonthefirstscreenintheupperleX.

Page 26: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

 Once you have your characters in your world you can start to animate them using simple and built in methods. 

Clickdonetogobacktothemainwindow.Clickononeofyourcharactersintheobjecttree.ForusitisMaR.LookontheleXofyourscreenunderMaR’sdetails.Thereshouldbealistofmethods.Thisisthelistofac4onsthatyourpersoncanalreadydo.

Methods – Introduction

Page 27: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

The large tan part in the center of your screen is called your “Method Editor.” The method editor is where we can call our methods to animate the characters. 

Youcanclickanddraganyofthecharacter’smethodsintothemethodcalled“world.myfirstmethod”.Trythiswithafewofthem.

Nowclick“play”inthetopleXhandcorner.Yourcharactershouldanimatehoweveryouhavecodedhim.

Methods – Introduction

Page 28: Learning to Program: Part 1 - Duke University · 2009. 6. 8. · Alice, and choose a background for your Alice world. Your world is something you can put objects in and make them

Moveoneofyourcharactersaroundinyourworldusingquadviewun4ltheyarestandingrightnexttothehorse,somethinglikethis:

Nice job! Now we are ready to move on to Part 2.   

Finishing Touches