Cannon Game 1 Fall 2014 CS7020: Game Design and Development.

Slides:



Advertisements
Similar presentations
Programming with Android: Activities
Advertisements

- Rohit Vobbilisetty. What is the Camera API Capture Photos Capture Videos Camera API - Android2.
Threads, Surface Views and Real-Time Games. Background Most of the Android apps we’ve covered so far have been single threaded – And Event driven – An.
Understanding Mobile App Development Concepts and Working with APIs Lesson 6.
Chapter 6 Jam! Implementing Audio in Android Apps.
Chapter 6: Jam! Implementing Audio in Android Apps.
Programming with Android: Activities
Android 02: Activities David Meredith
The Android Activity Lifecycle. Slide 2 Introduction Working with the Android logging system Rotation and multiple layouts Understanding the Android activity.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 18 – Macromedia Flash MX 2004: Building an Interactive Game Outline 18.1 Introduction 18.2 Object-Oriented.
Object Oriented Programming with Java (150704).   Applet  AWT (Abstract Window Toolkit)  Japplet  Swing Types of Applet.
How do games work? Game Workshop July 4, Parts Sprites/pictures Map/background Music/sounds Player character Enemies Objects.
1 Lab Session-1 CSIT221 Fall 2002 b Refresher slides b Practice Problem b Lab Exercise (Demo Required)
1 Frameworks. 2 Framework Set of cooperating classes/interfaces –Structure essential mechanisms of a problem domain –Programmer can extend framework classes,
CS220 Software Development Lecture: Multi-threading A. O’Riordan, 2009.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 14 Applets, Images,
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L05 (Chapter 16) Applets.
CS371m - Mobile Computing Audio.
CS378 - Mobile Computing What's Next?. Fragments Added in Android 3.0, a release aimed at tablets A fragment is a portion of the UI in an Activity multiple.
Networking Nasrullah. Input stream Most clients will use input streams that read data from the file system (FileInputStream), the network (getInputStream()/getInputStream()),
1 Skip Cave Chief Scientist, Intervoice Inc. Multimodal Framework Proposal.
ANDROID UI – FRAGMENTS. Fragment  An activity is a container for views  When you have a larger screen device than a phone –like a tablet it can look.
Chapter 12 Applets and Advanced Graphics  The Applet Class  The HTML Tag F Passing Parameters to Applets F Conversions Between Applications and Applets.
Favorite Twitter® Searches App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Adobe FLASH What & Why? Where & When? Is Flash dead? What about HTML5?
Doodlz App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
10/10/2015 E.R.Edwards 10/10/2015 Staffordshire University School of Computing Introduction to Android Overview of Android System Android Components Component.
Threads in Java. History  Process is a program in execution  Has stack/heap memory  Has a program counter  Multiuser operating systems since the sixties.
Spong Bluetooth game Developed by: Erik Matzols Fredrik Lindberg.
Chapter 12 Applets and Advanced GUI  The Applet Class  The HTML Tag F Passing Parameters to Applets F Conversions Between Applications and Applets F.
SpotOn Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
111 © 2002, Cisco Systems, Inc. All rights reserved.
Class 02 – 03 Feb 2014 Setup Where do we begin? Know your content Discovering your target user.
Android – Fragments L. Grewe.
Threads in Java. Processes and Threads Processes –A process has a self-contained execution environment. –Has complete set of runtime resources including.
Introduction to Windows Programming
Field Trip #32 Digital Alarm Clock By Keith Lynn.
Services A Service is an application component that can perform long-running operations in the background and does not provide a user interface. An application.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Camera. Make new project – CameraFun – Give permission to use camera write_external _storage Make two buttons – id takePictureButton – id showLastPicButton.
Introduction to Threads Session 01 Java Simplified / Session 14 / 2 of 28 Objectives Define a thread Define multithreading List benefits of multithreading.
SurfaceView.
Mobile Game Framework. Stuff You Should Know… Genres Paper Prototyping Mechanics Theme/Backstory Don’t Code!
1 Applets are small applications that are accessed on an Internet server, transported over the internet, automatically installed and run as a part of web.
Multimedia Capture & storage. Introduction A rich set of API for recording of audio & video. A developer has two choices  launch the built-in app using.
CS378 - Mobile Computing Audio.
1 Threads in Java Jingdi Wang. 2 Introduction A thread is a single sequence of execution within a program Multithreading involves multiple threads of.
Address Book App 1 Fall 2014 CS7020: Game Design and Development.
Class on Fragments & threads. Fragments fragment is a modular section of an activity, which has its own lifecycle, receives its own input events, and.
By: Eliav Menachi.  Android custom 2D graphics library  OpenGL ES 1.0 for high performance 3D graphics.
CHAPTER 7 TouchGestures. Chapter objectives: To code the detection of and response to touch gestures. Patterns of common touches to create touch gestures.
Java for android Development Nasrullah Khan. Using instanceof in Android Development the classes such as Button, TextView, and CheckBox, which represent.
Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, Chapter 4 Implementing.
The Flag Quiz app tests your ability to correctly identify 10 flags from various countries and territories.
The Doodlz app enables you to paint by dragging one or more fingers across the screen. The app provides options for setting the drawing color.
Building UI Components Димитър Н. Димитров Astea Solutions AD.
Editing a Twitter search. Viewing search results in a browser.
CS371m - Mobile Computing Audio. Audio on Device Devices have multiple audio streams: – music, alarms, notifications, incoming call ringer, in call volume,
Java Thread Programming
Audio and Haptic Feedback
Android Application Audio 1.
Lecture 7: Service Topics: Services, Playing Media.
Technologies Overview Media files, such as the sounds, are placed in the app’s resource folder res/raw. When an Activity is shut down, its Fragment.
Cannon Game App Android How to Program
Multithreading.
Multithreading in java.
Interactive Graphics in Android
Lecture 7: Service Topics: Services, Broadcast Receiver, Playing Media.
Mobile Programming Dr. Mohsin Ali Memon.
Presentation transcript:

