Example Code¶
The example code here starts out simple and gets more complex. The example code progresses through these topics:
- How to call functions
- How to create functions
- How use function callbacks and static function variables
- How to make loops
- How to use nested loops
- How to create classes
- How to allow the user to control items on the screen
- How to use sprites
- How to use a two-dimensional list
Example list¶
- Drawing: Drawing primitives
- Functions: Drawing with functions
- Drawing: Text
- Animation: Bouncing rectangle
- Animation: Bouncing ball
- Animation: Bouncing balls
- Animation: Radar Sweep
- Loops: Drawing with loops
- Loops: Nested loops
- Classes: Shapes
- Classes: Starting Template
- Classes: Timer
- User control: Mouse
- User control: Keyboard
- User control: Joystick
- Full Joystick Example
- Sprites: Collect blocks
- Sprites: Change coins
- Sprites: Collect blocks moving down
- Sprites: Collect blocks that are bouncing
- Sprites: Collect blocks that are moving in a circle
- Sprites: Shoot bullets upwards
- Sprites: Aim and shoot bullets
- Sprites: Move with walls
- Sprites: Move with a scrolling screen
- Sprites: Move with a sprite animation
- Sprites: Work with a tiled map
- Sprites: Ramps
- Sprites: Moving Platforms
- Sprites: Instruction and Game Over Screens
- Array-Backed Grid
- Full example: Asteroid Smasher
- Examples to-do list