Difference between revisions of "Beginning Programming"

From eLinux.org
Jump to: navigation, search
(Programming toolkits)
Line 61: Line 61:
 
based on the key pressed.  The ball should keep moving after the key is released.
 
based on the key pressed.  The ball should keep moving after the key is released.
 
It should bounce off the wall and go the other direction when it hits a wall.
 
It should bounce off the wall and go the other direction when it hits a wall.
 +
 +
== Languages ==
 +
Programming can be done in many different computer languages.
 +
 +
=== Scratch ===
 +
 +
=== Javascript ===
 +
Here is a tutorial for a bouncing ball demo in Javascript:
 +
http://sixrevisions.com/html/bouncing-a-ball-around-with-html5-and-javascript/

Revision as of 18:37, 7 February 2013

This page is intended to help beginners get started with learning programming. Eventually, I'd like to provide a whole series of steps, exercises and tutorials about programming, to help anyone who would like to get involved with software development or game development.

Programming toolkits

"Questions Tips & Feedback Spin-Offs Documentation". "Spin-Offs" has sample programs related to the tutorial, video or program you're looking at, and "Documentation" has description of different functions or statements you can use in your programs.

Programming checklist

Follow these steps to learn how to program:

The very basics

  • learn what a program statement is (and what a "computer language" is)
  • learn what a variable is
  • learn what a conditional (if statement) is
  • learn what a loop is
  • learn what input is
    • different kinds of input (key press, mouse move, mouse button)
  • learn what output is
    • different kinds of output (text, image, sound)

Simple program 1: Write a program that counts how many times someone presses the space bar.

Simple program 2: Write a program that counts how many times someone presses each arrow key.

program 3: Write a program that starts counting when someone presses the space bar, and stops counting when they hit it a second time (like a stop-watch).

Program 4: Write a program that moves a ball to the right on the screen, when the right arrow is pressed.

Program 5: Write a program that starts a ball moving when key is pressed. The ball should keep moving until it hits a wall.

Note: For any of these programs, you can start with the program you used previously, and expand or modify it to do the next task. You should save it under a new name.

Program 6: Write a program that starts a ball moving in a different direction, depending on which arrow key (up, down, left, right) is pressed.

Program 7: Write a program that starts with a moving ball. When the ball hits a wall, it moves in the opposite direction.

Program 8: Combine programs 6 and 7. Write a program that starts a ball in a direction based on the key pressed. The ball should keep moving after the key is released. It should bounce off the wall and go the other direction when it hits a wall.

Languages

Programming can be done in many different computer languages.

Scratch

Javascript

Here is a tutorial for a bouncing ball demo in Javascript: http://sixrevisions.com/html/bouncing-a-ball-around-with-html5-and-javascript/