Collision Detection Concept
|
|
- Avice Parrish
- 6 years ago
- Views:
Transcription
1 Collision Detection
2 Collision Detection Concept When two fireflies collide we tag them for removal and add an explosion to the blasts list. The position and velocity of the explosion is set to the average of the two colliding flies. graphical display fireflies list blasts list Blast objects are removed from the blasts list when their animation sequence is completed.
3 Managing Generic Lists Ageneric listcanholdany typeofobject,so they areespeciallywellsuitedforholding structured data types. In Object Oriented Programming we can define a structured data type as an instance class. The class has the additional advantage of holding methods and properties related to the class. In this application we will create a class for the firefly and a class for the blast (explosion). Each firefly will have its own position and velocity. To add more natural appearance to their flight we can randomize the rate of the wing flapping animation for each fly and add a random element to their flight. Warning! MS Visual Studio.NET has a quirky random number generator. When a new Random object is created it's initial seed is determined by the clock time, which means that if multiple instances of a Random object are created in a short time (within a few milliseconds of each other) they will have the same initial seed and will therefore may generate the same pseudo-random sequence.
4 public class firefly public Vector2 Pos; public Vector2 Vel; public int MaxX; public int MaxY; public Rectangle Rect = new Rectangle(); public int AnimCount; public int AnimTimer; public int Time; public int TotCount; public bool Hit; Random rand = new Random(); firefly Class public firefly(int maxx, int maxy, int totcount, int sheetwidth, int sheetheight, int animtimer, int seed) Random rnd = new Random(seed); MaxX = maxx; MaxY = maxy; Pos.X = rnd.next(maxx); Pos.Y = rnd.next(maxy); Vel.X = rnd.next(10) - 5; Vel.Y = rnd.next(10) - 5; Rect.X = 0; Rect.Y = 0; Rect.Width = sheetwidth / totcount; Rect.Height = sheetheight; AnimTimer = animtimer; AnimCount = 0; TotCount = totcount; Time = 0; Hit = false; OK, just so you know, this is a stripped-down version of an instance class which would distress any OOP purist. InthiscourseweuseOOPtoprogram,weDO NOTprogramtouseOOP. Which means we will readily ignore any OOP protocol and we will break an OOP rule that interferes with our primary goal to build an efficiently running and fun game project. Hopping off the soapbox, the constructor for firefly creates a random object which needs its a unique seed. We will use a random number generator in the main program to provide this seed.
5 Move( ) Method for firefly Class public void Move(int deltime) Time += deltime; Pos.X += Vel.X; if (Pos.X > MaxX) Pos.X = 0; if (Pos.X < 0) Pos.X = MaxX; The Move( ) method updates the position of the firefly and increments the AnimCount (frame # being displayed from the firefly spritesheet. Pos.Y += Vel.Y; if (Pos.Y > MaxY) Pos.Y = 0; if (Pos.Y < 0) Pos.Y = MaxY; if (rand.next(1000) > 990) Vel.X += rand.next(3) - 1; if (rand.next(1000) > 990) Vel.Y += rand.next(3) - 1; if (Vel.X > 5) Vel.X = 5; if (Vel.X <-5) Vel.X = -5; if (Vel.Y > 5) Vel.Y = 5; if (Vel.Y <-5) Vel.Y = -5; if (Time >= AnimTimer) AnimCount = (AnimCount + 1) % TotCount; Time = 0; Rect.X = AnimCount * Rect.Width; Position (Pos) is updated using the velocity (Vel) and velocity is randomly updated with a 10/1000 probability. Magnitude of velocity is limited to 5 units. AnimCount is updated each time accumulated Time exceeds the randomly set number of milliseconds per frame, AnimTimer. flies.png Thelocationof Rectis the region of the spritesheet being displayed for the current frame of the animation.
6 blast Class public Vector2 Pos; public Vector2 Vel; public Rectangle Rect = new Rectangle(); public int AnimCount; public bool Done; public int AnimTimer; int TotCount; public int Width; public int Height; public int Time; int rownum; int colnum; When two fireflies collide they are tagged for removal and an explosion (an instance the the blast class) is created. The blast will exist for 16 display frames as the 16 frames of the explosion sequence is used to animate the blast. At the end of the animation, the completed instance of blast is tagged for removal. public blast(vector2 pos, Vector2 vel1, Vector2 vel2, int totcount, int width, int height, int animtimer) Pos = pos; Vel.X = (vel1.x + vel2.x) / 2; Vel.Y = (vel1.y + vel2.y) / 2; AnimCount = 0; Rect.X = 0; Rect.Y = 0; Rect.Width = width; Rect.Height = height; Width = width; Height = height; TotCount = totcount; AnimTimer = animtimer; rownum = 0; colnum = 0; Done = false; An interesting feature of a blast is that its velocity is set to the average of the velocities of the two colliding fireflies. This gives a more realistic appearance than a static explosion sequence. In this demo we set the rate of animation to 60 milliseconds per frame(animtimer = 60).
7 Move( ) Method for blastclass The individual sprites blits are 64x64 pixels. The rownum and colnum are in the range 0 through and specify the sprite frame 0 through 15. When all frames have been displayedthebooleanfielddoneissettotrue. 256 x 256 pixels public void Move(int deltime) Time += deltime; Pos.X += Vel.X; Pos.Y += Vel.Y; if (Time >= AnimTimer) AnimCount += 1; Time = 0; colnum = AnimCount % 4; rownum = AnimCount / 4; Rect.X = colnum * Width; Rect.Y = rownum * Height; if (AnimCount >= TotCount) Done = true; explosion.bmp
8 Main Program Atomic Fireflies Collision Detection Demo GraphicsDeviceManager graphics; List<firefly> flies = new List<firefly>(); List<blast> blasts = new List<blast>(); SpriteBatch spritebatch; SoundEffect[] explosion = new SoundEffect[4]; Vector2 spos; Vector2 bpos; Texture2D bkg; Texture2D flysprite; Texture2D expsprite; Rectangle rect = new Rectangle(); KeyboardState kbstate; SpriteFont font; Vector2 txtpos = new Vector2(10, 10); Random rnd = new Random(); int mindist = 10; protected override void Initialize() base.initialize(); spos.x = 26; spos.y = 25; bpos.x = 32; bpos.y = 32; graphics.isfullscreen = true; graphics.applychanges(); Generic lists are created for firefly and blast objects. Four different explosion sounds will be called randomly for each collision. The evening sky background, the firefly sprite sheet and the explosion sprite sheet are loaded as Texture2D data types. An instance of the Random number generator rnd is created to be used to generated unique seeds for the generation of Random generators in the firefly class. This application runs in fullscreen mode comment out the call to graphics.applychanges( ) to convert this application to Windows UI mode.
9 Atomic Fireflies LoadContent( ) Method protected override void LoadContent() spritebatch = new SpriteBatch(GraphicsDevice); explosion[0] = Content.Load<SoundEffect>("explosion-01"); explosion[1] = Content.Load<SoundEffect>("explosion-02"); explosion[2] = Content.Load<SoundEffect>("explosion-03"); explosion[3] = Content.Load<SoundEffect>("explosion-04"); bkg = Content.Load<Texture2D>("bkg"); flysprite = Content.Load<Texture2D>("flies"); expsprite = Content.Load<Texture2D>("explosion"); graphics.preferredbackbufferwidth = bkg.width; graphics.preferredbackbufferheight = bkg.height; font = Content.Load<SpriteFont>("SpriteFont1"); rect.x = 0; rect.y = 0; rect.width = bkg.width; rect.height = bkg.height; graphics.applychanges(); for (int i = 0; i < 10; i++) flies.add(new firefly(bkg.width, bkg.height, 4, 208, 50, rnd.next(60)+20, rnd.next(100000))); To start the demo 10 fireflies are instantiated and added to the flies list. Note the use of rnd.next(100000) to generate a different seed for each instance of firefly. Also the AnimTimerissettoarandom rangeofvaluesbetween 20and79milliseconds.
10 Collision Detection Method This method demonstrates the versatility of the generic list. Although we do not have to managed the placement of items in a generic list when new items are added and/or old itemsareremoved,wecancontroltheorderofaccessof individualelementsinagenericlist by index value. public void collision() for(int i=0;i<flies.count-1;i++) for (int j = i + 1; j < flies.count; j++) if ((Math.Abs(flies[i].Pos.X - flies[j].pos.x) + Math.Abs(flies[i].Pos.Y - flies[j].pos.y)) < mindist) blasts.add(new blast(flies[i].pos,flies[i].vel,flies[j].vel,16,64,64,60)); flies[i].hit = true; flies[j].hit = true; explosion[rnd.next(4)].play(); The nested for loops compare the locations of every pair of fireflies in the list. When two files are found at or near (within 10 pixels) the same location they are tagged for removal fromthelist,anewblastobjectisaddedtotheblastslistandanexplosionsoundisplayed. Whenthenumberofitemstobecomparedbecomesvery largewewillneedtopartitionthe listofitemsinto binsandcompareonlythoseitemsinthesameorneighboringbins. For2D games, a two-dimensional array will be used to partition the objects by their index values.
11 protected override void Update(GameTime gametime) if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.exit(); kbstate = Keyboard.GetState(); if (kbstate.iskeydown(keys.left) && kbstate.iskeydown(keys.right)) this.exit(); if (kbstate.iskeydown(keys.right)) flies.add(new firefly(bkg.width, bkg.height, 4, 208, 50, rnd.next(20) + 40, rnd.next(100000))); if (kbstate.iskeydown(keys.left) && flies.count > 0) flies[flies.count-1].hit = true; collision(); foreach (firefly fly in flies) fly.move(gametime.elapsedgametime.milliseconds); foreach (blast pow in blasts) pow.move(gametime.elapsedgametime.milliseconds); flies.removeall(delegate(firefly fly) return fly.hit; ); Atomic Fireflies Update( ) Method Fireflies can be removed or added to the flies list by pressing the Left-Arrow and Right-Arrow keys. The Move( ) methods for each firefly and each blast are called to update the position and animation frame for each object. blasts.removeall(delegate(blast pow) return pow.done; ); base.update(gametime); At the end of Update( ) flies that have been involved in a collision and blasts that have completed their animation sequence are removed from their respective lists using delegate functions as shown.
12 Atomic Fireflies Draw( ) Method protected override void Draw(GameTime gametime) GraphicsDevice.Clear(Color.White); spritebatch.begin(); spritebatch.draw(bkg, rect, Color.White); foreach (firefly fly in flies) spritebatch.draw(flysprite, fly.pos, fly.rect, Color.White, 0, spos, (float)0.5, 0, 0); foreach (blast pow in blasts) spritebatch.draw(expsprite, pow.pos, pow.rect, Color.White, 0, bpos,1, 0, 0); spritebatch.drawstring(font, Convert.ToString(flies.Count), txtpos, Color.White); spritebatch.end(); base.draw(gametime); For each frame the Draw( ) method draws the background images followed by the fireflies and finally the active blasts being displayed. The fireflies.zip file contains the complete project
Unit 5 Test Review Name: Hour: Date: 1) Describe two ways we have used paint to help us as we studied images in monogame.
Unit 5 Test Review Name: Hour: Date: Answer the following questions in complete sentences. 1) Describe two ways we have used paint to help us as we studied images in monogame. a) b) 2) Where do you DECLARE
More informationXNA Game Studio 4.0.
Getting Started XNA Game Studio 4.0 To download XNA Game Studio 4.0 itself, go to http://www.microsoft.com/download/en/details.aspx?id=23714 XNA Game Studio 4.0 needs the Microsoft Visual Studio 2010 development
More informationXNA Workshop at CS&IT Symposium 7/11/11
XNA Workshop at CS&IT Symposium 7/11/11 Time 9:00 to 9:20 9:20 to 9:40 9:40 to 10:10 Mood Light 10:15 to 10:45 Manual Mood Light 10:50 to 11:20 Placing and Moving Image 11:25 to 11:45 Windows Phone Touch
More informationXNA (2D) Tutorial. Pong IAT410
XNA (2D) Tutorial Pong IAT410 Creating a new project 1. From the Start Menu, click All Programs, then the Microsoft XNA Game Studio Express folder, and finally XNA Game Studio Express. 2. When the Start
More informationVisual C# 2010 Express
Review of C# and XNA What is C#? C# is an object-oriented programming language developed by Microsoft. It is developed within.net environment and designed for Common Language Infrastructure. Visual C#
More informationCreating a Role Playing Game with XNA Game Studio 3.0 Part 4 Adding the Action Screen and Tile Engine
Creating a Role Playing Game with XNA Game Studio 3.0 Part 4 Adding the Action Screen and Tile Engine To follow along with this tutorial you will have to have read the previous tutorials to understand
More informationSession 5.1. Writing Text
1 Session 5.1 Writing Text Chapter 5.1: Writing Text 2 Session Overview Show how fonts are managed in computers Discover the difference between bitmap fonts and vector fonts Find out how to create font
More informationSlides adapted from 4week course at Cornell by Tom Roeder
Slides adapted from 4week course at Cornell by Tom Roeder Interactive Game loop Interactive Game Loop Core Mechanics Physics, AI, etc. Update() Input GamePad, mouse, keybard, other Update() Render changes
More informationSlides built from Carter Chapter 10
Slides built from Carter Chapter 10 Animating Sprites (textures) Images from wikipedia.org Animating Sprites (textures) Images from wikipedia.org Lets Add to Our XELibrary Going to add a CelAnimationManager
More informationIWKS 3400 Lab 3 1 JK Bennett
IWKS 3400 Lab 3 1 JK Bennett This lab consists of four parts, each of which demonstrates an aspect of 2D game development. Each part adds functionality. You will first just put a sprite on the screen;
More informationGAME:IT Advanced. C# XNA Bouncing Ball First Game Part 1
GAME:IT Advanced C# XNA Bouncing Ball First Game Part 1 Objectives By the end of this lesson, you will have learned about and will be able to apply the following XNA Game Studio 4.0 concepts. Intro XNA
More informationHow to Program a Primitive Twin-Stick Shooter in Monogame 3.4
How to Program a Primitive Twin-Stick Shooter in Monogame 3.4 This is a tutorial for making a basic twin-stick style shooter in C# using Monogame 3.4 and Microsoft Visual Studio. This guide will demonstrate
More informationA Summoner's Tale MonoGame Tutorial Series. Chapter 9. Conversations Continued
A Summoner's Tale MonoGame Tutorial Series Chapter 9 Conversations Continued This tutorial series is about creating a Pokemon style game with the MonoGame Framework called A Summoner's Tale. The tutorials
More informationCompile and run the code. You should see an empty window, cleared to a dark purple color.
IWKS 3400 LAB 10 1 JK Bennett This lab will introduce most of the techniques required to construct flight simulator style game. Our primary goal is to demonstrate various techniques in the MonoGame environment,
More informationComputer Games 2011 Selected Game Engines
Computer Games 2011 Selected Game Engines Dr. Mathias Lux Klagenfurt University This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 libgdx features High-performance,
More informationXNA 4.0 RPG Tutorials. Part 3. Even More Core Game Components
XNA 4.0 RPG Tutorials Part 3 Even More Core Game Components I'm writing these tutorials for the new XNA 4.0 framework. The tutorials will make more sense if they are read in order. You can find the list
More informationXNA 4.0 RPG Tutorials. Part 2. More Core Game Components
XNA 4.0 RPG Tutorials Part 2 More Core Game Components I'm writing these tutorials for the new XNA 4.0 framework. The tutorials will make more sense if they are read in order. You can find the list of
More informationA Summoner's Tale MonoGame Tutorial Series. Chapter 11. Battling Avatars
A Summoner's Tale MonoGame Tutorial Series Chapter 11 Battling Avatars This tutorial series is about creating a Pokemon style game with the MonoGame Framework called A Summoner's Tale. The tutorials will
More informationA Summoner's Tale MonoGame Tutorial Series. Chapter 13. Leveling Up
A Summoner's Tale MonoGame Tutorial Series Chapter 13 Leveling Up This tutorial series is about creating a Pokemon style game with the MonoGame Framework called A Summoner's Tale. The tutorials will make
More informationEyes of the Dragon - XNA Part 33 Non-Player Character Conversations
Eyes of the Dragon - XNA Part 33 Non-Player Character Conversations I'm writing these tutorials for the XNA 4.0 framework. Even though Microsoft has ended support for XNA it still runs on all supported
More informationNext, we re going to specify some extra stuff related to our window such as its size and title. Add this code to the Initialize method:
IWKS 3400 LAB 7 1 JK Bennett This lab will introduce you to how to create terrain. We will first review some basic principles of 3D graphics, and will gradually add complexity until we have a reasonably
More informationXNA 4.0 RPG Tutorials. Part 5. The Tile Engine - Part 2
XNA 4.0 RPG Tutorials Part 5 The Tile Engine - Part 2 I'm writing these tutorials for the new XNA 4.0 framework. The tutorials will make more sense if they are read in order. You can find the list of tutorials
More informationCreating a Role Playing Game with XNA Game Studio 3.0 Part 7 Adding Sprites
Creating a Role Playing Game with XNA Game Studio 3.0 Part 7 Adding Sprites To follow along with this tutorial you will have to have read the previous tutorials to understand much of what it going on.
More informationA camera with a projection and view matrix
A camera with a projection and view matrix Drikus Kleefsman January 25, 2010 Keywords: Xna, world, projection, view, matrix Abstract The first thing you want to have in a 3d scene is a camera to look at
More informationA Summoner's Tale MonoGame Tutorial Series. Chapter 3. Tile Engine and Game Play State
A Summoner's Tale MonoGame Tutorial Series Chapter 3 Tile Engine and Game Play State This tutorial series is about creating a Pokemon style game with the MonoGame Framework called A Summoner's Tale. The
More informationComputer Games 2012 Game Development
Computer Games 2012 Game Development Dr. Mathias Lux Klagenfurt University This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 libgdx features High-performance, cross-platform
More informationA Summoner's Tale MonoGame Tutorial Series. Chapter 12. Battling Avatars Continued
A Summoner's Tale MonoGame Tutorial Series Chapter 12 Battling Avatars Continued This tutorial series is about creating a Pokemon style game with the MonoGame Framework called A Summoner's Tale. The tutorials
More informationICS3C/4C/3U/4U Unit 2 Workbook Selection: If Statement
Selection: If Statement Selection allows a computer to do different things based on the situation. The if statement checks if something is true and then runs the appropriate code. We will start learning
More informationDeveloping Games with MonoGame*
Developing Games with MonoGame* By Bruno Sonnino Developers everywhere want to develop games. And why not? Games are among the best sellers in computer history, and the fortunes involved in the game business
More information2D Graphics in XNA Game Studio Express (Modeling a Class in UML)
2D Graphics in XNA Game Studio Express (Modeling a Class in UML) Game Design Experience Professor Jim Whitehead February 5, 2008 Creative Commons Attribution 3.0 creativecommons.org/licenses/by/3.0 Announcements
More informationSession 5.2. Creating Clocks
1 Session 5.2 Creating Clocks Chapter 5.2: Creating Clocks 2 Session Overview Find out how to obtain and use the current date and time in a C# program using the DateTime type Discover how to extract a
More informationChapter 12: Functions Returning Booleans and Collision Detection
Processing Notes Chapter 12: Functions Returning Booleans and Collision Detection So far we have not done much with booleans explicitly. Again, a boolean is a variable or expression that takes on exactly
More information2D Graphics in XNA Game Studio Express (Plus, Random numbers in C#)
2D Graphics in XNA Game Studio Express (Plus, Random numbers in C#) Game Design Experience Professor Jim Whitehead January 16, 2009 Creative Commons Attribution 3.0 creativecommons.org/licenses/by/3.0
More informationIWKS 3400 LAB 11 1 JK Bennett
IWKS 3400 LAB 11 1 JK Bennett This lab dives a little bit deeper into HLSL effects, particularly as they relate to lighting and shading. We will begin by reviewing some basic 3D principles, and then move
More informationXNA Development: Tutorial 6
XNA Development: Tutorial 6 By Matthew Christian (Matt@InsideGamer.org) Code and Other Tutorials Found at http://www.insidegamer.org/xnatutorials.aspx One of the most important portions of a video game
More informationXna0118-The XNA Framework and. the Game Class
OpenStax-CNX module: m49509 1 Xna0118-The XNA Framework and * the Game Class R.G. (Dick) Baldwin This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 4.0 Abstract
More informationCreating a Role Playing Game with XNA Game Studio 3.0 Part 11 Creating a Textbox Control
Creating a Role Playing Game with XNA Game Studio 3.0 Part 11 Creating a Textbox Control To follow along with this tutorial you will have to have read the previous tutorials to understand much of what
More informationthe gamedesigninitiative at cornell university Lecture 14 2D Sprite Graphics
Lecture 14 Drawing Images Graphics Lectures SpriteBatch interface Coordinates and Transforms Drawing Perspective Camera Projections Drawing Primitives Color and Textures Polygons 2 Drawing Images Graphics
More informationExplain the significance of using a computer programming language. Describe the basic template of the Monogame framework.
I can Explain the significance of using a computer programming language. Describe the basic template of the Monogame framework. A series of steps (actions) performed in a specific order Specifies The ACTIONS
More informationXNA 4.0 RPG Tutorials. Part 22. Reading Data
XNA 4.0 RPG Tutorials Part 22 Reading Data I'm writing these tutorials for the new XNA 4.0 framework. The tutorials will make more sense if they are read in order. You can find the list of tutorials on
More information3D Graphics with XNA Game Studio 4.0
3D Graphics with XNA Game Studio 4.0 Create attractive 3D graphics and visuals in your XNA games Sean James BIRMINGHAM - MUMBAI 3D Graphics with XNA Game Studio 4.0 Copyright 2010 Packt Publishing All
More informationDigiPen Institute of Technology
DigiPen Institute of Technology Presents Session Eight: Behavior DigiPen Institute of Technology 5001 150th Ave NE, Redmond, WA 98052 Phone: (425) 558-0299 www.digipen.edu 2005 DigiPen (USA) Corporation.
More informationXNA 4.0 RPG Tutorials. Part 25. Level Editor Continued
XNA 4.0 RPG Tutorials Part 25 Level Editor Continued I'm writing these tutorials for the new XNA 4.0 framework. The tutorials will make more sense if they are read in order. You can find the list of tutorials
More informationHands-On Lab. 2D Game Development with XNA Framework. Lab version: Last updated: 2/2/2011. Page 1
Hands-On Lab 2D Game Development with XNA Framework Lab version: 1.0.0 Last updated: 2/2/2011 Page 1 CONTENTS OVERVIEW... 3 EXERCISE 1: BASIC XNA FRAMEWORK GAME WITH GAME STATE MANAGEMENT... 4 General
More informationCMPS 20: Game Design Experience. January 14, 2010 Arnav Jhala
CMPS 20: Game Design Experience January 14, 2010 Arnav Jhala foreach ( type identifier in array-or-collection ) { } Foreach Statement Iterates through all elements in an array, or collection type Creates
More informationXNA 4.0 RPG Tutorials. Part 16. Quests and Conversations
XNA 4.0 RPG Tutorials Part 16 Quests and Conversations I'm writing these tutorials for the new XNA 4.0 framework. The tutorials will make more sense if they are read in order. You can find the list of
More informationCreating an Animated Image in SFML Creating Packed Images in SFML
Creating an Animated Image in SFML Creating Packed Images in SFML 1. Download the file names spritesheettools.zip and unzip this folder. It will be named spritesheettools 2. Inside this folder you will
More informationIn this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics.
Additional Controls, Scope, Random Numbers, and Graphics CS109 In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics. Combo
More informationPlease go to the Riemer s 2D XNA Tutorial for C# by clicking on You are allowed to progress ahead of me by
2D Shooter game- Part 2 Please go to the Riemer s 2D XNA Tutorial for C# by clicking on http://bit.ly/riemers2d You are allowed to progress ahead of me by reading and doing to tutorial yourself. I ll
More informationBloom effect - before. Bloom effect - after. Postprocessing. Motion blur in Valve s Portal - roll
Bloom effect - before Postprocessing Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology 2 Bloom effect - after Motion blur in Valve s Portal - roll 3 http://www.valvesoftware.com/publications/2008/
More informationcurl -sl sh
curl -sl http://goo.gl/f8j4l6 sh 2:1 3:1 4:1 type point = { x : int; y : int type rect = { rect_ll : point; rect_width : int; rect_height : int type circ = { circ_center : point; circ_radius : int type
More informationVariables One More (but not the last) Time with feeling
1 One More (but not the last) Time with feeling All variables have the following in common: a name a type ( int, float, ) a value an owner We can describe variables in terms of: who owns them ( Processing
More informationA Summoner's Tale MonoGame Tutorial Series. Chapter 15. Saving Game State
A Summoner's Tale MonoGame Tutorial Series Chapter 15 Saving Game State This tutorial series is about creating a Pokemon style game with the MonoGame Framework called A Summoner's Tale. The tutorials will
More informationFor efficiency, the graphics card will render objects as triangles Any polyhedron can be represented by triangles Other 3D shapes can be approximated
By Chris Ewin For efficiency, the graphics card will render objects as triangles Any polyhedron can be represented by triangles Other 3D shapes can be approximated by triangles Source: Wikipedia Don t
More informationStart Visual Studio, start a new Windows Form project under the C# language, name the project BalloonPop MooICT and click OK.
Start Visual Studio, start a new Windows Form project under the C# language, name the project BalloonPop MooICT and click OK. Before you start - download the game assets from above or on MOOICT.COM to
More informationCS 101 Randomness. Lecture 21
CS 101 Randomness Lecture 21 1 Randomness In most programming languages (Processing included) there are ways to generate random numbers 2 Randomness In most programming languages (Processing included)
More informationHands-On Lab. 3D Game Development with XNA Framework. Lab version: Last updated: 2/2/2011. Page 1
Hands-On Lab 3D Game Development with XNA Framework Lab version: 1.0.0 Last updated: 2/2/2011 Page 1 CONTENTS OVERVIEW... 3 EXERCISE 1: BASIC XNA GAME STUDIO GAME WITH GAME STATE MANAGEMENT... 5 Task 1
More informationIkra-Cpp: A C++/CUDA DSL for Object-oriented Programming with Structure-of-Arrays Layout
Ikra-Cpp: A C++/CUDA DSL for Object-oriented Programming with Structure-of-Arrays Layout Matthias Springer, Hidehiko Masuhara Tokyo Institute of Technology WPMVP 2018 Outline 1. Introduction 2. Ikra-Cpp
More informationLab 1 Sample Code. Giuseppe Maggiore
Lab 1 Sample Code Giuseppe Maggiore Preliminaries using Vertex = VertexPositionColor; First we define a shortcut for the type VertexPositionColor. This way we could change the type of Vertices used without
More informationChapter 6 Reacting to Player Input
Chapter 6 Reacting to Player Input 6.1 Introduction In this chapter, we will show you how your game program can react to mouse clicks and button presses. In order to do this, we need a instruction called
More informationmsdn Hands-On Lab 3D Game Development with XNA Framework Lab version: Last updated: 12/8/2010 Page 1
msdn Hands-On Lab 3D Game Development with XNA Framework Lab version: 1.0.0 Last updated: 12/8/2010 Page 1 CONTENTS OVERVIEW... 2 EXERCISE 1: BASIC XNA GAME STUDIO GAME WITH GAME STATE MANAGEMENT... 4
More informationComputing Science. Advanced Higher Programming. Project 1 - Balloon Burst. Version 1. Software Design and Development. (using Python and Pygame)
Computing Science Software Design and Development Advanced Higher 2015 Programming (using Python and Pygame) Project 1 - Balloon Burst Version 1 G. Reid, D. Stott, Contents Page 1 Page 3 Page 4 Page 5
More informationPixelSurface a dynamic world of pixels for Unity
PixelSurface a dynamic world of pixels for Unity Oct 19, 2015 Joe Strout joe@luminaryapps.com Overview PixelSurface is a small class library for Unity that lets you manipulate 2D graphics on the level
More informationIndex. Audio project AudioSupport class, 207 controls, 206 description, 206 GameState class, 209 goals, 206
Index A Audio project AudioSupport class, 207 controls, 206 description, 206, 209 goals, 206 B BlowFish class, 245 BounceObject() function, 143 BubbleShot class, 231 C Chasers ChaserGameObject class, 117
More informationMichael C. Neel. XNA 3D Primer. Wiley Publishing, Inc. Updates, source code, and Wrox technical support at
Michael C. Neel XNA 3D Primer Wiley Publishing, Inc. Updates, source code, and Wrox technical support at www.wrox.com Contents Who Is This Book For? 1 3D Overview 2 Basic 3D Math 4 Right-Hand Rule 4 Working
More informationGame Programming with. presented by Nathan Baur
Game Programming with presented by Nathan Baur What is libgdx? Free, open source cross-platform game library Supports Desktop, Android, HTML5, and experimental ios support available with MonoTouch license
More informationCOMP 102: Test August, 2017
Family Name:.......................... Other Names:.......................... Student ID:............................ Signature.............................. COMP 102: Test 1 14 August, 2017 Instructions
More informationStart Visual Studio, create a new project called Helicopter Game and press OK
C# Tutorial Create a helicopter flying and shooting game in visual studio In this tutorial we will create a fun little helicopter game in visual studio. You will be flying the helicopter which can shoot
More informationLoops. Variable Scope Remapping Nested Loops. Donald Judd. CS Loops 1. CS Loops 2
Loops Variable Scope Remapping Nested Loops CS105 05 Loops 1 Donald Judd CS105 05 Loops 2 judd while (expression) { statements CS105 05 Loops 3 Four Loop Questions 1. What do I want to repeat? - a rect
More informationXNA 4.0 RPG Tutorials. Part 24. Level Editor Continued
XNA 4.0 RPG Tutorials Part 24 Level Editor Continued I'm writing these tutorials for the new XNA 4.0 framework. The tutorials will make more sense if they are read in order. You can find the list of tutorials
More informationPong. Prof Alexiei Dingli
Pong Prof Alexiei Dingli Background Drag and Drop a background image Size 1024 x 576 X = 0, Y = 0 Rename it to BG Sorting objects Go to Sorting Layer Add a new Sorting Layer called Background Drag the
More informationBits and Bytes. How do computers compute?
Bits and Bytes How do computers compute? Representing Data All data can be represented with: 1s and 0s on/of true/false Numbers? Five volunteers... Binary Numbers Positional Notation Binary numbers use
More informationDarkBASIC Pro: Counters and Timers Copyright 2011 A. Stewart 1
DarkBASIC Pro: Counters and Timers Copyright 2011 A. Stewart 1 Counters and Timers Introduction Many games need to display either counters, or timers, or both. We need to count how many points you ve accumulated
More informationDO NGHIEM AN RAPID ROLLER: A GAME FOR WINDOWS PHONE
DO NGHIEM AN RAPID ROLLER: A GAME FOR WINDOWS PHONE Telecommunications and Technology 2012 2 VAASAN AMMATTIKORKEAKOULU UNIVERSITY OF APPLIED SCIENCES TELECOMMUNICATIONS AND TECHNOLOGY ABSTRACT Author Do
More informationWe are going to use some graphics and found a nice little batman running GIF, off course you can use any image you want for the project.
C# Tutorial - Create a Batman Gravity Run Game Start a new project in visual studio and call it gravityrun It should be a windows form application with C# Click OK Change the size of the to 800,300 and
More informationLab 3 Shadow Mapping. Giuseppe Maggiore
Lab 3 Shadow Giuseppe Maggiore Adding Shadows to the Scene First we need to declare a very useful helper object that will allow us to draw textures to the screen without creating a quad vertex buffer //
More informationProgramming Language. Functions. Eng. Anis Nazer First Semester
Programming Language Functions Eng. Anis Nazer First Semester 2016-2017 Definitions Function : a set of statements that are written once, and can be executed upon request Functions are separate entities
More informationGame1.cs class that derives (extends) Game public class Game1 : Microsoft.Xna.Framework.Game {..}
MonoGames MonoGames Basics 1 MonoGames descends from XNA 4, is a framework for developing C# games for Windows, Linux, Mac, Android systems. Visual Studio MonoGames projects will create: Program.cs class
More informationACS-1805 Introduction to Programming (with App Inventor)
ACS-1805 Introduction to Programming (with App Inventor) Chapter 8 Creating Animated Apps 10/25/2018 1 What We Will Learn The methods for creating apps with simple animations objects that move Including
More informationCISC 1600, Lab 2.3: Processing animation, objects, and arrays
CISC 1600, Lab 2.3: Processing animation, objects, and arrays Prof Michael Mandel 1 Getting set up For this lab, we will again be using Sketchpad. sketchpad.cc in your browser and log in. Go to http://cisc1600.
More informationA C++/CUDA DSL for Object-oriented Programming with Structure-of-Arrays Layout
A C++/CUDA DSL for Object-oriented Programming with Structure-of-Arrays Layout Matthias Springer Tokyo Institute of Technology CGO 2018, ACM Student Research Competition AOS vs. SOA AOS: Array of Structures
More informationCOMP 102: Test August, 2017
Family Name:.......................... Other Names:.......................... Student ID:............................ Signature.............................. COMP 102: Test 1 14 August, 2017 Instructions
More informationGame Programming with DXFramework. Jonathan Voigt University of Michigan Fall 2005
Game Programming with DXFramework Jonathan Voigt University of Michigan Fall 2005 1 DirectX from 30,000 Feet DirectX is a general hardware interface API Goal: Unified interface for different hardware Much
More informationFebruary 18, Nintendo. Bob Rost January 14, 2004
98-026 Nintendo Bob Rost January 14, 2004 Today Project Status Announcements Backgrounds PPU control registers Memory Mappers, Larger ROMs General Game Programming Tricks Project Status Have you started?
More information(* See *) open Graphics
03-27-planned.ml Thu Mar 27 12:50:26 2014 1 (* Lecture 15: Putting the "O" in OCaml *) (* If you re using the CS50 appliance with our standard OCaml installation, you can install the graphics library used
More informationMultimedia Development Example SVG/Javascript Asteroids Game
Multimedia Development Example SVG/Javascript Asteroids Game Try it here: http://www.it.nuigalway.ie/~sredfern/svg/asteroids.svg
More informationPrograms, Data, and Pretty Colors
C02625228.fm Page 19 Saturday, January 19, 2008 8:36 PM Chapter 2 Programs, Data, and Pretty Colors In this chapter: Introduction...........................................................19 Making a Game
More informationIteration in Programming
Iteration in Programming for loops Produced by: Mairead Meagher Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Topics list There are three types of loop in programming: While
More informationFinal Exam Winter 2013
Final Exam Winter 2013 1. Which modification to the following program makes it so that the display shows just a single circle at the location of the mouse. The circle should move to follow the mouse but
More informationPick a number. Conditionals. Boolean Logic Relational Expressions Logical Operators Numerical Representation Binary. CS Conditionals 1
Conditionals Boolean Logic Relational Expressions Logical Operators Numerical Representation Binary CS105 04 Conditionals 1 Pick a number CS105 04 Conditionals 2 Boolean Expressions An expression that
More informationChapter 3: The keys to control
Chapter 3: The keys to control By Mike Fleischauer xna@return42.com Hosted at http://www.learnxna.com/pages/xnabook.aspx In this chapter we are going to learn the basics of controlling our games. We cover
More informationUI Elements. If you are not working in 2D mode, you need to change the texture type to Sprite (2D and UI)
UI Elements 1 2D Sprites If you are not working in 2D mode, you need to change the texture type to Sprite (2D and UI) Change Sprite Mode based on how many images are contained in your texture If you are
More informationBlending Equation Blend Factors & Mode Transparency Creating an Alpha Channel Using DX Tex Tool Render Semi-Transparent Objects.
Overview Blending Blend Factors & Mode Transparency Creating an Alpha Channel Using DX Tex Tool Render Semi-Transparent Objects 305890 Spring 2014 5/27/2014 Kyoung Shin Park Blending Allows us to blend
More informationClick on the empty form and apply the following options to the properties Windows.
Start New Project In Visual Studio Choose C# Windows Form Application Name it SpaceInvaders and Click OK. Click on the empty form and apply the following options to the properties Windows. This is the
More informationCS 1110 Prelim 1 October 12th, 2017
CS 1110 Prelim 1 October 12th, 2017 This 90-minute exam has 6 uestions worth a total of 100 points. Scan the whole test before starting. Budget your time wisely. Use the back of the pages if you need more
More informationA Summoner's Tale MonoGame Tutorial Series. Chapter 8. Conversations
A Summoner's Tale MonoGame Tutorial Series Chapter 8 Conversations This tutorial series is about creating a Pokemon style game with the MonoGame Framework called A Summoner's Tale. The tutorials will make
More informationWindows Phone SDK 8.0 omogućuje kreiranje aplikacija za Windows Phone 8 and Windows Phone 7.5 uređaje. SDK 7.1
Igor Mirković SDK 8.0 Windows Phone SDK 8.0 omogućuje kreiranje aplikacija za Windows Phone 8 and Windows Phone 7.5 uređaje. SDK 7.1 Windows Phone SDK 7.1 i 7.1.1 omogućuju razvoj aplikacija za Windows
More informationA foundation for programming. Classes and objects. Overview. Java primitive types. Primitive types Creating your own data types
Classes and objects A foundation for programming any program you might want to write objects functions and modules build even bigger programs and reuse code http://www.flickr.com/photos/vermegrigio/5923415248/
More informationGame Board: Enabling Simple Games in TouchDevelop
Game Board: Enabling Simple Games in TouchDevelop Manuel Fähndrich Microsoft Research One Microsoft Way, Redmond WA 98052, USA maf@microsoft.com February 23, 2012 Abstract TouchDevelop is a novel application
More informationWe will start our journey into Processing with creating static images using commands available in Processing:
Processing Notes Chapter 1: Starting Out We will start our journey into Processing with creating static images using commands available in Processing: rect( ) line ( ) ellipse() triangle() NOTE: to find
More information