Slick2D Game Development


Slick2D Game Development
eBook: $17.99
Formats: PDF, PacktLib, ePub and Mobi formats
$15.29
save 15%!
Print + free eBook + free PacktLib access to the book: $47.98    Print cover: $29.99
$29.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Work with Slick2D game workflow
  • Learn how to develop game components with hands-on examples
  • Get to grips with game analysis and enhancement

Book Details

Language : English
Paperback : 116 pages [ 235mm x 191mm ]
Release Date : October 2013
ISBN : 178328983X
ISBN 13 : 9781783289837
Author(s) : Jacob Bevilacqua
Topics and Technologies : All Books, Game Development, Open Source

Table of Contents

Preface
Chapter 1: Setting Up Slick2D
Chapter 2: Game Structure
Chapter 3: The Slick2D Workflow
Chapter 4: A Deeper Look at Rendering
Chapter 5: A Look at Input
Chapter 6: Sound and Music
Chapter 7: From Example to Game
Appendix A: Full Source Code
Appendix B: Packaging Our Game
Index
  • Chapter 1: Setting Up Slick2D
    • What is Slick2D?
    • Downloading the Slick2D and LWJGL files
    • Setting up an eclipse project
    • Native files
      • What if I want my game to be platform-specific?
    • Summary
    • Chapter 2: Game Structure
      • Game structures
        • The basic game structure
          • The first step to creating a basic game
          • Next we need to add the Slick2D workflow
          • Next we need to complete the main method
          • Let's break down the main method
      • State-based games
        • The uses of a state-based game
        • Game states
          • Setting up a basic game state
        • Switching between states
      • Setting up a state-based game
      • Customizing state switching
        • Pre/Post state transition workflow
      • The app game container in all its greatness
      • Closing the window
      • What we learned
      • Starting our game
      • Summary
      • Chapter 3: The Slick2D Workflow
        • Game workflow
        • Using the workflow
        • The initiation method
          • Using the initiation method
        • Initializing images
          • Loading images using a sprite sheet
          • Converting buffered images to Slick2D images
        • The update method
          • Using the update method
          • Delta and how to utilize delta time
          • Utilizing the delta variable in player movement
          • Delta timers
          • Input handling
        • The render method
          • Using the render method
          • Uses for rendering
          • Rendering is for another day!
        • Workflow in a state-based game
          • What we learned
          • Adding to our game
          • Adding the delta timer
          • Loading an image
        • Summary
        • Chapter 4: A Deeper Look at Rendering
          • Rendering
          • How Slick2D makes rendering easy
          • What can we render?
          • Using the graphics parameter
            • Drawing primitive shapes
          • Drawing a line
          • Drawing rectangles
            • Rounded rectangles
          • Drawing ovals and circles
            • Alternative parameter list
          • Drawing Arcs
            • Alternative parameter list
          • Drawing gradient lines
            • Option 1 – Slick2D's color class
            • Option 2 – define custom colors
          • Drawing strings
          • Altering the behavior of the graphics object
            • Anti-Aliasing
            • Color
            • Line width
          • Drawing textured shapes
          • Drawing images
          • Scaling images
          • Applying a color filter to an image
          • What have we learned?
          • Adding to our game
          • Summary
          • Chapter 5: A Look at Input
            • The importance of user input
            • Uses of input
            • Using input for movement
              • Basic overview of vectors
                • Vector position
                • Vector direction
                • Vector magnitude
                • Vectors in Slick2D
              • Keyboard input
                • Single press
                • Key down
              • Key codes
                • Using isKeyDown() to implement movement
              • Mouse input
                • Mouse location
                • Mouse click
                • Combining mouse location and mouse click
            • What we learned
            • Adding to our game
            • Summary
            • Chapter 6: Sound and Music
              • The importance of sound and music
                • Using music and sound as a game mechanic
              • How to create sound effects and music
                • Sound effect software
                  • SFXR
                  • BFXR
                • Music creation software
                  • Musagi
                  • Fruity Loops studio
              • Using music in Slick2D
                • Music positioning
                • Fading music
                • Altering and reviewing music variables
              • Using sound in Slick2D
              • Utilizing sound in an example
              • What have we learned?
              • Adding to our game
              • Summary
              • Chapter 7: From Example to Game
                • What we will cover
                • The future of our game
                • Utilizing our delta timer
                • Adding lives and points
                  • Lives
                  • Point system
                • Finishing the delta timer
                • Checking for side collision
                • Adding visual feedback
                • Making the game unique
                • Summary

                    Jacob Bevilacqua

                    Jacob Bevilacqua is a student who works on open source projects as well as game development projects in his free time. He has worked on several open source projects and has started one himself. Jacob is proficient in Java and Java game development, using both Slick2D and LibGDX.
                    Sorry, we don't have any reviews for this title yet.

                    Code Downloads

                    Download the code and support files for this book.


                    Submit Errata

                    Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                    Errata

                    - 1 submitted: last submission 06 Jan 2014

                    On Page Number 29:
                    The line:
                    tex = BufferedImageUtil.getTexture(""Blank Hold"", image);

                    incorrectly has double quotes it should be:
                    tex = BufferedImageUtil.getTexture("Blank Hold", image);



                    On Page Number 32:

                    The algorithm for detecting delay time intervals will lose time.
                    In book:
                    if(elapsedTime >= delay) {
                    elapsedTime = 0;
                    } else elapsedTime += delta;

                    Better code:
                    if(elapsedTime >= delay) {
                    elapsedTime -= delay; // tracks of reminder
                    } else elapsedTime += delta;


                    On Page Number 32:

                    The code:
                    Private int elapsedTime;

                    It should be:
                    private int elapsedTime;

                    Reason: Private is incorrect and creates a syntax error.


                    On Page number 33:
                    Text reads:
                    "Slick2D makes rendering incredibly easy by eliminating many tedious tasks such as creating sharers or creating and using a sprite batch."

                    It should be read:
                    "Slick2D makes rendering incredibly easy by eliminating many tedious tasks such as creating shaders or creating and using a sprite batch."


                    On Page number 35:
                    Syntax error:

                    Code in book:
                    Private int elapsedTime;
                    It should be:
                    private int elapsedTime;


                    On Page Number 61:

                    The sentence:
                    "The magnitude of a two-dimensional vector is not the combined length of both vectors."
                    It should read:
                    "The magnitude of a two-dimensional vector is not the combined length of both numbers."

                    On Page Number 64:

                    Code:
                    if(input.isKeyPressed(Input.KEY_LEFT) {}
                    if(input.isKeyDown(Input.KEY_LEFT) {}

                    Correction:
                    if(input.isKeyPressed(Input.KEY_LEFT)) {}
                    if(input.isKeyDown(Input.KEY_LEFT)) {}



                    On Page Number 67:

                    Code:
                    Input.mouseButtonClicked(int KeyCode);
                    Should match JavaDoc and method purpose and function.

                    Suggestion:
                    Input.mouseButtonClicked(int button);

                    Note: Replaces with argument name that matches function and intention.


                    Sample chapters

                    You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                    Frequently bought together

                    Slick2D Game Development +    WordPress 3 Cookbook =
                    50% Off
                    the second eBook
                    Price for both: £18.75

                    Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                    What you will learn from this book

                    • Set up the Slick2D workflow
                    • Render images, primitive shapes, strings, and more, to the screen
                    • Update the screen and utilize delta time
                    • Utilize user input to manipulate the game state
                    • Implement music and sound effects
                    • Export and distribute your final game

                    In Detail

                    Most of the game development enthusiasts are ‘tinkerers’—people who are good at programming and know a lot about programming methods; however, they may have never written a complete game program, but would like to know how to create a program. Transitioning from programming to game development can often be difficult, however, Slick2D helps developers to create amazing games without having to deal with low level programming, and it simplifies many of the daunting tasks, such as rendering and window creation.

                    This practical guide will help you to understand the different components of Slick2D. Throughout the course of this book, you will develop different components, and by the end of the book you will combine all of these components to assemble a complete game.

                    Enabling you to add life to your games, this book will focus on the Slick2D game library. Starting with the installation and configuration of a game library, you will then move onto understanding the structure of a game. Throughout the book, you will be involved in developing different sections of a single game, which will help you to gain hands- on experience in understanding the Slick Workflow. Following on from this, you will be shown how to add additional features to your game such as adding input and music, while taking a detailed look at the render method.

                    Approach

                    A simple guide, packed with tutorials that ease you into learning about the Slick game workflow and Slick game library.

                    Who this book is for

                    If you are a game programmer who would like to expand on your skills and become a game developer, this book is ideal for you. No previous knowledge of Slick 2D or any other Java game library is required. This book assumes that you have basic Java syntax and object oriented programming knowledge.

                    Code Download and Errata
                    Packt Anytime, Anywhere
                    Register Books
                    Print Upgrades
                    eBook Downloads
                    Video Support
                    Contact Us
                    Awards Voting Nominations Previous Winners
                    Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                    Resources
                    Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software