Build a 2D Platformer

Build a 2D Platformer

March 8, 2014 [BUILD A 2D PLATFORMER - JAVA] inputparallaxscrollingsoundsenmiesobstac lesrgbjumpingrunningblocksvideogameav atarplatformsgameloopslick2Dmousesides crollingdoublejumpsinglescreenvectorjoys tickspritecollisiondetectionbackgroundfraBuild a 2D Platformer merategravityanimationprojectsinmovemeUsing Java ntpaddlescriptingrolep03/08/2014layingobjectsmusic keyboardgameengineimagespaint.netrendnyguerrillagirl@brainycode.com eringgrapicspageflippingprototypenetwor kprogrammingmutltiplayeraudioshadowst ransparencyalphadonkeykonggamemaker mechanicsartificialintelligencepuzzlesgam eplayactionshumpresourcestileslevelscont rolscoreclockapispritesheetrasterraycastin gphysicslevelbuilderdatauihuddesigncode1 March 8, 2014 [BUILD A 2D PLATFORMER - JAVA] Note: This is a working/draft version Copyright © 2014 brainycode.com All rights reserved. Permission is not granted to copy and distribute an electronic version of this document. Please direct links to this website or request permission. Permission is NOT granted for commercial use. 2 March 8, 2014 [BUILD A 2D PLATFORMER - JAVA] Contents Chapter 1 – Getting Started/Introduction ...................................................................................................... 6 Purpose ...................................................................................................................................................... 6 Prerequisites .............................................................................................................................................. 7 The Plan .................................................................................................................................................... 7 Why build your game engine? .............................................................................................................. 7 Best Practices ........................................................................................................................................ 8 Quick History of 2D Platformers .............................................................................................................. 8 How can I play older games (no longer available for sale) or in the arcades? .................................... 11 Writing a Design Document ................................................................................................................... 17 Game Design Document Outline ................................................................................................................ 17 Using Best Practices ............................................................................................................................... 19 What is JUnit? ..................................................................................................................................... 19 What is Ant and Maven? ..................................................................................................................... 19 What’s the plan for learning how to use these tools? .......................................................................... 20 Game Engines ......................................................................................................................................... 20 Does it make sense to develop games using Java? ................................................................................. 22 Overview of the Plan .............................................................................................................................. 22 Exercises ................................................................................................................................................. 23 Directory Setup ................................................................................................................................... 23 Imports ................................................................................................................................................ 25 Creating a test case .............................................................................................................................. 26 Chapter 2 – Graphics .................................................................................................................................. 46 Applications vs. Applets ......................................................................................................................... 46 Organizing the code ............................................................................................................................ 46 Lab 2-1: Creating a program that displays a window and runs as either an application or applet ...... 47 Drawing .................................................................................................................................................. 62 Color ................................................................................................................................................... 62 drawstring() ......................................................................................................................................... 63 Centering the Text ............................................................................................................................... 64 Lab 2-1: continued .............................................................................................................................. 65 Drawing Lines ..................................................................................................................................... 66 Fonts .................................................................................................................................................... 67 3 March 8, 2014 [BUILD A 2D PLATFORMER - JAVA] Lab 2-2: Drawing a Star Field ............................................................................................................. 68 Random Number Generation .............................................................................................................. 70 Drawing Ellipses and Circles .............................................................................................................. 71 Drawing Rectangles ............................................................................................................................ 71 Additional draw methods ........................................................................................................................ 72 drawArc............................................................................................................................................... 72 Lab 2-3: Draw a Happy Face .............................................................................................................. 74 Drawing Polygons ............................................................................................................................... 75 Drawing Images .................................................................................................................................. 77 Lab 2-4: Drawing an Image ................................................................................................................ 78 Clipping............................................................................................................................................... 80 Graphics2D ......................................................................................................................................... 81 Making changes to the objects we draw ................................................................................................. 81 Alpha ................................................................................................................................................... 81 Anti-aliasing ........................................................................................................................................ 81 Scaling Images .................................................................................................................................... 81 Chapter 3 - Introducing the Game Loop ..................................................................................................... 81 Process Input ....................................................................................................................................... 82 Simulate Game World ......................................................................................................................... 82 Render ................................................................................................................................................. 82 What are Threads? .................................................................................................................................. 83 Why do we need Threads in our game program? ............................................................................... 83 Creating a Thread ................................................................................................................................ 85 Lab 3-1: A Quick Introduction to Using Ant ...................................................................................... 87 Lab 3-2: Bouncing Ball ....................................................................................................................... 92 Lab 3-3: Displaying an animated GIF ..............................................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    155 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us