Learn Unity3d Programming with Unityscript Suvak Also Available: ONLINE

Total Page:16

File Type:pdf, Size:1020Kb

Learn Unity3d Programming with Unityscript Suvak Also Available: ONLINE Learn Unity3D Programming with UnityScript TECHNOLOGy iN ACtiON™ earn Unity Programming with UnityScript is your step-by-step Also available: Lguide to learning to make your first Unity games using UnityScript. Learn You will move from point-and-click components to fully customized features. You need no prior programming knowledge or any experience with other design tools such as PhotoShop or Illustrator - Unity3D Learn you can start from scratch making Unity games with what you’ll learn Unity3D in this book. Through hands-on examples of common game patterns, you’ll learn and apply the basics of game logic and design. You will gradually become comfortable with UnityScript syntax, at each point having everything explained to you clearly and concisely. Many beginner Programming Programming programming books refer to documentation that is too technically abstract for a beginner to use - Learn Unity Programming with UnityScript will teach you how to read and utilize those resources to hone your skills, and rapidly increase your knowledge in Unity game development. with UnityScript You’ll learn about animation, sound, physics, how to handle user interaction and so much more. Janine Suvak has won awards for her game development and is ready to show you how to start your journey as a game developer. The Unity3D game engine is flexible, Unity’s JavaScript for Beginners cross-platform, and a great place to start your game development with adventure, and UnityScript was made for it - so get started game programming with this book today. UnityScript CREATE EXcITING UNITY3D GAMES WITH UNITYScRIPT Suvak ISBN 978-1-4302-6586-3 54499 Shelve in Macintosh/General User level: Beginning 9781430 265863 SOURCE CODE ONLINE www.apress.com Janine Suvak For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. Contents at a Glance About the Author .............................................................................................................. xvii About the Technical Reviewer ........................................................................................... xix Acknowledgments ............................................................................................................. xxi Introduction ..................................................................................................................... xxiii ■■Chapter 1: Getting Started with Unity ................................................................................1 ■■Chapter 2: Game Programming 101 ................................................................................27 ■■Chapter 3: Making a Simple Scene ..................................................................................61 ■■Chapter 4: Using Scripts and the GameObject .................................................................85 ■■Chapter 5: Moving the GameObject ...............................................................................109 ■■Chapter 6: Starting with Coding Physics .......................................................................157 ■■Chapter 7: Using Advanced Physics Concepts ..............................................................187 ■■Chapter 8: Particle Emitters and Special Effects ...........................................................221 ■■Chapter 9: Game Design and Logic—The Blueprint ......................................................249 ■■Chapter 10: Putting the Pieces Together and Building Your Game ................................269 ■■Chapter 11: Enhancing The User Experience: GUI and Sound ........................................303 v vi Contents at a Glance ■■Chapter 12: Optimizing Your Game ................................................................................337 ■■Chapter 13: Where to Go from Here ...............................................................................363 Index .................................................................................................................................387 Introduction If you have the desire to create video games but have no experience with programming or game development, this is the book for you. Unity is a powerful game development ecosystem for creating 2D and 3D games. With its basic but still powerful free version, Unity has blasted away the barriers to learning game development. While the Unity editor is visual and intuitive in nature, you will have to learn to script in order to complete your game. Not to fear—all you need is a computer, an Internet connection, and motivation. This book is written for the complete beginner in both game development and programming. Scripting, programming, and coding are synonymous terms that all refer to the process of writing computer code to direct some portion of the game behavior. While it may seem a little daunting, as with any other endeavor you simply start at the beginning and learn one thing at a time. You can’t make a game without writing some code, but creating the code is only a part of the game development process. You’ll have just as much fun learning to find and use characters, animations, special effects, and other assets as you will writing code for directing their interaction within your game. Unity Technologies, the maker of Unity3D, provides excellent support documentation that most often includes working sample code. When I was a beginner developer, whether in mobile apps or video games, I found that almost all of the documentation was just about as clear and useful as if it were written in hieroglyphics—pretty much incomprehensible. I was stuck in a hole where I needed documentation on how to use the documentation! The purpose of this book is to bridge this initial gap—to give you a foundation in programming within the context of using Unity to make a simple game, while connecting what you are learning to the relevant information found in the documentation, and even to using some of the sample code. This book is meant as a launching pad: by the time you are through working on its examples, you should be able to confidently build on your newfound knowledge and skills with the many resources introduced to you throughout this book. With that in mind, read the chapters in order. After an introduction to the basics of programming concepts and to the Unity editor in the first few chapters, the subsequent projects will begin building upon each other from one chapter to the next. To get the most out of this book, follow along and complete the projects step by step from scratch. The best way to learn and (just as important) retain what you are learning is by doing. Besides, it’s fun and definitely more satisfying to do it yourself. xxiii xxiv Introduction The game development industry is in constant motion, and with over half of all game developers using Unity, from individuals to large studios, you can bet that Unity Technologies is constantly pushing the envelope to provide better tools and game engine performance. In particular, during the time this book was written, several radical changes were made affecting animations, particle systems, and better assets for rapid prototyping. Any changes affecting the instructions in this book from Unity or elsewhere will be noted in the Errata section of the book’s Apress web page, www.apress.com/9781430265863. Sometimes it is helpful to have the finished project as a reference. You will be able to find the source code and finished projects for the examples in this book under the Source Code/Downloads tab of its Apress web page. The best way to learn how to make games is by making games, so turn the page to get started! Chapter 1 Getting Started with Unity This is a great time to learn to develop games. Unity has emerged as one of the most popular game engines for game developers, and Unity Technologies continues to make dramatic changes to make Unity more accessible to indie developers. There are now more platforms to which Unity games can be ported (meaning it can be used on many devices), the Asset Store is available for centralized game resources, and Unity provides outstanding support that has expanded to include professional assessment and feedback for your game. There is even an entire new (at the time of writing) division that collaborates with developers and publishes games. Making games is an amazing experience and provides even more bragging rights than a high score or near-impossible headshot. Welcome to the fun! By “games” the folks behind Unity also recognize the expanding field of “serious games”— simulations and other immersive, interactive experiences developed using Unity3D for a rising number of different industries and uses. From NASA’s Mars exploration and CliniSpace’s virtual medical training environments to CrossPlatform DeSign’s animated crime scene reconstructions and virtual industrial trainers, serious games are appearing in new venues at a rapid rate. If serious game development is the direction in which you want to go, I believe that Unity is the best tool for it and this book is the best place to get started. This book assumes you have a computer and that you are familiar enough with using an Internet browser to download files—and that is all. If you have an interest in game development but no prior experience in Unity, programming, or digital art/content creation, you are in the right place. If you have some background in one or the other, you’ll find this book helpful for introducing you to Unity, programming,
Recommended publications
  • Images of Aggression and Substance Abuse in Music Videos : a Content Analysis
    San Jose State University SJSU ScholarWorks Master's Theses Master's Theses and Graduate Research 2009 Images of aggression and substance abuse in music videos : a content analysis Monica M. Escobedo San Jose State University Follow this and additional works at: https://scholarworks.sjsu.edu/etd_theses Recommended Citation Escobedo, Monica M., "Images of aggression and substance abuse in music videos : a content analysis" (2009). Master's Theses. 3654. DOI: https://doi.org/10.31979/etd.qtjr-frz7 https://scholarworks.sjsu.edu/etd_theses/3654 This Thesis is brought to you for free and open access by the Master's Theses and Graduate Research at SJSU ScholarWorks. It has been accepted for inclusion in Master's Theses by an authorized administrator of SJSU ScholarWorks. For more information, please contact [email protected]. IMAGES OF AGGRESSION AND SUBSTANCE USE IN MUSIC VIDEOS: A CONTENT ANALYSIS A Thesis Presented to The Faculty of the School of Journalism and Mass Communications San Jose State University In Partial Fulfillment of the Requirements for the Degree Master of Science by Monica M. Escobedo May 2009 UMI Number: 1470983 Copyright 2009 by Escobedo, Monica M. INFORMATION TO USERS The quality of this reproduction is dependent upon the quality of the copy submitted. Broken or indistinct print, colored or poor quality illustrations and photographs, print bleed-through, substandard margins, and improper alignment can adversely affect reproduction. In the unlikely event that the author did not send a complete manuscript and there are missing pages, these will be noted. Also, if unauthorized copyright material had to be removed, a note will indicate the deletion.
    [Show full text]
  • Representations of Women in Music Videos
    Western Michigan University ScholarWorks at WMU Master's Theses Graduate College 8-1999 Creativity Or Collusion?: Representations of Women in Music Videos Jan E. Urbina Follow this and additional works at: https://scholarworks.wmich.edu/masters_theses Part of the Sociology Commons Recommended Citation Urbina, Jan E., "Creativity Or Collusion?: Representations of Women in Music Videos" (1999). Master's Theses. 4125. https://scholarworks.wmich.edu/masters_theses/4125 This Masters Thesis-Open Access is brought to you for free and open access by the Graduate College at ScholarWorks at WMU. It has been accepted for inclusion in Master's Theses by an authorized administrator of ScholarWorks at WMU. For more information, please contact [email protected]. CREATIVITYOR COLLUSION?: REPRESENTATIONS OF WOMEN INMUSIC VIDEOS by Jan E. Urbina A Thesis Submittedto the Facuhy of The GraduateCollege in partial folfitlment of the requirementsfor the Degree of Master of Arts Departmentof Sociology WesternMichigan University Kalamazoo, Michigan August 1999 Copyright by Jan E. Urbina 1999 ACKNOWLEDGEMENTS There are certain individuals that touch our lives in profound and oftentimes unexpected ways. When we meet them we feel privileged because they positively impact our lives and help shape our futures, whether they know it or not. These individuals stand out as exceptional in our hearts and in our memories because they inspire us to aim high. They support our dreams and goals and guide us toward achieving them They possess characteristics we admire, respect, cherish, and seekto emulate. These individuals are our mentors, our role models. Therefore, I would like to extend my deepest gratitude to the outstanding members ofmy committee, Dr.
    [Show full text]
  • THE WRITE CHOICE by Spencer Rupert a Thesis Presented to The
    THE WRITE CHOICE By Spencer Rupert A thesis presented to the Independent Studies Program of the University of Waterloo in fulfilment of the thesis requirements for the degree Bachelor of Independent Studies (BIS) Waterloo, Canada 2009 1 Table of Contents 1 Abstract...................................................................................................................................................7 2 Summary.................................................................................................................................................8 3 Introduction.............................................................................................................................................9 4 Writing the Story...................................................................................................................................11 4.1 Movies...........................................................................................................................................11 4.1.1 Writing...................................................................................................................................11 4.1.1.1 In the Beginning.............................................................................................................11 4.1.1.2 Structuring the Story......................................................................................................12 4.1.1.3 The Board.......................................................................................................................15
    [Show full text]
  • “The Beatles Raise the Bar-Yet Again”By Christopher Parker
    “The Beatles Raise the Bar-Yet Again” by Christopher Parker I know what you’re thinking. You’re thinking, Parker, everyone knows that 1967’s Sgt. Pepper‘s Lonely Hearts Club Band is the Beatles’ greatest album and in fact the greatest album of all time. Nope. No way. I beg to differ. In my humble opinion, 1966’s Revolver, the Beatles album released the year before Sgt. Pepper, is the greatest. Why, you ask? In many ways, Revolver was the beginning of a new era, not only in the career of the Beatles, but in the ever-changing world of rock & roll. The world’s greatest rock band was beginning to tire of the endless touring amidst the chaos of Beatlemania. The constant battling against hordes of screaming fans, and a life lived being jostled and shoved from one hotel room to another were becoming more than tiresome. In addition, during a concert, the volume of screams often exceeded 120 decibels-approximately the same noise level as one would be exposed to if he were standing beside a Boeing 747 during takeoff. No one was listening to their music, and consequently, they were beginning to feel like, as John Lennon would later say, ‘waxworks’ or ‘performing fleas.’ Revolver signals a change from the ‘She Loves You’ era-relatively simple songs of love and relationships- to a new era of songs designed to be listened to. These were songs that could never be played at a live concert. They were creations-works of art-songs that were created to be appreciated and discussed-not to elicit screams from teenage girls.
    [Show full text]
  • Video Game Systems Uncovered
    Everything You Ever Wanted To Know About... VIDEO GAMES But Never Dared To Ask! Introduction: 1 With the holidays quickly approaching the odds are you will be purchasing some type of video game system. The majority of U.S. households currently have at least one of these systems. With the ever changing technology in the video world it is hard to keep up with the newest systems. There is basically a system designed for every child’s needs, ranging from preschool to young adult. This can overwhelming for parents to choose a system that not only meets your child’s needs but also gives us the best quality system for our money. With the holidays coming that means many retailers will be offering specials on video game systems and of course the release of long awaited games. Now is also the time you can purchase systems in bundles with games included. Inside you will learn about all of these topics as well as other necessities and games to accompany to recent purchase. What you’ll find here: 2 In this ebook you will learn about console and portable video game systems, along with the accessories available. You will also find how many games each system has to offer. You will get an in depth look at the pro’s and con’s of each current system available in stores today, and the upcoming systems available in the near future. As a concerned parent you should also be aware of the rating label of the games and what the rating exactly means.
    [Show full text]
  • MTO 23.2: Lafrance, Finding Love in Hopeless Places
    Finding Love in Hopeless Places: Complex Relationality and Impossible Heterosexuality in Popular Music Videos by Pink and Rihanna Marc Lafrance and Lori Burns KEYWORDS: Pink, Rihanna, music video, popular music, cross-domain analysis, relationality, heterosexuality, liquid love ABSTRACT: This paper presents an interpretive approach to music video analysis that engages with critical scholarship in the areas of popular music studies, gender studies and cultural studies. Two key examples—Pink’s pop video “Try” and Rihanna’s electropop video “We Found Love”—allow us to examine representations of complex human relationality and the paradoxical challenges of heterosexuality in late modernity. We explore Zygmunt Bauman’s notion of “liquid love” in connection with the selected videos. A model for the analysis of lyrics, music, and images according to cross-domain parameters ( thematic, spatial & temporal, relational, and gestural ) facilitates the interpretation of the expressive content we consider. Our model has the potential to be applied to musical texts from the full range of musical genres and to shed light on a variety of social and cultural contexts at both the micro and macro levels. Received December 2016 Volume 23, Number 2, June 2017 Copyright © 2017 Society for Music Theory [1.1] This paper presents and applies an analytic model for interpreting representations of gender, sexuality, and relationality in the words, music, and images of popular music videos. To illustrate the relevance of our approach, we have selected two songs by mainstream female artists who offer compelling reflections on the nature of heterosexual love and the challenges it poses for both men and women.
    [Show full text]
  • TBS GCSE MUSIC A4 Revison.Indd
    GCSE Music. Comprehensive resource pack to support the popular Music area. GCSE Music. Contents. 1. Introduction 2. Learning Aims and Objectives 3. Before Sgt Pepper 4. The ‘concept album’. 5. Pop Art, Peter Blake and the importance of album art in the 60s and beyond 6. L yric Analysis: (exploring melody, harmony, structure, rhythm and meaning behind the lyrics) — Lucy in the Sky — Within You/Without You — With a Little Help from my Friends 7. Worksheets – exploring structure: With a Little Help from My Friends and Within You, Without You 8. Sgt Pepper lectures @ The Beatles Story 9. The Beatles story and Liverpool Hope Partnership 10. Booking a visit to the Beatles Story 11. L yrics: With a Little Help from My Friends, Lucy in the Sky, Within you, Without You 12. Fascinating facts about the album 13. Recommended reading list/websites 2 Introduction. Located within Liverpool’s historic Albert Dock, the Beatles Story is a unique visitor attraction that transports you on an enlightening and atmospheric journey into the life, times, culture and music of the Beatles. Since opening in 1990, the Beatles Story has continued to develop our learning resources to create a fun and educational experience for all. Our commitment to life-long learning ensures every guest has a valuable experience, whatever their age or ability. We have linked the story of the Beatles, their early lives, their fame and combined creativity to selected areas of the National Curriculum: history, literacy, art and music to actively encourage and involve pupils in their own learning. This resource pack focuses on GCSE Music in accordance with the AQA specification.
    [Show full text]
  • The Influence of Rap/Hip-Hop Music: a Mixed-Method Analysis by Gretchen Cundiff — 71
    The Influence of Rap/Hip-Hop Music: A Mixed-Method Analysis by Gretchen Cundiff — 71 The Influence of Rap/Hip-Hop Music: A Mixed-Method Analysis on Audience Perceptions of Misogynistic Lyrics and the Issue of Domestic Violence Gretchen Cundiff* Strategic Communications Elon University Abstract Using a qualitative content analysis and online survey, this research examined how college students perceive and respond to the portrayal of women when exposed to misogynistic lyrics. Based on cultivation theory, this study analyzed the lyrical content of popular rap and hip-hop songs (n=20) on Billboard’s “Hot 100” chart between 2000 and 2010. Song lyrics were classified into one or more of the following coding categories: demeaning language, rape/sexual assault, sexual conquest and physical violence. Themes of power over, objectification of and violence against women were identified as prevalent throughout the content analysis sample. Survey results indicated a positive correlation between misogynous thinking and rap/hip-hop consumption. I. Introduction This study examined the culture of rap/hip-hop music and how misogynistic lyrical messages influ- enced listeners’ attitudes toward intimate partner violence. Adams and Fuller (2006) define misogyny as the “hatred or disdain of women” and “an ideology that reduces women to objects for men’s ownership, use, or abuse” (p. 939). Popular American hip-hop and rap artists, such as Eminem, Ludacris and Ja Rule, have increasingly depicted women as objects of violence or male domination by communicating that “submission is a desirable trait in a woman” (Stankiewicz & Rosselli, 2008, p. 581). These songs condone male hegemony in which “men find the domination and exploitation of women and other men to be not only expected, but actu- ally demanded” (Prushank, 2007, p.
    [Show full text]
  • The Counterculture, the Straight Society, and the Beatles
    Myles Libby 10/14/09 CORE 2638 The Counterculture, the Straight Society, and the Beatles The counterculture of the mid to late 1960’s had an enormous impact on the musical and artistic culture of the era. Many artists were products of the underground scene, while others were legends before the scene emerged. In such cases, due to the influence of the counterculture, the development of different sounds and new images of particular groups is easily noticeable. One such group, the Beatles, is of great importance due to their unusually extreme popularity worldwide. Analyzing their career from start to finish, it is effortless to see and hear how they altered their appearance, image, and more importantly, their musical styles over time. Looking at early albums created by the Beatles, such as With the Beatles and A Hard Days Night, we see a generally constant theme. Their music tends to be very poppy and their lyrics very straightforward, made up of mostly boy/girl love stories, such as their early single ‘Love Me Do.’ At this point in time, for the fans at least, the Beatles seemed to be an image (the ‘fab four’) rather than a strong, musically talented influence. Discussing one of the early American tours, Ringo Starr describes, “I never felt people came to hear our show, I felt they came to see us.” (Beatles Anthology Part 5) Both Paul McCartney and Starr seemed to feel that because of the immensity of the screams and the poor quality of the speakers, the result of the music must have been very poor; but that’s not what mattered for the fans.
    [Show full text]
  • The Beatles and the Crisis of Self-Identity
    Sosland Journal 77 THE BEATLES AND THE CRISIS OF SELF-IDENTITY Jared Gutzmer “Ringo- a lovely performer. George- a mystical unre- alized talent. But John and Paul, Saints John and Paul, were, and made, and aureoled and beatifi ed and eternalized the concept that shall always be known, remembered and deeply loved as The Beatles” -Leonard Bernstein The Beatles are one of the most popular bands of all time. This is an undisputed fact no matter the location. They were so popular that in America, they had to stop touring due to the screaming fans which caused the band not to be able to hear themselves. Never before was there a group that was so incredibly popular in history. This popularity and other fac- tors led the members of the Beatles to change as individuals and as a group as they matured musically and mentally. Their identity shifted from a group identity to a self-identity. From the Beatles fi rst album, Please Please Me, to their last, Let It Be, the shift in their identity can be seen through their music and the appearances that led to individualism and eventually their downfall. 78 Sosland Journal The Music “It would not seem quite so likely that the accompany- ing fever known as Beatlemania will also be success- fully exported. On this side of the Atlantic it is dazed stuff.” -Jack Gould, New York Times television critic The Beatles music and lyrics changed drastically from their fi rst to last album due to adapting to a changing soci- ety, musical maturity, and their increased popularity.
    [Show full text]
  • PDF (Enjoying the Nightlife in Europe
    Enjoying the nightlife in Europe. The role of moderation Recreational nightlife in Europe is diverse Authors: Amador Calafat, Cesáreo Fernández, Montserrat Juan, and complex. This study explores the behaviour Anu-Hanna Anttila, Ruth Arias, Mark A. Bellis, Karl Bohrn, Regina Fenk, and beliefs of young people who participate in recreational life whilst choosing not to use Karen Hughes, Andrea Viktoria Kerschl, Anna Kokkevi, Kristiina Kuussaari, substances or to do so only occasionally and Frank Leenders, Fernando Mendes, Joseph Simon, Maria Spyropoulou, moderately. Goof van de Wijngaart, Patrizia Zavatti The research is empirically based. Statistical and ethnographic data have been collected from a sample of 1,777 young people who were interviewed in recreational environments across ten European cities. The analyses focus on key issues in the relationship between young people and drug consumption including: gender differences, risk perception, management of finances, leisure, free time, prospects, control of risk and sexuality. We hope that this work will contribute to the development of new strategies for creating healthier attitudes among young people by enabling greater levels of independence and personal autonomy. This book and other IREFREA books can be downloaded in www.irefrea.org Enjoying the nightlife in Europe. The role of moderation The role Enjoying the nightlife in Europe. IREFREA is a european network interested in the promotion and research of primary prevention of different sorts of juvenile malaise and the study of associated protective and risk factors. ENJOYING THE NIGHTLIFE IN EUROPE. THE ROLE OF MODERATION Book Coordinator: A. P. Relvas 3 ENJOYING THE NIGHTLIFE IN EUROPE. THE ROLE OF MODERATION Authors: Amador Calafat, Cesáreo Fernández, Montserrat Juan, Anu-Hanna Anttila, Ruth Arias, Mark A.
    [Show full text]
  • Chapter 2 Drug and Alcohol Use Among Young People
    Chapter 2 Drug and alcohol use among young people This chapter looks in detail at what is known about the changing picture of drug and alcohol use among the young and complements a similar focus piece in the accompanying report on the state of the drugs problem in the European Union and Norway. Main findings to the number who disapproved of experimenting with cannabis, although the actual rates of disapproval did vary The findings summarised in this chapter constitute only a between countries. This finding, already apparent from the part of what we know about the use of illicit drugs and limited data presented in the 1995 ESPAD study, is even alcohol among young people in the CEECs. It should clearer in the 1999 data set (Figure 4). This situation may be emphasised that the available information comes reflect the increasing ‘normalisation’ of experimenting with predominantly from students attending high schools; in cannabis (and of getting drunk) among young people. the CEECs there has been no research into indicators of alcohol and illicit drug use in the most vulnerable groups In 1999, disapproval of ‘getting drunk’ was greater than or of young people: those not attending schools and/or equal to disapproval of ‘cannabis experimentation’ in the members of marginalised groups. This is the main Czech Republic, Latvia, Slovakia and Slovenia. Disapproval weakness of the data presented. of cannabis experimentation was significantly higher than disapproval of alcohol use in Bulgaria, Hungary, Romania Lifetime prevalence (4) of the use of both licit (5) and illicit and Lithuania. In Estonia, the difference between the two drugs is the most commonly reported indicator (even if not ratings was statistically insignificant.
    [Show full text]