Profile cover photo
Profile photo
CodeNation NPHS
3 followers
3 followers
About
Posts

Week 3 Part 2

We are still working in the file game.lua.

1. In the function scene:show with the event.phase == "did", add an event listener for "touch" that triggers the touchScreen function (we will write this function later).
2. In the function scene:hide with the event.phase == "will", remove this event listener.
HINT: Check the scene:show and scene:hide functions in start.lua to see how to write the add/remove event listener lines.

Let's write some functions now! All your functions will go between the scene:create and scene:show functions. Please leave a line of space between all your functions.

playerReady function
3. Write the basics of the function. These should include the words "function" and "end" and the name of the function. Do not forget the parentheses to take parameters. There are no parameters. 
4.Set the player's bodyType to be "dynamic."
HINT: Look at how you set your player's x and y variables as an example for the syntax. 

touchScreen function
5. Repeat step 3 for this function. This time, there will be one parameter, "event."
6. Create an "if/elseif" statement checking whether the event phase has "began" or "ended". Do not forget the "end."
7. When the phase has began, the player.enterFrame should equal activatePlayer (we will write this function later). Additionally, an event listener "enterFrame" should be added for the player.
8. If the phase has ended, the event listener above ought to be removed. 

activatePlayer
9. Repeat step 3 for this function. This time, the function should have parameters self and event. Separate these with a comma.
10. Look at the applyForce function documentation here: https://docs.coronalabs.com/api/type/Body/applyForce.html
11. Look at the syntax of the example to write a line of code that applies a force to "self" of 0 in the x direction and 0.7 in the y direction. HINT: Look at the last line of the example at the bottom of the page for guidance.
 

SAVE AND TEST YOUR PROJECT!!!! 
Add a comment...

Post has attachment
Week 3 Part 1

We are working in the file game.lua.

1. Create the "player" variable. Set it to be a displayed image of "unicorn.gif"
2. Set its x position to be 0.3 of your display's width. Set its y position to be half of your display's height. 
3. Add your player to the screenGroup.
HINT: Look to the display of the "start" button in your start.lua file for code format.

3. Check out the documentation (noting parameters and usage) on the physics.addBody method here: https://docs.coronalabs.com/api/library/physics/addBody.html.
4. Scroll down to the examples and look at the "Rectangular body" example. Combining the two physics.addBody(..) statements you see there, add a line of code below your player variable code that makes the player static, have a density of 0.08, a bounce of 0.1, and a friction of 0.2. 

5. Check out the documentation (noting parameters and usage) on the transition.to method here: https://docs.coronalabs.com/api/library/transition/to.html.
6. Scroll down to the example. Add a line of code below your player variable code that makes the player have a transition of time 500 to an x position halfway across the display screen. onComplete should be set to playerReady (we will create this function later). 

HINT: Pay attention to the curly braces {} and the parentheses () and where each should respectively go. Your project won't work in the simulator, so go on to week 3 part 2.
Add a comment...

Post has attachment

Post has attachment
Week 2 Part 2

Use Google Searches and attached links to help you.

1. What does API stand for in software development? 
2. So then what is API documentation for? https://docs.coronalabs.com/api/index.html

3. Take a look at this page in the API documentation. What is it explaining? https://docs.coronalabs.com/api/library/display/setStatusBar.html
4. Open your main.lua file. Where it says "--replace this text with status bar text", try replacing it with the proper code based on the info in step 3. We want to make the status bar hidden.

5. Read about the composer library here: https://docs.coronalabs.com/api/library/composer/index.html. What is composer?
6. In every file, replace "--replace this text with composer text" with local composer = require("composer").
7. Replace "--replace this text with scene text" with local scene = composer.newScene()
8. Can you identify the variables and functions?

9. Read about Event Listeners here: https://docs.coronalabs.com/api/type/EventListener/addEventListener.html. What does it do?
10. In all the files except the main file, replace "--replace this text with four lines of event listener text" scene:addEventListener("create", scene), and three other lines. These three other lines look just like the one above, but they do not all say "create". What else do they say? (Hint: look at the names of the four big functions.)
Add a comment...

Week 2 Part 1 

1. Download the zip file I emailed you.
2. Bookmark this page. 
3. Make sure you've done all Week 1 tasks. 
4. Go on to Week 2 research tasks. Be prepared to talk about the tasks in class next time. From now on, we will be solely focusing on the mobile app in class. Your tutors may still assign you work to do for Java and Codecademy on your own time. You will be responsible for keeping up your coding skills. 
Add a comment...

Post has attachment
Week 1 Part 2

Watch the following videos to understand more about the lua language.

Variables: https://www.youtube.com/watch?v=j4U0ii1FjwE
Functions: https://www.youtube.com/watch?v=zP9QruPMd4w
Conditional statements: https://www.youtube.com/watch?v=HDQDN1FWuZ8
For Loops: https://www.youtube.com/watch?v=7N_MSpOriHM
Add a comment...

Post has attachment
Week 1 Part 1

Get Corona SDK here: https://coronalabs.com/products/corona-sdk/

1. Scroll to the very bottom and click the “Download Now” button.
2. On the following page, register an account. 
3. Download the correct version for your OS (Mac or Windows) and follow installation instructions (Don’t worry about accidentally installing any third-party programs during this process; the installation is clean and safe). Ask your parents if you aren't sure which version to get.
4. Test to see if the program works on your computer by opening it.

Get Atom (text editor): https://github.com/atom/atom/releases/tag/v1.5.3

1. If you have Windows 7+, choose AtomSetup.exe. If you have a Mac, choose atom-mac.zip. If you have other versions of Windows, choose atom-windows.zip.
2. Open the setup by clicking on it. Follow the installation instructions. If you need to make an account, register for one.
4. Test to see if the program works on your computer by opening it.

Remember, there should be NO NEED to pay for anything. Don't pay for anything even if the message pops up!

After everything begins working, in Corona SDK, open some of the sample programs.
Add a comment...

Post has attachment

Post has attachment
6. Examples of Website Features

Check out this folder of files for some examples of html features, written with html, CSS and JavaScript. 

https://drive.google.com/open?id=0B0Q9j5x0AOIwU0kyY05RM0haZWM

1. Download the whole folder. 
2. Double-click the .html files to run them in your browser.
Add a comment...

Post has attachment
5. Playing around with Fluid UI

Create your first project, add some pages, and play around with the buttons, text areas, colors, widgets, etc. Then, add transitions and links between your pages.

For a starting tutorial, check out: https://www.youtube.com/watch?v=uodln1GmrFM
Add a comment...
Wait while more posts are being loaded