Programming games - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Programming games

Description:

Rock paper scissors. Screen shot on next shows ... rock, paper, and scissors ... Complete rock paper scissors. Read tutorial and make sure you could do ... – PowerPoint PPT presentation

Number of Views:85
Avg rating:3.0/5.0
Slides: 12
Provided by: jeanin72
Category:

less

Transcript and Presenter's Notes

Title: Programming games


1
Programming games
  • Demonstrate work on rps
  • Classwork/Homework (complete your own
    rock-paper-scissors). Keep practicing drawing.
    Start bouncing ball.

2
Rock paper scissors
  • Screen shot on next slide shows complete time
    line.
  • You need to add keyframes.
  • Modify material on the Stage. Leave buttons
    alone.
  • Name (label) certain keyframes.

3
(No Transcript)
4
Overview of rps
  • Static and dynamic text fields
  • Buttons representing rock, paper, and scissors
  • Event handling for each button is a call to a
    common function computermove('rock')
  • Action code in 1st frame holds
  • initialization
  • function computermove(player)
  • Code contains several if statements. True clauses
    have gotoAndPlay("papercovers") etc.
  • Other frames contain animations for 3 possible
    outcomes. Ties have no animations.

5
Were you bothered?
  • The program encodes
  • 0 for rock
  • 1 for paper
  • 2 for scissors
  • Some encoding was necessary (to make it work
    smoothlyyou can argue with this). Anything would
    have worked.
  • The player never sees the encoding.

6
Common problems
  • for if true and for else clauses
  • Make sure brackets face correct direction
  • Math versus math. Need the capital!
  • Not naming movie clip instances OR using wrong
    name. This includes upper versus lower case.
  • Not naming button flipper.addEventListener(Mouse
    Event.CLICK,flip)
  • The handler for an event generally needs a
    parameter in the definition, whether it is used
    or not

7
Not so common problem
  • Creating new Flash document as opposed to
    Insert/New Symbol

8
Common problems
  • Need to Insert/Timeline/Keyframe
  • To put in ActionScript or put material on the
    stage
  • Watch names, especially labels (aka flags) of
    frames
  • Scissorscuts vs scissorscuts vs scissorscut vs
    scissorcut vs Scissorscut ..

9
Common problems
  • Not putting
  • stop()
  • in frame that is the last frame in each of the 3
    sequences INCLUDING THE LAST One
  • Default in Flash is to loop.

10
Preview
  • There are 3 types of text fields
  • static
  • dynamic can be changed by code
  • input player (user) can change it
  • To change the text in a dynamic (or input) text
    field
  • result.text " "

11
Classwork/Homework
  • Complete rock paper scissors
  • Read tutorial and make sure you could do the
    whole application.
  • Next formal assignment will be Bouncing ball in
    Flash. Read tutorial and start.
  • You can look at more complex examples. These
    involve .as files that define programmer-defined
    classes analogous to the definitions for built-in
    objects.
Write a Comment
User Comments (0)
About PowerShow.com