How to Program a Primitive Twin-Stick Shooter in Monogame 3.4

Size: px
Start display at page:

Download "How to Program a Primitive Twin-Stick Shooter in Monogame 3.4"

Transcription

1 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 a rudimentary system that can handle moving a player character, aiming and shooting projectiles, and rudimentary enemy behavior. It is assumed that the reader has moderate experience with both C# and some version of Microsoft Visual Studio, preferably MSVS2015. Materials: 1. A Windows PC, preferably Windows 7 or later 2. Physical mouse and keyboard compatible with PC 3. A stable internet connection 0. Setting Up the Project 1. Download and install the free version of Microsoft Visual Studio 2015 by clicking the Download Community Free button on this link. 2. Download and install Monogame 3.4 from this link by clicking Monogame 3.4 for Visual Studio. 3. Download the C3.XNA.Primitives2D zip file by following this link. Once it is downloaded, unzip the directory into your work space. 4. Open Visual Studio Open a new Monogame project by clicking File->New->Project under the navigation bar at the top. Once the new project pop-up appears, navigate to Templates->Visual C#->Monogame->Monogame Windows Project. 5. Name the project as you desire and select OK. Note: From now on, whenever you see [YOUR_NAME], replace it with whatever you named your project in Step Right click on the newly created solution in the Solution Explorer. Select Add->Existing Item. In the file selection pop-up that appears, navigate to your work space and select Primitives2D.cs from the folder we unzipped in Step Open the file [YOUR_NAME].cs by double clicking on it in the solution explorer. 8. At the top of the file, add the code using C3.XNA; using System; using System.Collections.Generic; to the existing include statements.

2 1. Initializing the Window Caution: Compile code regularly to ensure that everything is working properly. 1. Declare the following class-scope constants: const int screenwidth = 1280; const int screenheight = 768; const bool fullscreen = false; 2. Find the [YOUR_NAME]() constructor. Underneath the line graphics = new GraphicsDeviceManager(this);, insert the following lines of code: graphics.isfullscreen = fullscreen; graphics.preferredbackbufferwidth = screenwidth; graphics.preferredbackbufferheight = screenheight; 3. Find the Draw(GameTime gametime) method. Change the method call GraphicsDevice.Clear(Color.Black); Note: Every frame will begin with the window set to a solid rectangle of this color. You can choose a different color if you wish. At this time, if you compile and run the program you should see a window with a completely black background (or whichever color you chose in Step 3.)

3 2. Player and Cursor Movement 2.1 Movement Trails This section will allow us to display faded circles behind the player, bullets, and enemies as they move to add visual flair. 1. Declare a void method UpdateMovementTrail(ref Vector2[] trail, int trail_count). 2. Implement the above method. It should contain a for loop that iterates backwards from the index trail_count and set the i th element equal to the i-1 th element. Declare the class-scope constant const double MOVEMENT_UPDATE = 0.025;. 3. Declare a void method DrawMovementTrail(SpriteBatch spritebatch, Vector2[] trail, int trail_count, float radius, float sides, Color color). Note: The arguments are used as follows: 1. spritebatch is a native Monogame entity used for drawing. 2. trail is the list of positions at which we will draw a circle. 3. trail_count is the number of circles we will draw 4. radius is the radius in pixels of each circle 5. sides is the number of sides we will use to approximate a circle. 6. color is the color that we will make each circle, ignoring the alpha channel. 4. Implement a for loop in the drawing method that iterates backwards from trail_count-1 to 0. In each step it should check if both the X and Y coordinate of the point is greater than 0, as our convention is that empty positions in the array start out at (-1,-1). Inside the if statement, place the following method call: Primitives2D.DrawArc( spritebatch, trail[i], radius, sides, 0, MathHelper.TwoPi, new Color( (float)color.r / 255, (float)color.g / 255, (float)color.b / 255, (1 - ((float)i / trail_count)) / (float)(i+1)

4 ), radius); Note: This method calls a function defined in the Primitives2D file we included earlier in Section 0. As of version 3.4, Monogame does not support native primitve rendering in 2D, so we are utilizing 3 rd party code. Our code does not include a method for filling circles, so we get around this by drawing a circular arc with the thickness set to be the thickness of our radius. At each position in the movement trail, we draw a circle with slightly more opacity. This is what the fourth computation in the color constructor represents. 2.2 Player Movement 1. Declare the following class-scope constants: Color PLAYER_COLOR = new Color(40, 255, 27); Color CURSOR_COLOR = new Color(40, 128, 255); const int CURSOR_SIDES = 100; const int CURSOR_RADIUS = 10; const int MOVE_SPEED = 500; const float SHOOT_DELAY = 0.25f; const int PLAYER_RADIUS = 25; const int PLAYER_SIDES = 100; const int PLAYER_MOVEMENT_TRAIL = 25; Note: The Monogame Color datatype cannot be declared as constant. We use captialization conventions to communicate that this value should not be changed. 2. Declare the following class-scope variables: Vector2[] pos = new Vector2[PLAYER_MOVEMENT_TRAIL];