Cannon Game 1 Fall 2014 CS7020: Game Design and Development

SurfaceView & SurfaceHolder  SurfaceView: – A subclass of view ti which any thread can draw  SurfaceHolder: – SurfaceHolder can manipulate a SurfaceView – SurfaceHolder can obtain a Canvas on which the user can draw graphics – SurfaceHolder provides methods that give a thread exclusive access to the Canvas for drawing  Each SurfaceView should implement the interface SurfaceHolder.Callback 2 Fall 2014 CS7020: Game Design and Development

SurfaceHolder.Callback Methods  SurfaceChanged: – is called when the SurfaceView’s size or orientation changes, and is typically used to redisplay graphics based on changes  SurfaceCreated: – is called when the SurfaceView is created, e.g. when the app first loads or when it resumes from the background  SurfaceDestroyed – is called when the SurfaceView is destroyed, e.g., when the app terminates 2 Fall 2014 CS7020: Game Design and Development

Use Thread to create game loop  Obtain the canvas – SurfaceHolder.lockCanvas(null);  Only one thread at a time can draw to a SurfaceView, we must lock the SurfaceHolder – Synchronized(SurfaceHolder){……}  Release the canvas – SurfaceHolder.unlockCanvasAndPost(canvas ); 2 Fall 2014 CS7020: Game Design and Development

AlertDialog.Builder  A dialog must be displayed from the GUI main thread  Anonymous inner class implements Runnable  activity.runOnUiThread( new Runnable(){ public void run(){ } ) 5 Fall 2014 CS7020: Game Design and Development

GestureDetector  Complex gesture, such as flings, double-taps, long presses, and scrolls  Implement GestureDetector.OnGestureListener and GestureDetector.OnDoubleTapListener interfaces  GestureDetector.SimpleOnGestureListener is an adapter class that implements all the methods of these two interfaces 6 Fall 2014 CS7020: Game Design and Development

Collision Detection  Determine whether the cannonball has collided with any of the GameView’s edges, with the blocker or with a section of the target  We perform simple collision detection based on the rectangular boundary of the cannonball 7 Fall 2014 CS7020: Game Design and Development

Activity Lifecycle Methods  onPause is called when another activity receives the focus – suspend game play so that the game does not continue executing when the user cannot interact with it  onDestroy is called when an Activity is shut down. – Release the app’s resources 7 Fall 2014 CS7020: Game Design and Development

Audio Mangement  res/raw --- media files  Sound effects are managed with a SoundPool, which can be used to load, play, and unload sounds  The android documentation recommends that games use the music audio stream to play sounds  Activity’s setVolumeControlStream specify that the game’s volume can be controlled with the device’s volume keys. The method receives a constant from class AudioManager 10 Fall 2014 CS7020: Game Design and Development

SoundPool  First argument: the maximum number of simultaneous sound streams that can play at once  Second argument: which audio stream will be used to play the sounds – There are 7 streams in AudioManager – The document recommends AudioManager.STREAM_MUSIC  Last argument: sound quality. – The document indicates that this value is not currently used and 0 should be specified as the default value 10 Fall 2014 CS7020: Game Design and Development

SoundMap  HashMap --- key, value pairs – soundMap = new HashMap ();  SoundPool.load take three parameters – First argument: the application’s context – Second argument: resource ID – Third argument: the sound’s priority (the argument is not currently used and should be specified as 1). 10 Fall 2014 CS7020: Game Design and Development