WRITE CODE LIKE A PRO CREATE WORKING APPLICATIONS
Published by: John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030-5774, www.wiley.com
Copyright 2018 by John Wiley & Sons, Inc., Hoboken, New Jersey
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions
.
Trademarks: Wiley, For Dummies, Dummies.com, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and may not be used without written permission. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support, please visit https://hub.wiley.com/community/support/dummies
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com
. For more information about Wiley products, visit www.wiley.com
.
Library of Congress Control Number: 2017959361
ISBN: 978-1-119-40417-0 (pbk); ISBN 978-1-119-40423-1 (ebk); ISBN 978-1-119-40426-2 (ebk)
Write Code Like a Pro Create Working Applications
Table of Contents
Guide
Pages
INTRODUCTION
So you want to make your very own videogame? And you want to learn how to code in Java? That is an awesome idea!
Writing Java code can be really hard work, especially writing Java code to make a videogame. For example, the original Legend of Zelda took more than 100 people three years to make! But dont worry, this book will guide your through all the steps to learn the basics of Java programming and to make two videogames of your own. The first game youll make is kind of like Mario, where you have a character that runs across the screen and tries to avoid lava pits and enemies. The second, larger game that youll code is kind of like Flappy Bird. Its called Ninja Bird. Keeping track of scores, making pipes move on their own randomly, and even helping the bird fly youll have your friends playing games you make for hours!
ABOUT THIS BOOK
This book uses a computer application called Processing that was made to make coding Java video games much easier. As youll see, you can easily make drawings with different shapes and colors, you can add images that you find online (with adult permission, of course!) into your drawing and games, and it comes with an entire library of code that you get to just use. Its free, and available online. In the first chapter, youll learn how to download it and begin using it in just a couple of simple steps.
Write Code Like a Pro has three different types of programs that youll write. First, youll make a simple drawing using a lot of what Processing provides to you in its library. With shapes and colors, the first couple chapters of this book guide you through an art program. The next part of this book teaches you how to turn that drawing into an animation making shapes and images move around the canvas. Finally, youll get a chance to build two different videogames.
Though this book will guide you step-by-step in making these games, youre highly encouraged to keep coding after you finish this book and make variations of the games you learn here! This is just the beginning of your coding and videogame development career. With this book as a starting point, you never know what you can achieve!
FOOLISH ASSUMPTIONS
Everybody has to start somewhere, right? I had to start writing this book by assuming that youre comfortable doing this stuff:
- Typing on a computer and using a mouse: You may know how to use a Windows system or a Mac; either one will do. This book shows examples on a Mac.
- Following instructions: Coding is very precise. There are a lot of pieces to the puzzle when youre making an application. Its very important that you already know how to follow instructions carefully, and compare pictures in the book to what youre making on your own.
ICONS USED IN THIS BOOK
As you read through the projects in this book, youll see icons. The icons point out different things:
The Remember icon highlights ideas that you should keep in mind.
The Tip icon marks advice and shortcuts that can make coding easier.
WHERE TO GO FROM HERE
In this book, its best if you start from guide you through making Ninja Bird, which is a game like Flappy Bird.
So, you want to learn how to code in Java. Thats a great goal! In this book, youll learn the basics of Java while learning how to make a videogame! Coding can be tricky. Sometimes its frustrating. Remember to keep trying, test your code, and double-check that youve typed everything correctly. With dedication, youll learn a lot and have fun doing it!
Next page