5 double lasttime = 0.0f; double lastshot = 0.0f; Vector2 cursorpos; 3. In the Initialize() method, set the first element of the pos array with the constructor call new Vector2(screenWidth / 2, screenheight / 2). Set the rest of the elements of the array using the constructor call new Vector2(-1, -1). 4. Declare the void method UpdatePlayer(GameTime gametime). 5. In the Update(GameTime gametime) method, add a call to the newly created UpdatePlayer method with gametime as the argument. 6. Place the following code in the UpdatePlayer(GameTime gametime) method: float deltatime = (float)gametime.elapsedgametime.totalseconds; KeyboardState keystate = Keyboard.GetState(); cursorpos = new Vector2(Mouse.GetState().Position.X, Mouse.GetState().Position.Y); if(gametime.totalgametime.totalseconds - lasttime > MOVEMENT_UPDATE) lasttime = gametime.totalgametime.totalseconds; UpdateMovementTrail(ref pos, PLAYER_MOVEMENT_TRAIL); Here we update the movement trail after a set interval. if(keystate.iskeydown(keys.a)) pos[0].x -= MOVE_SPEED * deltatime; if (keystate.iskeydown(keys.d)) These conditionals check to see if the movement key is down. If so, update the player's position accordingly. pos[0].x += MOVE_SPEED * deltatime; if (keystate.iskeydown(keys.s)) pos[0].y += MOVE_SPEED * deltatime;

6 if (keystate.iskeydown(keys.w)) pos[0].y -= MOVE_SPEED * deltatime; if(pos[0].x < PLAYER_RADIUS) pos[0].x = PLAYER_RADIUS; Monogame's coordinate system starts with (0,0) in the upper left corner. X increases to the right and Y towards the bottom. Thus if we want the player to move up, the Y coordinate needs to shrink. else if(pos[0].x > screenwidth - PLAYER_RADIUS) pos[0].x = screenwidth - PLAYER_RADIUS; if(pos[0].y < PLAYER_RADIUS) These conditionals make sure that the player cannot exit the screen. pos[0].y = PLAYER_RADIUS; else if(pos[0].y > screenheight - PLAYER_RADIUS) pos[0].y = screenheight - PLAYER_RADIUS; 7. Place the following code in the Draw(GameTime gametime) method after the call to the clear method: spritebatch.begin(spritesortmode.deferred, BlendState.Additive); Primitives2D.DrawArc(spriteBatch, cursorpos, CURSOR_RADIUS, CURSOR_SIDES, 0, MathHelper.TwoPi, CURSOR_COLOR); Primitives2D.DrawArc(spriteBatch, cursorpos, 0.5f * CURSOR_RADIUS, CURSOR_SIDES, 0, MathHelper.TwoPi, new Color(0.5f * (float)cursor_color.r / 255, 0.5f * (float)cursor_color.g / 255, 0.5f * (float)cursor_color.b / 255, CURSOR_COLOR.A)); DrawMovementTrail(spriteBatch, pos, PLAYER_MOVEMENT_TRAIL, PLAYER_RADIUS, PLAYER_SIDES, PLAYER_COLOR); All drawing calls in spritebatch.end(); Monogame need to be between calls to Begin and End

7 If you compile and run the program now, you should see a green circle and two blue circles on the screen. The blue circles should move with your mouse, and the green circle should move in response to the WASD keys. 3. Shooting 1. Declare the following class-scope constants: Color BULLET_COLOR = new Color(255, 40, 200); const float BULLET_SPEED = 1500; const int BULLET_MOVEMENT_TRAIL = 5; const int BULLET_RADIUS = 12; const int BULLET_SIDES = 20; 2. Declare a Bullet class. Give it the following fields and constructor: public Vector2[] positions = new Vector2[BULLET_MOVEMENT_TRAIL]; public Vector2 direction; public double lasttime = 0.0f; public bool remove = false; public Bullet(Vector2 pos, Vector2 dir) direction = dir; We will not draw elements of the movement trail outside of the bounds of the window, so setting the initial value outside ensures nothing is drawn until necessary. positions[0] = pos; for (int i = 1; i < BULLET_MOVEMENT_TRAIL; i++) positions[i] = new Vector2(-1, -1);

