GameWorkshop Pres 2

1,214 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,214
On SlideShare
0
From Embeds
0
Number of Embeds
881
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

GameWorkshop Pres 2

  1. 1. Object Oriented Programming and Games<br />
  2. 2. Building a ProjectThe building blocks of your game.<br />Variables Functions Conditions<br />These perform checks and comparisons between variables and facilitate actions.<br />These store data.<br />These do actions.<br />
  3. 3. Building a ProjectClasses in code are a big deal.<br />An Actionscript game is made up of several files with code in them.<br />These individual files in a program are called Classes. Classes make up the basic structure of every unique item in a game.<br />Classes are made up of variables, functions, and conditions which are all put together to provide a purpose.<br />Classes are like mini programs.<br />We create classes to define unique objects in our code.<br />
  4. 4. Building a ProjectThe building blocks of your game.<br />Packages<br /> In Actionscript 3 we use something called a Package.<br /> A package is a collection of classes.<br /> A game can be made from multiple or one package<br />
  5. 5. Building a ProjectThe building blocks of your game.<br />
  6. 6. This is Object Oriented ProgrammingObject oriented is how you will create your games.<br />
  7. 7. This is Object Oriented ProgrammingWhat’s the benefit?<br />You have modular code that you can reuse.<br />Because we kept our code in different classes, its modular and reusable. <br />
  8. 8. A game is made of:<br /> - Variables<br /> - Functions<br /> - Conditions<br /> - Classes<br /> - Package(s) <br />Lets apply this to a game model.<br />Building a gameUsing code structures to make something cool.<br />
  9. 9. Applying the conceptsHow these coding terms fit into a game.<br />BrickBreaker - Classic and a good place to start<br />
  10. 10. Applying the conceptsHow these coding terms fit into a game.<br />“We create classes for every unique object in our code.”<br />What are the unique objects in BrickBreaker?<br />What would the classes be?<br />
  11. 11. Applying the conceptsHow these coding terms fit into a game.<br />What are the unique objects?<br /><ul><li> Ball
  12. 12. Paddle (Player)
  13. 13. Bricks
  14. 14. The stage we play on</li></ul>All of these will need to be built as separate classes.<br />
  15. 15. What attributes and actions do each class have?<br />BallStage<br /> - Graphics - Collision Detection<br /> - Speed - Keeping track of objects on stage<br /> - Bounce - Updating movement<br />PaddleBricks<br /> - Graphics - Graphics<br /> - Speed - Knowing when they are hit<br />Applying the conceptsHow these coding terms fit into a game.<br />
  16. 16. The attributes will be comes the variables in each class, and the actions will become the functions.<br />Applying the conceptsHow these coding terms fit into a game.<br />
  17. 17. It was mentioned before that object oriented programming is reusable.<br />If we built the classes to make brickbreaker, we could easily use those same classes to make Pong without rewriting an entire program.<br />What would we change?<br /><ul><li>The ball class would be the same
  18. 18. The orientation of the paddles </li></ul> would change<br />- The bounds of the stage would be <br /> different<br />Modular code = happinessThe benefit of Object Oriented.<br />
  19. 19. BrickBreaker!<br />So lets make a game.<br />

×