Saturday, March 8, 2014

Step 4

Week 4 (February 19-26) — Iterators


To deliver:

  • 3 objects that require decisions

This week's summary:

What I learned:

Iterators 

  • if -then - kind of like a cause and effect.  When condition is fulfilled, then output result
  • else - it's basically the default of the if-then statement.  It's like saying, if the condition isn't fulfilled, then the out put will be ________
  • elseif - Allows for more than one condition to be set.  It's like saying: if the first condition isn't met, then look at this condition.  And it this condition isn't met, then the output will be _________
  • I used an if-then statement in my event/event listeners:
local function readToMeTouch( event )
if event.phase =="began" then
local storyboard = require "storyboard"
storyboard.gotoScene( "story" )
end
return true
end
readToMe:addEventListener( "touch", readToMeTouch )

The if-then in this case says that if the phase of the event has begun, then the app should move to the scene called "story"

Parts of the if-then statements:

always ends in "end"

ex: 

if (condition) then
--perform an action
elseif
--perform an action
else
--perform an action

end

Some great resources:


  • http://www.youtube.com/watch?v=7N_MSpOriHM
  • http://docs.coronalabs.com/api/library/display/newImageRect.html (create imageRect)
  • http://teamtreehouse.com/

My functioning code so far:

https://drive.google.com/folderview?id=0B406rJ0oHVzZTkp0V0QtSnF3WU0&usp=sharing

No comments:

Post a Comment