8 3. Declare the following class-scope variable: List<Bullet> bullets = new List<Bullet>(); Note: List<Type> is a C# template found in the System.Collections.Generic namespace. It behaves like a sophisticated linked list. 4. Declare the void method UpdateBullets(GameTime gametime). 5. Inside the new method, compute deltatime as done in the UpdatePlayer(GameTime gametime) method. 6. Create a foreach loop that iterates over the bullets list. Inside the for loop, use an if statement and the lasttime property of the Bullet class to update the object's movement trail as done in the UpdatePlayer(GameTime gametime) method. Add the following line of code outside the if statement but inside the foreach loop: bullet.positions[0] += BULLET_SPEED * deltatime * bullet.direction; This moves the bullet in the Stored direction at the constant Speed defined earlier. The deltatime Multiplier is used for frame rate Independent movement. 7. Add a call to the UpdateBullets(GameTime gametime) method beneath the call to UpdatePlayer(gameTime) in the Update(GameTime gametime) method. 8. Add the following code to the bottom of the UpdatePlayer(GameTime gametime) method: if (Mouse.GetState().LeftButton == ButtonState.Pressed) if (gametime.totalgametime.totalseconds - lastshot > SHOOT_DELAY) lastshot = gametime.totalgametime.totalseconds;

9 Vector2 dir = cursorpos - pos[0]; dir.normalize(); bullets.add(new Bullet(pos[0], dir)); 9. Finally, add the following lines of code to the Draw(GameTime gametime) beneath the code used to render the player and above the call to spritebatch.end(). foreach(bullet bullet in bullets) DrawMovementTrail(spriteBatch, bullet.positions, BULLET_MOVEMENT_TRAIL, BULLET_RADIUS, BULLET_SIDES, BULLET_COLOR); If you compile and run the program now, try shooting by clicking the left mouse button. A pink circle should move from the player (or green circle) and travel towards the cursor (blue circle.) 1. Declare the following class-scope constants: 4. Enemies and Collisions Color ENEMY_COLOR = new Color(128, 10, 0); const float ENEMY_SPEED = 250; const int ENEMY_MOVEMENT_TRAIL = 7; const int ENEMY_RADIUS = 20;

10 const int ENEMY_SIDES = 25; const double SPAWN_DELAY = 1.5; const double POINT_MULTIPLIER = 0.25; 2. Declare an Enemy class. It should be almost identical to the Bullet class, the only difference being that positions uses the ENEMY_MOVEMENT_TRAIL constant instead of BULLET_MOVEMENT_TRAIL and the direction field is computed instead of passed in in the constructor: direction = new Vector2(screenWidth / 2 - pos.x, screenheight / 2 - pos.y); direction.normalize(); 3. Create a list (using the above template) of Enemy objects. Declare a class-scope integer variable points, a class-scope double variable lastspawn and set both to Declare the float method PointMultiplier(), which should contain the single line return 1 + ((float)point_multiplier * points);. 5. Declare the void method Spawn() and implement it as follows: Random rand = new Random(); int border = (rand.next() % 4); float x = ENEMY_RADIUS; float y = ENEMY_RADIUS; Randomly pick a border to spawn along. if(border == 0 border == 2) if(border == 2) y = screenheight - ENEMY_RADIUS; Place the new enemy somewhere random along the length of the selected border. x = ENEMY_RADIUS + (rand.next() % (screenwidth - 2 * ENEMY_RADIUS)); else if(border == 3) x = screenwidth - ENEMY_RADIUS;

11 y = ENEMY_RADIUS + (rand.next() % (screenheight - 2 * ENEMY_RADIUS)); enemies.add(new Enemy(new Vector2(x, y))); 6. Declare the void method UpdateEnemies(GameTime gametime) and implement it as follows: float deltatime = (float)gametime.elapsedgametime.totalseconds; if(gametime.totalgametime.totalseconds - lastspawn > SPAWN_DELAY / PointMultiplier()) lastspawn = gametime.totalgametime.totalseconds; Spawn(); foreach(enemy enemy in enemies) The point multiplier is used to speed the game up as the player scores more points. if(gametime.totalgametime.totalseconds - enemy.lasttime > MOVEMENT_UPDATE) enemy.lasttime = gametime.totalgametime.totalseconds; UpdateMovementTrail(ref enemy.positions, ENEMY_MOVEMENT_TRAIL); enemy.positions[0] += PointMultiplier() * ENEMY_SPEED * deltatime * enemy.direction; 7. Add a call to the UpdateEnemies(GameTime gametime) method beneath the call to UpdateBullets(gameTime) in the Update(GameTime gametime) method. 8. Add the following code to the top of the Update(GameTime gametime) method: foreach (Enemy enemy in enemies) if ((enemy.positions[0] - pos[0]).lengthsquared() < (PLAYER_RADIUS * PLAYER_RADIUS) + (ENEMY_RADIUS * ENEMY_RADIUS) + 2 * PLAYER_RADIUS * ENEMY_RADIUS) Exit(); If the player intersects an enemy, it is game over. foreach(bullet bullet in bullets)

12 if ((enemy.positions[0] - bullet.positions[0]).lengthsquared() < (BULLET_RADIUS * BULLET_RADIUS) + (ENEMY_RADIUS * ENEMY_RADIUS) + 2 * BULLET_RADIUS * ENEMY_RADIUS) points += 1; bullet.remove = true; enemy.remove = true; for(int i = bullets.count - 1; i > -1; i--) if(bullets[i].remove) bullets.removeat(i); Remove all bullets and enemies that have collided. for(int i = enemies.count - 1; i > -1; i--) if(enemies[i].remove) enemies.removeat(i); 9. Add code to draw the enemies on-screen between the render code for the bullets and player. It should mirror the draw code for bullets using corresponding Enemy fields and constants. That's it! You should now compile and run, and you should see red circles coming from the outside edges of the screen, passing through the middle, and leaving the other side. Red circles that come into contact with the green one will end the game, and shooting them will make them spawn more often and move more quickly.

13 To recap, we installed and prepared a fresh Monogame project. We customized the window size and background color. We used the keyboard and mouse to manipulate on screen objects, making a player character that could move about the world. We added the ability to shoot while clicking the left mouse button. Finally, we added primitive enemies that fly from the edge of the screen towards the player. Think about extending this example. Try first changing the constants to make the game faster and slower paced. Think about making the enemies fly in a semi-random direction once they spawn instead of straight at the center. Can you think of a way to remove bullets and enemies that are offscreen but have not collided with anything?

Collision Detection Concept

Collision Detection Concept Collision Detection 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

More information

A Summoner's Tale MonoGame Tutorial Series. Chapter 13. Leveling Up

A 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 information

IWKS 3400 Lab 3 1 JK Bennett

IWKS 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 information

XNA 4.0 RPG Tutorials. Part 2. More Core Game Components

XNA 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 information

A Summoner's Tale MonoGame Tutorial Series. Chapter 9. Conversations Continued

A 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 information

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: 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 information

Slides adapted from 4week course at Cornell by Tom Roeder

Slides 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 information

[ the academy_of_code] Senior Beginners

[ the academy_of_code] Senior Beginners [ the academy_of_code] Senior Beginners 1 Drawing Circles First step open Processing Open Processing by clicking on the Processing icon (that s the white P on the blue background your teacher will tell

More information

XNA 4.0 RPG Tutorials. Part 3. Even More Core Game Components

XNA 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 information

XNA (2D) Tutorial. Pong IAT410

XNA (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 information

GAME:IT Advanced. C# XNA Bouncing Ball First Game Part 1

GAME: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 information

Start Visual Studio, create a new project called Helicopter Game and press OK

Start 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 information

XNA Game Studio 4.0.

XNA 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 information

Compile and run the code. You should see an empty window, cleared to a dark purple color.

Compile 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 information

XNA 4.0 RPG Tutorials. Part 5. The Tile Engine - Part 2

XNA 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 information

Creating 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 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 information

A Summoner's Tale MonoGame Tutorial Series. Chapter 15. Saving Game State

A 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 information

Eyes of the Dragon - XNA Part 33 Non-Player Character Conversations

Eyes 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 information

XNA Workshop at CS&IT Symposium 7/11/11

XNA 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 information

A Summoner's Tale MonoGame Tutorial Series. Chapter 12. Battling Avatars Continued

A 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 information

Visual C# 2010 Express

Visual 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 information

Start 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. 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 information

Form Properties Window

Form Properties Window C# Tutorial Create a Save The Eggs Item Drop Game in Visual Studio Start Visual Studio, Start a new project. Under the C# language, choose Windows Form Application. Name the project savetheeggs and click

More information

Click on the empty form and apply the following options to the properties Windows.

Click 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 information

A Summoner's Tale MonoGame Tutorial Series. Chapter 11. Battling Avatars

A 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 information

Slides built from Carter Chapter 10

Slides 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 information

This is the empty form we will be working with in this game. Look under the properties window and find the following and change them.

This is the empty form we will be working with in this game. Look under the properties window and find the following and change them. We are working on Visual Studio 2010 but this project can be remade in any other version of visual studio. Start a new project in Visual Studio, make this a C# Windows Form Application and name it zombieshooter.

More information

CSci 1113, Fall 2018 Lab Exercise 11 (Week 13): Graphics. Warm-up

CSci 1113, Fall 2018 Lab Exercise 11 (Week 13): Graphics. Warm-up CSci 1113, Fall 2018 Lab Exercise 11 (Week 13): Graphics It's time to put all of your C++ knowledge to use to implement a substantial program. In this lab exercise you will construct a graphical game that

More information

CS12020 for CGVG. Practical 2. Jim Finnis

CS12020 for CGVG. Practical 2. Jim Finnis CS12020 for CGVG Practical 2 Jim Finnis (jcf1@aber.ac.uk) This week Solution to last week and discussion Global variables and the model The Main Loop pattern States and the State Machine pattern Random

More information

Danmaku Mono Documentation

Danmaku Mono Documentation Danmaku Mono Documentation Release 0.01b UltimaOmega February 21, 2017 Miscellaneous Functions 1 Miscellaneous Functions 3 1.1 GetKeyState(keytocheck)........................................ 3 1.2 SetKeyState(key,

More information

Creating 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 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 information

Please go to the Riemer s 2D XNA Tutorial for C# by clicking on You are allowed to progress ahead of me by

Please 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 information

XNA 4.0 RPG Tutorials. Part 22. Reading Data

XNA 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 information

Tutorial 2: Particles convected with the flow along a curved pipe.

Tutorial 2: Particles convected with the flow along a curved pipe. Tutorial 2: Particles convected with the flow along a curved pipe. Part 1: Creating an elbow In part 1 of this tutorial, you will create a model of a 90 elbow featuring a long horizontal inlet and a short

More information

CS 2110 Fall Instructions. 1 Installing the code. Homework 4 Paint Program. 0.1 Grading, Partners, Academic Integrity, Help

CS 2110 Fall Instructions. 1 Installing the code. Homework 4 Paint Program. 0.1 Grading, Partners, Academic Integrity, Help CS 2110 Fall 2012 Homework 4 Paint Program Due: Wednesday, 12 November, 11:59PM In this assignment, you will write parts of a simple paint program. Some of the functionality you will implement is: 1. Freehand

More information

CS 134 Programming Exercise 9:

CS 134 Programming Exercise 9: CS 134 Programming Exercise 9: Nibbles Objective: To gain experience working with 2 dimensional arrays. The Problem Nibbles is a snake. Nibbles moves around a field, looking for food. Unfortunately, Nibbles

More information

2D Graphics in XNA Game Studio Express (Modeling a Class in UML)

2D 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 information

Programming Exercise

Programming Exercise Programming Exercise Nibbles Objective: To gain experience working with 2 dimensional arrays. The Problem Nibbles is a snake. Nibbles moves around a field, looking for food. Unfortunately, Nibbles is not

More information

Introduction to Game Programming

Introduction to Game Programming Introduction to Game Programming Console video game Session 2 The game loop and user input Nacho Iborra IES San Vicente This work is licensed under the Creative Commons Attribution- NonCommercial-ShareAlike

More information

Chapter 6 Reacting to Player Input

Chapter 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 information

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created.

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created. + Inheritance + Inheritance Classes that we design in Java can be used to model some concept in our program. For example: Pokemon a = new Pokemon(); Pokemon b = new Pokemon() Sometimes we need to create

More information

1 Getting started with Processing

1 Getting started with Processing cisc3665, fall 2011, lab I.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

More information

CS1950U Setup Spring 2018

CS1950U Setup Spring 2018 CS1950U Topics in 3D Game Engine Development Barbara Meier CS1950U Setup Spring 2018 Introduction Hi there! This guide is designed to help you get setup for taking CS1950U. It will go through the basics

More information

Programming Project 1

Programming Project 1 Programming Project 1 Handout 6 CSCI 134: Fall, 2016 Guidelines A programming project is a laboratory that you complete on your own, without the help of others. It is a form of take-home exam. You may

More information

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor. 3.Constructors and Destructors Develop cpp program to implement constructor and destructor. Constructors A constructor is a special member function whose task is to initialize the objects of its class.

More information

This Tutorial is for Word 2007 but 2003 instructions are included in [brackets] after of each step.

This Tutorial is for Word 2007 but 2003 instructions are included in [brackets] after of each step. This Tutorial is for Word 2007 but 2003 instructions are included in [brackets] after of each step. Table of Contents Just so you know: Things You Can t Do with Word... 1 Get Organized... 1 Create the

More information

Creating Breakout - Part 2

Creating Breakout - Part 2 Creating Breakout - Part 2 Adapted from Basic Projects: Game Maker by David Waller So the game works, it is a functioning game. It s not very challenging though, and it could use some more work to make

More information

The Mathcad Workspace 7

The Mathcad Workspace 7 For information on system requirements and how to install Mathcad on your computer, refer to Chapter 1, Welcome to Mathcad. When you start Mathcad, you ll see a window like that shown in Figure 2-1. By

More information

SEAMScript Language Reference Manual. Sean Inouye (si2281) Edmund Qiu (ejq2106) Akira Baruah (akb2158) Maclyn Brandwein (mgb2163)

SEAMScript Language Reference Manual. Sean Inouye (si2281) Edmund Qiu (ejq2106) Akira Baruah (akb2158) Maclyn Brandwein (mgb2163) SEAMScript Language Reference Manual Sean Inouye (si2281) Edmund Qiu (ejq2106) Akira Baruah (akb2158) Maclyn Brandwein (mgb2163) October 2015 Contents 1 Introduction...............................................

More information

Introduction. Create a New Project. Create the Main Form. Assignment 1 Lights Out! in C# GUI Programming 10 points

Introduction. Create a New Project. Create the Main Form. Assignment 1 Lights Out! in C# GUI Programming 10 points Assignment 1 Lights Out! in C# GUI Programming 10 points Introduction In this lab you will create a simple C# application with a menu, some buttons, and an About dialog box. You will learn how to create

More information

How to...create a Video VBOX Gauge in Inkscape. So you want to create your own gauge? How about a transparent background for those text elements?

How to...create a Video VBOX Gauge in Inkscape. So you want to create your own gauge? How about a transparent background for those text elements? BASIC GAUGE CREATION The Video VBox setup software is capable of using many different image formats for gauge backgrounds, static images, or logos, including Bitmaps, JPEGs, or PNG s. When the software

More information

Chapter 2 Surfer Tutorial

Chapter 2 Surfer Tutorial Chapter 2 Surfer Tutorial Overview This tutorial introduces you to some of Surfer s features and shows you the steps to take to produce maps. In addition, the tutorial will help previous Surfer users learn

More information

DOING MORE WITH WORD: MICROSOFT OFFICE 2010

DOING MORE WITH WORD: MICROSOFT OFFICE 2010 DOING MORE WITH WORD: MICROSOFT OFFICE 2010 GETTING STARTED PAGE 02 Prerequisites What You Will Learn USING MICROSOFT WORD PAGE 03 Viewing Toolbars Adding and Removing Buttons MORE TASKS IN MICROSOFT WORD

More information

Demo Scene Quick Start

Demo Scene Quick Start Demo Scene Quick Start 1. Import the Easy Input package into a new project. 2. Open the Sample scene. Assets\ootii\EasyInput\Demos\Scenes\Sample 3. Select the Input Source GameObject and press Reset Input

More information

CREATING AN AD HOC QUERY

CREATING AN AD HOC QUERY Ad Hoc Reporting AD HOC REPORTS are custom reports that you create on the fly so that you can view specific information that is important to you. An ad hoc report is created from a query, which means that

More information

Explain the significance of using a computer programming language. Describe the basic template of the Monogame framework.

Explain 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 information

Tutorials. Lesson 3 Work with Text

Tutorials. Lesson 3 Work with Text In this lesson you will learn how to: Add a border and shadow to the title. Add a block of freeform text. Customize freeform text. Tutorials Display dates with symbols. Annotate a symbol using symbol text.

More information

Practical 2: Ray Tracing

Practical 2: Ray Tracing 2017/2018, 4th quarter INFOGR: Graphics Practical 2: Ray Tracing Author: Jacco Bikker The assignment: The purpose of this assignment is to create a small Whitted-style ray tracer. The renderer should be

More information

Autodesk Fusion 360: Model. Overview. Modeling techniques in Fusion 360

Autodesk Fusion 360: Model. Overview. Modeling techniques in Fusion 360 Overview Modeling techniques in Fusion 360 Modeling in Fusion 360 is quite a different experience from how you would model in conventional history-based CAD software. Some users have expressed that it

More information

CS 201 Advanced Object-Oriented Programming Lab 4 - Asteroids, Part 2 Due: February 24/25, 11:30 PM

CS 201 Advanced Object-Oriented Programming Lab 4 - Asteroids, Part 2 Due: February 24/25, 11:30 PM CS 201 Advanced Object-Oriented Programming Lab 4 - Asteroids, Part 2 Due: February 24/25, 11:30 PM Introduction to the Assignment In this lab, you will complete the Asteroids program that you started

More information

CISC 1600, Lab 2.3: Processing animation, objects, and arrays

CISC 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 information

Pong in Unity a basic Intro

Pong in Unity a basic Intro This tutorial recreates the classic game Pong, for those unfamiliar with the game, shame on you what have you been doing, living under a rock?! Go google it. Go on. For those that now know the game, this

More information

Feature-based CAM software for mills, multi-tasking lathes and wire EDM. Getting Started

Feature-based CAM software for mills, multi-tasking lathes and wire EDM.  Getting Started Feature-based CAM software for mills, multi-tasking lathes and wire EDM www.featurecam.com Getting Started FeatureCAM 2015 R3 Getting Started FeatureCAM Copyright 1995-2015 Delcam Ltd. All rights reserved.

More information

Session 5.1. Writing Text

Session 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 information

Unit 21 - Creating a Navigation Bar in Macromedia Fireworks

Unit 21 - Creating a Navigation Bar in Macromedia Fireworks Unit 21 - Creating a Navigation Bar in Macromedia Fireworks Items needed to complete the Navigation Bar: Unit 21 - House Style Unit 21 - Graphics Sketch Diagrams Document ------------------------------------------------------------------------------------------------

More information

Introduction to Unreal Engine Blueprints for Beginners. By Chaven R Yenketswamy

Introduction to Unreal Engine Blueprints for Beginners. By Chaven R Yenketswamy Introduction to Unreal Engine Blueprints for Beginners By Chaven R Yenketswamy Introduction My first two tutorials covered creating and painting 3D objects for inclusion in your Unreal Project. In this

More information

PowerPoint Basics (Office 2000 PC Version)

PowerPoint Basics (Office 2000 PC Version) PowerPoint Basics (Office 2000 PC Version) Microsoft PowerPoint is software that allows you to create custom presentations incorporating text, color, graphics, and animation. PowerPoint (PP) is available

More information

Visual C# Program: Simple Game 3

Visual C# Program: Simple Game 3 C h a p t e r 6C Visual C# Program: Simple Game 3 In this chapter, you will learn how to use the following Visual C# Application functions to World Class standards: Opening Visual C# Editor Beginning a

More information

Add the backgrounds. Add the font.

Add the backgrounds. Add the font. To find all sprites, font, and backgrounds look in your resources folder under card game. Pick sprites for the following: The Mouse Desired Objects A disappearing animation for the desired objects Clutter

More information

3D Starfields for Unity

3D Starfields for Unity 3D Starfields for Unity Overview Getting started Quick-start prefab Examples Proper use Tweaking Starfield Scripts Random Starfield Object Starfield Infinite Starfield Effect Making your own Material Tweaks

More information

Next, 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:

Next, 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 information

Advanced Computer Programming

Advanced Computer Programming Programming in the Small I: Names and Things (Part II) 188230 Advanced Computer Programming Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Department of Computer Engineering Khon Kaen University

More information

Adobe Flash CS3 Reference Flash CS3 Application Window

Adobe Flash CS3 Reference Flash CS3 Application Window Adobe Flash CS3 Reference Flash CS3 Application Window When you load up Flash CS3 and choose to create a new Flash document, the application window should look something like the screenshot below. Layers

More information

Google Earth Tutorial 1: The Basics of Map-making in Google Earth 6.2

Google Earth Tutorial 1: The Basics of Map-making in Google Earth 6.2 Google Earth Tutorial 1: The Basics of Map-making in Google Earth 6.2 University of Waterloo Map Library, 2012 Part 1: Placemarks 1. Locating a Geographical Area a. Open up Google Earth. b. In the Search

More information

Tower Drawing. Learning how to combine shapes and lines

Tower Drawing. Learning how to combine shapes and lines Tower Drawing Learning how to combine shapes and lines 1) Go to Layout > Page Background. In the Options menu choose Solid and Ghost Green for a background color. This changes your workspace background

More information

Application of Skills: Microsoft PowerPoint 2013 Tutorial

Application of Skills: Microsoft PowerPoint 2013 Tutorial Application of Skills: Microsoft PowerPoint 2013 Tutorial Throughout this tutorial, you will progress through a series of steps to create a presentation about yourself. You will continue to add to this

More information

LECTURE 4. Announcements

LECTURE 4. Announcements LECTURE 4 Announcements Retries Email your grader email your grader email your grader email your grader email your grader email your grader email your grader email your grader email your grader email your

More information

A 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 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 information

Topic 7: Algebraic Data Types

Topic 7: Algebraic Data Types Topic 7: Algebraic Data Types 1 Recommended Exercises and Readings From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 5.5, 5.7, 5.8, 5.10, 5.11, 5.12, 5.14 14.4, 14.5, 14.6 14.9, 14.11,

More information

Lesson 1: Creating T- Spline Forms. In Samples section of your Data Panel, browse to: Fusion 101 Training > 03 Sculpt > 03_Sculpting_Introduction.

Lesson 1: Creating T- Spline Forms. In Samples section of your Data Panel, browse to: Fusion 101 Training > 03 Sculpt > 03_Sculpting_Introduction. 3.1: Sculpting Sculpting in Fusion 360 allows for the intuitive freeform creation of organic solid bodies and surfaces by leveraging the T- Splines technology. In the Sculpt Workspace, you can rapidly

More information

Google SketchUp/Unity Tutorial Basics

Google SketchUp/Unity Tutorial Basics Software used: Google SketchUp Unity Visual Studio Google SketchUp/Unity Tutorial Basics 1) In Google SketchUp, select and delete the man to create a blank scene. 2) Select the Lines tool and draw a square

More information

This is a set of tiles I made for a mobile game (a long time ago). You can download it here:

This is a set of tiles I made for a mobile game (a long time ago). You can download it here: Programming in C++ / FASTTRACK TUTORIALS Introduction PART 11: Tiles It is time to introduce you to a great concept for 2D graphics in C++, that you will find very useful and easy to use: tilemaps. Have

More information

SolidWorks 2½D Parts

SolidWorks 2½D Parts SolidWorks 2½D Parts IDeATe Laser Micro Part 1b Dave Touretzky and Susan Finger 1. Create a new part In this lab, you ll create a CAD model of the 2 ½ D key fob below to make on the laser cutter. Select

More information

CLASSES AND OBJECTS. Fundamentals of Computer Science I

CLASSES AND OBJECTS. Fundamentals of Computer Science I CLASSES AND OBJECTS Fundamentals of Computer Science I Outline Primitive types Creating your own data types Classes Objects Instance variables Instance methods Constructors Arrays of objects A Foundation

More information

SolidWorks Intro Part 1b

SolidWorks Intro Part 1b SolidWorks Intro Part 1b Dave Touretzky and Susan Finger 1. Create a new part We ll create a CAD model of the 2 ½ D key fob below to make on the laser cutter. Select File New Templates IPSpart If the SolidWorks

More information

Vectorworks Essential Tutorial Manual by Jonathan Pickup. Sample

Vectorworks Essential Tutorial Manual by Jonathan Pickup. Sample Vectorworks Essential Tutorial Manual by Jonathan Pickup Table of Contents 0.0 Introduction... iii 0.1 How to Use this Manual... iv 0.2 Real World Sizes... iv 0.3 New Ways of Drawing... v 1.0 Introduction

More information

Eyes of the Dragon - XNA Part 37 Map Editor Revisited

Eyes of the Dragon - XNA Part 37 Map Editor Revisited Eyes of the Dragon - XNA Part 37 Map Editor Revisited 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 operating systems

More information

In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics.

In 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 information

Osmond Tutorial. First Page / J C Chavez / / Osmond Tutorial

Osmond Tutorial. First Page / J C Chavez / / Osmond Tutorial Osmond Tutorial Draft Version corresponding to Osmond PCB Design Version 1.0b2 November 30, 2002 J C Chavez http://www.swcp.com/~jchavez/osmond.html jchavez@swcp.com First Page / J C Chavez / jchavez@swcp.com

More information

Assignment 3: Inheritance

Assignment 3: Inheritance Assignment 3: Inheritance Due Wednesday March 21 st, 2012 by 11:59 pm. Submit deliverables via CourSys: https://courses.cs.sfu.ca/ Late penalty is 10% per calendar day (each 0 to 24 hour period past due).

More information

Some (semi-)advanced tips for LibreOffice

Some (semi-)advanced tips for LibreOffice Some (semi-)advanced tips for LibreOffice by Andy Pepperdine Introduction We cover several tips on special things in Writer and Calc and anything else that turns up. Although I use LibreOffice, these should

More information

OneNote 2016 Tutorial

OneNote 2016 Tutorial VIRGINIA TECH OneNote 2016 Tutorial Getting Started Guide Instructional Technology Team, College of Engineering Last Updated: Spring 2016 Email tabletteam@vt.edu if you need additional assistance after

More information

We will start our journey into Processing with creating static images using commands available in Processing:

We 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

Burning Laser. In this tutorial we are going to use particle flow to create a laser beam that shoots off sparks and leaves a burn mark on a surface!

Burning Laser. In this tutorial we are going to use particle flow to create a laser beam that shoots off sparks and leaves a burn mark on a surface! Burning Laser In this tutorial we are going to use particle flow to create a laser beam that shoots off sparks and leaves a burn mark on a surface! In order to save time on things you should already know

More information

POWERPOINT 2003 OVERVIEW DISCLAIMER:

POWERPOINT 2003 OVERVIEW DISCLAIMER: DISCLAIMER: POWERPOINT 2003 This reference guide is meant for experienced Microsoft Office users. It provides a list of quick tips and shortcuts for familiar features. This guide does NOT replace training

More information

CS206: Evolutionary Robotics

CS206: Evolutionary Robotics CS206: Evolutionary Robotics Programming Assignment 8 of 10 Description: In this week s assignment you will add sensors to your robot. You will add one binary touch sensor in each of the four lower legs:

More information

SFU CMPT 361 Computer Graphics Fall 2017 Assignment 2. Assignment due Thursday, October 19, 11:59pm

SFU CMPT 361 Computer Graphics Fall 2017 Assignment 2. Assignment due Thursday, October 19, 11:59pm SFU CMPT 361 Computer Graphics Fall 2017 Assignment 2 Assignment due Thursday, October 19, 11:59pm For this assignment, you are to interpret a 3D graphics specification language, along with doing some

More information

JASCO CANVAS PROGRAM OPERATION MANUAL

JASCO CANVAS PROGRAM OPERATION MANUAL JASCO CANVAS PROGRAM OPERATION MANUAL P/N: 0302-1840A April 1999 Contents 1. What is JASCO Canvas?...1 1.1 Features...1 1.2 About this Manual...1 2. Installation...1 3. Operating Procedure - Tutorial...2

More information

disclabel help: what is disclabel?

disclabel help: what is disclabel? disclabel help: what is disclabel? disclabel helps you make great-looking labels for your CDs, DVDs, and related materials mightier than the pen. Features: Start with a pre-designed template, or make your

More information

Graphics: Legacy Library

Graphics: Legacy Library Graphics: Legacy Library Version 5.1 February 14, 2011 (require graphics/graphics) The viewport graphics library is a relatively simple toolbox of graphics commands. The library is not very powerful; it

More information