VIDEO GAME PROGRAMMING Video Game Programming Junior – Number Attack INSTRUCTOR TEACHER’S ASSISTANT.

Slides:



Advertisements
Similar presentations
Microsoft ® Word 2010 Training Create your first Word document II.
Advertisements

Create a Simple Game in Scratch
Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
Microsoft® Office Word 2007 Training
Space Man Sam: Grammar Mistakes By Aleis Murphy Duke University, Under the direction of Professor Susan Rodger July 2010.
Create a Simple Game in Scratch
FrontPage Express By John G. Summerville Ph.D.©, RN.
Presented by: Benefits Systems Support. Getting Started ê Open Powerpoint, create a blank presentation. ê Select a style for your first slide from the.
Lets Play Catch! Keeping Score in Alice By Francine Wolfe Duke University Professor Susan Rodger May 2010.
Interactive Boardmaker Basics By: Vanessa Wilkinson (nee Bushbacher) & Robyn Jung.
Word Processing First Steps
PowerPoint Practice Exercise
1 VCAM Technical Forum 2006VCAM\10_Oct\Technical Forum001 – 5/13/2015 1:55 AM Common PowerPoint Challenges Date: 04/31/2006.
Microsoft ® Office Word 2007 Training Bullets, Numbers, and Lists ICT Staff Development presents:
Microsoft ® Word 2010 Training Create your first Word document II.
Code Club Session 3 Shark Eats Fish. Picture of finished product here.
Mrs. Chapman. Tabs (Block Categories) Commands Available to use Script Area where you type your code Sprite Stage All sprites in this project.
ABC’s of PowerPoint (Office 2007) Part 1: Basic Vocabulary Part 2: Cursors Part 3: Insert Your Text Part 4: Insert Your Pictures Part 5: Basic Tools &
Calvin and Hobbes Teach Properties and Functions Created by Daniel MacDonald under the direction of Professor Susan Rodger Duke University June 2013.
Mr. Wortzman. Tabs (Block Categories) Available Blocks Script Area Sprite Stage All sprites in this project.
Google Earth How to create a Google Earth Tour and place it in your Wiki.
GAME:IT Junior Bouncing Ball Objectives: Create Sprites Create Sounds Create Objects Create Room Program simple game.
GameMaker.  A lot of Different Definitions  Easier to Say What is NOT a Game  Movie is Not a Game  No Active Participation  Final Outcome is Fixed.
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
Hello World In C++ and Microsoft Visual C++. Directions to begin a project 1. Go to All Programs 2. Open Visual Studio C++ 3. Click on New Project 4.
Making a Timer in Alice.
VIDEO GAME PROGRAMMING Video Game Programming Snowball Wars INSTRUCTOR TEACHER’S ASSISTANT.
PowerPoint Basics Tutorial 2: A Slide Show In this tutorial you’re going to create a presentation from scratch. You will have to keep this presentation.
Introduction to Scratch!
VIDEO GAME PROGRAMMING Video Game Programming Junior – DigiPutt INSTRUCTOR TEACHER’S ASSISTANT.
VIDEO GAME PROGRAMMING Video Game Programming Level One – Breakout INSTRUCTOR Big Dan Teague TEACHER’S ASSISTANT Delmar O'Donnell.
3–D Helium Molecule Tutorial Alice Project Duke University Professor Susan H. Rodger Gaetjens Lezin June 2008.
Photo Story 3 Importing Pictures. When you create a new Photo Story, the first thing that you will do is import pictures. You can import pictures from.
35 slides1 A note from me. Some else made this slide show on how to create a Power Point. It was very well done but is for Power Point Not 2007.
Animating Objects in Groups: Using Arrays and Lists By Ruthie Tucker under the direction of Professor Susan Rodger Summer 2008.
By Melissa Dalis Professor Susan Rodger Duke University June 2011 Multiplication Table.
Hi, Learning Skills Students! This is Slide 1 of your Power Point Instruction for this class. After reading each slide, make sure you: 1.Follow the instructions.
1. Press the New Layer Button 3. Double click names to re-name Ball & Shadow layers 2. Click to change to 12 fps Step 1.
Game Maker Terminology
Piñata Game: Keeping Score in Alice By Maggie Bashford Professor Susan Rodger Duke University July
1 ball, 2 ball, red ball, blue ball By Melissa Dalis Professor Susan Rodger Duke University June 2011.
PowerPoint Practice Exercise 1 1.Save this file in your AV-TECH Folder as PowerPoint Practice Exercise 1. 2.Open this file in PowerPoint. 3.Edit each slide.
Game Maker – Getting Started What is Game Maker?.
Shooters in GameMaker J Parker.
 To begin you first need to sign up to Weebly by going to or alternatively and we will create an account.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech June 2008.
Game Maker Galactic Mail Advanced Group: Complete Galactic Mail, then start developing an independent project.
Balancing the scales: Inequalities By Melissa Dalis Professor Susan Rodger Duke University June 2011.
PowerPoint Practice Exercise 1.Save this file on your computer. 2.Open this file in PowerPoint 3.Edit each slide according to the instructions provided.
Learning PowerPoint Presenting your ideas as a slide show… …on the computer!
Create a Halloween Computer Game in Scratch Stephanie Smullen and Dawn Ellis Barb Ericson October 2008.
Tutorial for Arrays and Lists. Description This presentation will cover the basics of using Arrays and Lists in an Alice world It uses a set of chickens.
Creating a 3D Interactive Story Prof. Susan Rodger Duke University July 19, 2007.
Lesson 2: Reading a program. Remember: from yesterday We learned about… Precise language is needed to program Actors and Classes Methods – step by step.
Hyperstudio: A Beginner’s Tutorial By Judy Swaim.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Scratch for Interactivity Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
How to Make a Power Point Go to Slide 2. (You can get there by clicking on slide 2 in Normal VIEW.)
PowerPoint Basics Tutorial 2: A Slide Show In this tutorial you’re going to create a presentation from scratch. You will have to keep this presentation.
You’ll Make a spreadsheet which will be like a Mad Libs Game. These Are The Directions.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Welcome to the Basic Microsoft Word Guide. Before you start this Guide, you will need to complete “Basic Computer”; “Basic Windows” and know how to type.
Create a Halloween Computer Game in Scratch
Scratch for Interactivity
Using the INSERT TAB in MS Word 2007
Scratch for Interactivity
Introduction to TouchDevelop
Creating a Simple Game in Scratch
Presentation transcript:

VIDEO GAME PROGRAMMING Video Game Programming Junior – Number Attack INSTRUCTOR TEACHER’S ASSISTANT

VIDEO GAME PROGRAMMING CONCEPT – Wrapping Maps A Wrapping Map is a map that loops when you reach the edges. Imagine a map drawn on a toilet paper roll. Wrapping maps are used a lot in space games and flying games (as stars, clouds or ground).

VIDEO GAME PROGRAMMING PART 1 – Wrapping Map Objective: –Create the basic map that will scroll underneath our plane. Step 1 – Create Map Art. Step 2 – Add Wrapping Map to Title Level. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Create Map Art Open MS Paint and create an 800x1200 map of some ground. Save as wrappingMap.bmp in your Maps folder.

VIDEO GAME PROGRAMMING STEP 2: Add Wrapping Map to Title Level Add a new Map to the Title level. Set the following in the General tab: 1.Map Name: wrappingMap 2.File Name: the map you created. 3.Wrap: Check this box.

VIDEO GAME PROGRAMMING STEP 2: Add Wrapping Map to Title Level continued… Under the Scrolling tab, set the Y Speed to 5.

VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. If all is well, you should see your map scrolling downward. If you want the map to scroll faster or slower, change the Y Speed to whatever you want.

VIDEO GAME PROGRAMMING PART 2 – Transparent Map Objective: –Create the Title Screen Logo. We’re going to make it transparent so we can see our scrolling map behind it. Step 1 – Create Map Art. Step 2 – Add Transparent Map to Title Level. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Create Map Art Open MS Paint and create an 800x600 picture with the words “Number Attack” drawn in however you like. Make sure the area that is supposed to be transparent is green. Save as title.bmp in your Maps folder.

VIDEO GAME PROGRAMMING STEP 2: Add Transparent Map to Title Level Add a new Map to the Title level. Set the following in the General tab: 1.Map Name: main 2.File Name: the map you created. 3.Use Transparency: Check this box.

VIDEO GAME PROGRAMMING STEP 2: Add Transparent Map to Title Level continued… In the Position Tab, set the Z- Order to 1.

VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. If all is well, you should see your map scrolling downward with your Number Attack art on top of it.

VIDEO GAME PROGRAMMING PART 3 – Cursor Objective: –Create a cursor for the title screen that will allow us to interact with buttons later on. Step 1 – Tweak Cursor Art (Optional). Step 2 – Add Cursor Sprite to Title Level. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Tweak Cursor Art (Optional) If you would like to change the cursor art, simply open the CURSOR actor’s CURSOR animation set. Double-click on the single frame of animation to open MS Paint. When you’re done, go to File->Save (not Save-As)

VIDEO GAME PROGRAMMING STEP 2: Add Cursor Sprite to Title Level Add a new Sprite to the Title level. Set the following in the General tab: 1.Name: cursor 2.Map: main 3.Z-Order: 1

VIDEO GAME PROGRAMMING STEP 2: Add Cursor Sprite to Title Level continued… In the Animation Tab, use the CURSOR Actor. In the Behavior Tab, add the MouseCursorMoveFN function.

VIDEO GAME PROGRAMMING STEP 2: Add Cursor Sprite to Title Level continued… Check the following boxes or bubbles in the Collision tab: 1.Loose Collision 2.Activate Sprite Collision 3.Check With Sprites 4.Ghost Collision 5.Check Same Display List

VIDEO GAME PROGRAMMING CONCEPT – Loose Collision Loose Collision tells FUN to use the sprite’s Bounding Box instead of any collision data we’ve defined. The Bounding Box is automatically created and wraps the ENTIRE sprite in a collision box. When would we not want to use Loose Collision?

VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. You should be able to move the cursor around now.

VIDEO GAME PROGRAMMING PART 4 – Interface Buttons Objective: –Now that we have a cursor, let’s make some buttons that let us Start or Quit the game. Step 1 – Add Start Sprite to Title Level. Step 2 – Add Quit Sprite to Title Level. Step 3 – Reposition Sprites Using Level Preview. Step 4 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add Start Sprite to Title Level Add a new Sprite to the Title level. Set the following in the General tab: 1.Name: start 2.Map: main

VIDEO GAME PROGRAMMING STEP 1: Add Start Sprite to Title Level continued… In the Animation Tab, use the BUTTON_START Actor. In the Behavior Tab, add the ButtonStartFN function.

VIDEO GAME PROGRAMMING STEP 1: Add Start Sprite to Title Level continued… Check the following boxes or bubbles in the Collision tab: 1.Loose Collision 2.Activate Sprite Collision 3.Check With Sprites 4.Ghost Collision 5.Check Same Display List

VIDEO GAME PROGRAMMING STEP 1: Add Start Sprite to Title Level continued… You can change the art in the BUTTON_START Actor if you want to.

VIDEO GAME PROGRAMMING STEP 2: Add Quit Sprite to Title Level Insert a copy of the start sprite and name it quit. In the Animation Tab, use the BUTTON_QUIT Actor. In the Behavior Tab, remove the ButtonStartFN function and add the ButtonQuitFN function.

VIDEO GAME PROGRAMMING CONCEPT – If – Else Statements If Else statements are just like if statements, except if the conditional is false, then the computer executes the code under the else statement Open the ButtonQuitFN function. You’ll notice a part in the code that says something like:

VIDEO GAME PROGRAMMING CONCEPT – If – Else Statements continued… if(This->CollisionWithSprite("cursor")) { This->Animation(1); if(MouseTriggered(DIM_LEFT)) { myGame->EndGame(); } else { This->Animation(0); }

VIDEO GAME PROGRAMMING STEP 3: Reposition Sprites Using Level Preview Open the Level Preview for the Title level and place your start and quit sprites wherever you want them. Place them kind of far apart from eachother; if they’re too close you might click on both of them at the same time. This would be bad…

VIDEO GAME PROGRAMMING STEP 4: Build and Run Build and Run your game. Check out what the start and quit buttons do. If you can click on both of them at the same time, reposition them until you can’t. What happens when you click the start button? Why?

VIDEO GAME PROGRAMMING PART 5 – Set Up Level1 Objective: –Add the maps to the first level. Step 1 – Add Wrapping Map to Level1. Step 2 – Add Map to Level1. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add Wrapping Map to Level1 Add a new Map to level1. Set the following in the General tab: 1.Map Name: wrappingMap 2.File Name: use wrappingMap.bmp 3.Wrap: Check this box

VIDEO GAME PROGRAMMING STEP 1: Add Wrapping Map to Level1 continued… In the Scrolling tab, set the Y Scroll Speed to 5 (or whatever you set it to in the title level).

VIDEO GAME PROGRAMMING STEP 2: Add Map to Level1 Add a new Map to level1. Set the following properties: 1.Map Name: main 2.File Name: mainBG.bmp 3.Use Transparency: Check this. 4.Z-Order: Set to 1.

VIDEO GAME PROGRAMMING STEP 2: Add Map to Level1 continued… Now add Collision Data to the map. Just make a big square around the edge of the map. Make sure your normals are pointing toward the center of the map (inward).

VIDEO GAME PROGRAMMING CONCEPT – Transparent Maps In FUN, you cannot add sprites (text objects, etc) to wrapping maps. To add sprites to our level, we need to have a non-wrapping map on top of our wrapping map. We make it completely transparent so we can see our wrapping map below it.

VIDEO GAME PROGRAMMING STEP 3: Build and Run Now Build and Run your game. This time, when you hit the start button on the title screen it should be displaying something instead of a black screen when you enter level1.

VIDEO GAME PROGRAMMING PART 6 – Adding the Player Objective: –Add the player to the first level. Step 1 – Create Player Art. Step 2 – Add PLAYER Actor. Step 3 – Add Player Sprite to Level1. Step 4 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Create Player Art Open MS Paint and create 2 planes (both 60x60). Make the first one have a red theme and the second have a blue theme. Save them in your Actors folder as player1.bmp and player2.bmp.

VIDEO GAME PROGRAMMING STEP 2: Add PLAYER Actor Create a new Actor named PLAYER. Add a new Animation Set named ONE. Add player1.bmp to ONE and give it collision data. Add a new Animation Set named TWO. Add player2.bmp to TWO and give it collision data.

VIDEO GAME PROGRAMMING STEP 3: Add Player Sprite to Level1 Create a new Sprite in level1. Set the following properties: 1.Name: player1 2.Map: main 3.Actor: PLAYER 4.Initial Animation: ONE

VIDEO GAME PROGRAMMING STEP 3: Add Player Sprite to Level1 continued… 5.Behavior: Add KeyboardWASDMovementFN. 6.Position: Manually place using ‘…’ 7.Precise Collision: Check this 8.Activate Sprite Collision: and this 9.Check With Sprites: and this… 10.Check With Map: and this. 11.Speed: 5

VIDEO GAME PROGRAMMING STEP 4: Build and Run Now Build and Run your game. You should have a red ship flying around the screen. Make sure you can move it with WASD keys.

VIDEO GAME PROGRAMMING PART 7 – Projectiles Objective: –Add some projectiles to our game. Step 1 – Create Projectile Art. Step 2 – Add PLAYERSHOT Actor. Step 3 – Add PlayerShot Sprite to Level1. Step 4 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Create Projectile Art Open MS Paint and create 2 projectiles (both 16x16). Give the first one a red theme and the second one a blue theme. Save them as playerShot1.bmp and playerShot2.bmp in your Actors folder.

VIDEO GAME PROGRAMMING STEP 2: Add PLAYERSHOT Actor Create a new Actor named PLAYERSHOT. Add a new Animation Set named ONE. Add playerShot1.bmp to ONE and give it collision data. Add a new Animation Set named TWO. Add playerShot2.bmp to TWO and give it collision data.

VIDEO GAME PROGRAMMING STEP 3: Add PlayerShot Sprite to Level1 Add a new Sprite to level1. In the General Tab set the following: 1.Name: playerShot 2.Map: main 3.Unused: Check this 4.Local Data: ShotData

VIDEO GAME PROGRAMMING CONCEPT – Local Data Local Data is a set of data that belongs to a particular object. We can define one set of Local Data that is used by multiple objects. For instance, we can define a set of local data containing Health and then give it to our enemy sprites. That way, FUN can track each enemies individual Health as they get hit.

VIDEO GAME PROGRAMMING STEP 3: Add PlayerShot Sprite to Level1 continued… Set the following in the Animation Tab: 1.Actor: PLAYERSHOT 2.Initial Animation: ONE 3.Peg Registered: Check This

VIDEO GAME PROGRAMMING CONCEPT – Peg Registered Normally, when FUN draws sprites, it starts drawing the top-left pixel at the position of the sprite. This is a problem if we have multiple frames of animation each with different sizes. Peg Registration means that FUN will draw the Sprite using its center as the position of the sprite.

VIDEO GAME PROGRAMMING CONCEPT – Peg Registered continued…

VIDEO GAME PROGRAMMING STEP 3: Add PlayerShot Sprite to Level1 continued… Check the following in the Collision Tab: 1.Precise Collision 2.Activate Sprite Collision 3.Check With Sprites 4.Ghost Collision

VIDEO GAME PROGRAMMING STEP 3: Add PlayerShot Sprite to Level1 continued… Add the SpriteDeleteOutOfViewportFN and ShotDeleteOnSpriteCollisionFN functions. Set the Speed to 8.

VIDEO GAME PROGRAMMING CONCEPT – Delete Flag Open up the SpriteDeleteOutOfViewportFN function. if (This->InViewport() == FALSE) { // delete this sprite This->DeleteFlag(TRUE); }

VIDEO GAME PROGRAMMING CONCEPT – Delete Flag continued… When the sprite is no longer visible, we want to delete it. The problem is, if we delete it right then and there, it might cause problems in the game and crash it. Instead, we set a flag that tells FUN to delete that sprite at the end of the current game loop.

VIDEO GAME PROGRAMMING PART 7.1 – Player Shooting Objective: –Add proper behavior to allow the player to shoot. Step 1 – Add Behavior to Player Sprite. Step 2 – Change Player HotSpots. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add Behavior to Player Sprite Add the KeyboardShootFN to the player sprite.

VIDEO GAME PROGRAMMING STEP 2: Change Player HotSpots Open the PLAYER actor’s ONE animation set. Where it says Hot Spots, click the ‘…’ button next to Hot Spot 0.

VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. Now try shooting. If your bullet is coming out the wrong part of the ship, try changing Hot Spot 0 until it’s right.

VIDEO GAME PROGRAMMING PART 8 – Adding Numbers Objective: –Add numbers the player can shoot to receive bonuses. Step 1 – Add Number Sprite to Level1. Step 2 – Add Spawning Behavior to Level1. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add Number Sprite to Level1 Add a new Sprite to level1. Set the following properties: 1.Name: number 2.Map: main 3.Unused: Check this 4.Display List: 1

VIDEO GAME PROGRAMMING STEP 1: Add Number Sprite to Level1 continued… 5.Actor: NUMBER 6.Initial Animation: ZERO 7.Precise Collision: Check this 8.Activate Sprite Collision: and this 9.Check With Sprites: and this… 10.Ghost Collision: and this.

VIDEO GAME PROGRAMMING STEP 1: Add Number Sprite to Level1 continued… Under the Displacement Tab set: 1.Speed: 4 2.Vector Direction: Y = 1

VIDEO GAME PROGRAMMING STEP 1: Add Number Sprite to Level1 continued… Finally, add the SpriteDeleteBelowViewportFN function to the sprite. We use this function because our numbers will be falling and, once they reach the bottom of the screen, we can’t shoot them, so we delete them.

VIDEO GAME PROGRAMMING STEP 2: Add Spawning Behavior to Level1 Add the LevelNumberSpawnFN function to level1. Open this function, let’s have a look…

VIDEO GAME PROGRAMMING CONCEPT – Game Loops A Game Loop represents the action the game takes every single frame. Game Loops do things like: Check for Input AI Physics Play Sound Render

VIDEO GAME PROGRAMMING CONCEPT – Game Loops continued… Once a Game Loop executes everything it’s supposed to do, it starts over again from the beginning.

VIDEO GAME PROGRAMMING CONCEPT – While Loops While Loops are how we implement a Game Loop. A while loop repeatedly executes the code inside of it until the conditional becomes false, or rather, while the conditional is true.

VIDEO GAME PROGRAMMING CONCEPT – While Loops continued… While loops look something like this… while (somethingIsTrue) { doThisCode; }

VIDEO GAME PROGRAMMING STEP 3: Build and Run Now Build and Run your game. You should have some random numbers appearing around the top of the level and slowly falling toward the bottom.

VIDEO GAME PROGRAMMING PART 9 – Movement Patterns Objective: –Make the numbers follow a specific movement pattern. Step 1 – Add a New Movement Pattern. Step 2 – Add Movement Pattern to Number Sprite. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING CONCEPT – Movement Patterns A Movement Pattern is a defined course a sprite will follow if it can. Movement Patterns are useful tools when we’re developing AI for enemies.

VIDEO GAME PROGRAMMING STEP 1: Add a New Movement Pattern Under the Game Assets tree, right- click on Movement Patterns and select Add. Click the Free Track button and draw a movement pattern starting from somewhere near the top and working down. Name it NumberFallMP and Save.

VIDEO GAME PROGRAMMING STEP 2: Add Movement Pattern to Number Sprite Open the Properties for the number sprite and click the Movement Tab. Click the Movement Pattern box. Select the NumberFallMP pattern. Click the Initially Started and Loop boxes.

VIDEO GAME PROGRAMMING STEP 3: Build and Run Now Build and Run your game. Do the numbers follow the pattern you gave them? Go ahead and tweak the movement pattern until the enemies are doing what you want them to do.

VIDEO GAME PROGRAMMING PART 10 – Make Numbers Shootable Objective: –Make the numbers follow a specific movement pattern. Step 1 – Add Proper Behavior. Step 2 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add Proper Behavior Add the SpriteDeleteNumberOnCollisionF N function to the playerShot sprite.

VIDEO GAME PROGRAMMING STEP 2: Build and Run You got it! Build and Run your game. At this point you should have numbers spawning, moving around, and dying when you shoot them. If not, let us know.

VIDEO GAME PROGRAMMING PART 11 – Make Things Explode Objective: –My personal favorite, now we’re going to add some flashy visuals when something dies. Step 1 – Add a New Particle System. Step 2 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add a New Particle System Under level1, right-click on Particle Systems and select Add. Set the following properties: 1.Name: ExplodeRed 2.Unused: Check. 3.Number of Particles: Belongs to: main

VIDEO GAME PROGRAMMING STEP 1: Add a New Particle System continued… Now, open the text file Explode Particle System.txt located in your game’s root directory. Highlight all the code using then copy ( ) and paste ( ) it into the ExplodeRed particle system.

VIDEO GAME PROGRAMMING STEP 2: Build and Run Build and Run your game. Now try shooting some numbers. You can play around with the values inside the ExplodeRed particle system to see what each thing does.

VIDEO GAME PROGRAMMING PART 12 – Operators Objective: –Now we’re going to add the basic math operators. The player will shoot these, along with some numbers, for a special bonus. Step 1 – Add Oper Sprite. Step 2 – Add Behavior to playerShot Sprite. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add Oper Sprite Insert a copy of the number sprite and name it oper. We can’t name it operator because that’s a C++ Keyword (like ‘if’, ‘while’, etc) Change the Actor to OPERATOR.

VIDEO GAME PROGRAMMING STEP 2: Add Behavior to playerShot Sprite Add the SpriteDeleteOperatorOnCollision FN function the the playerShot sprite. Open up this function, time to learn MORE CODE!

VIDEO GAME PROGRAMMING CONCEPT – Sprite Pointers Sprite Pointers (or SpritePTR in FUN) are how we uniquely identify different sprites of the same type. We can use Sprite Pointers to access data specific to one sprite. In the SpriteDeleteOperatorOnCollisionFN function, we use SpritePTR to access an oper sprite’s Delete Flag when we shoot it.

VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. You should have numbers and operators falling from the sky now.

VIDEO GAME PROGRAMMING PART 13 – New Particle System Objective: –If you noticed in the SpriteDeleteOperatorOnCollisionFN function, it tried to use a ExplodeYellow Particle System. Let’s add that. Step 1 – Create a New Particle System. Step 2 – Change its Properties. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Create a New Particle System Insert a Copy of our ExplodeRed particle system and name it ExplodeYellow.

VIDEO GAME PROGRAMMING STEP 2: Change its Properties Open the ExplodeYellow particle system. Change: This-> Color(RGB(255,0,0),RGB(200,200,100)); To: This-> Color(RGB(255,255,0),RGB(200,200,100));

VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. Now try shooting some operators. Do they explode?

VIDEO GAME PROGRAMMING PART 14 – Math Expression Objective: –Add text to display which numbers and operators have been shot and what they must equal. Step 1 – Add the Symbol Sprite. Step 2 – Add the Equal Sprite. Step 3 – Add Text. Step 4 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add the Symbol Sprite Add a new Sprite to level1 and set: 1.Name: symbol 2.Display List: 1 3.Map: main 4.Actor: SYMBOL 5.Initial Animation: ADD 6.Position: x = 270, y = 500

VIDEO GAME PROGRAMMING STEP 1: Add the Symbol Sprite continued… Add the SymbolUpdateFN behavior to the symbol sprite. Open this function.

VIDEO GAME PROGRAMMING CONCEPT – Setting Animation In the SymbolUpdateFN you should see a piece of code that looks like this: This->Animation(Operator);

VIDEO GAME PROGRAMMING CONCEPT – Setting Animation continued… This piece of code is how you change a sprite’s current animation set. Build and Run your game real quick to see this in action. As you shoot operators, the symbol animation changes.

VIDEO GAME PROGRAMMING STEP 2: Add the Equal Sprite Insert a copy of the symbol sprite and name it equal. Set the following: 1.ACTOR: symbol 2.Initial Animation: NOTEQUAL 3.Position: x= 400, y= Behavior: Remove the SymbolUpdateFN function.

VIDEO GAME PROGRAMMING STEP 3: Add Text Add a new Text Object to level1. Set the following: 1.Name: LeftNumber 2.Type: Number 3.Font Size: 72 4.Font Color: Red 5.Initial Value: 0

VIDEO GAME PROGRAMMING STEP 3: Add Text continued… 6.Position: Left: 210 Top: 480 Right: 270 Bottom: 600

VIDEO GAME PROGRAMMING STEP 3: Add Text continued… Insert a copy of LeftNumber and name it RightNumber. Change the following properties: 1.Font Color: Blue 2.Position: Left: 340 Top: 480 Right: 400 Bottom: 600

VIDEO GAME PROGRAMMING STEP 3: Add Text continued… Insert a copy of RightNumber and name it AnswerNumber. Change the following properties: 1.Font Color: Yellow 2.Position: Left: 470 Top: 480 Right: 580 Bottom: 600

VIDEO GAME PROGRAMMING STEP 4: Build and Run Build and Run your game. You should now have some math text at the bottom of your screen. If not, let us know.

VIDEO GAME PROGRAMMING PART 15 – Secondary Fire Objective: –Add a secondary fire mode the player can use to select the second number. Step 1 – Add the playerShot2 Sprite. Step 2 – Add a New Particle System. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add the playerShot2 Sprite Insert a copy of the playerShot sprite and name it playerShot2. Use Insert After: playerShot… Change the Initial Animation to TWO.

VIDEO GAME PROGRAMMING STEP 2: Add a New Particle System Insert a copy of the ExplodeRed particle system and name it ExplodeBlue. Change: This->Color(RGB(255,0,0),RGB(200,200,100)); To: This->Color(RGB(0,0,255),RGB(200,200,100));

VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. You should be able to shoot your secondary weapon using the right key. Try shooting some numbers with your secondary shot.

VIDEO GAME PROGRAMMING PART 16 – Tie Everything Together Objective: –Now we’re going to make it so the math on the screen actually does something. Step 1 – Add Level Behavior. Step 2 – Adjust Text Objects. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add Level Behavior Add the LevelMathFN function to level1.

VIDEO GAME PROGRAMMING STEP 2: Adjust Text Objects Open the Properties for the RightNumber text object. Uncheck the Visible box. Do the same for the LeftNumber text object.

VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. Shoot a combination of numbers and operators using both your primary and secondary shot. Try to come up with the number that gives you the right answer.

VIDEO GAME PROGRAMMING PART 17 – Add Scoring Objective: –When the player shoots something or gets the right math answer, increase their score. Step 1 – Add Score Text. Step 2 – Add Score Number. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add Score Text Add a new Text Object to level1. Set the following properties: 1.Name: ScoreText 2.Type: Text 3.Color: Red 4.Initial Value: Score

VIDEO GAME PROGRAMMING STEP 1: Add Score Text continued… 5.Position: Left: 0 Top: 520 Right: 70 Bottom: 550

VIDEO GAME PROGRAMMING STEP 2: Add Score Number Add a new Text Object to level1. Set the following properties: 1.Name: ScoreNumber 2.Type: Number 3.Color: Red 4.Font Size: 26 5.Initial Value: 0

VIDEO GAME PROGRAMMING STEP 2: Add Score Number continued… 6.Position: Left: 0 Top: 550 Right: 200 Bottom: Behavior: TextScoreUpdateFN

VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. You should see your score go up every time you get the right answer.

VIDEO GAME PROGRAMMING PART 18 – Multiplayer Objective: –Now we’re going to add a 2 player mode. Step 1 – Add More and Less Sprites to Title level. Step 2 – Add Player Number and Text to Title Level. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add More and Less Sprites to Title Level In the title level, insert a copy of the quit sprite and name it more. Set these properties for more: 1.Actor: BUTTON_MORE 2.Initial Animation: NORMAL 3.Behavior: Remove ButtonQuitFN and ADD ButtonMorePlayersFN. 4.Position: x= 0, y= 0

VIDEO GAME PROGRAMMING STEP 1: Add More and Less Sprites to Title Level continued… Insert a copy of more and name it less. Change these properties for less: 1.Actor: BUTTON_LESS 2.Initial Animation: NORMAL 3.Behavior: Remove ButtonMorePlayersFN and ADD ButtonLessPlayersFN

VIDEO GAME PROGRAMMING STEP 2: Add Player Number and Text to Title Level Add a new text object to title. Set the following properties: 1.Name: PlayersText 2.Type: Text 3.Font Size: 20 4.Color: Anything 5.Initial Value: Players

VIDEO GAME PROGRAMMING STEP 2: Add Player Number and Text to Title Level continued… 6.Position: Left: 0 Top: 0 Right: 100 Bottom: 50

VIDEO GAME PROGRAMMING STEP 2: Add Player Number and Text to Title Level continued… Add a new text object to title. Set the following properties: 1.Name: PlayersNumber 2.Type: Number 3.Font Size: 20 4.Color: Anything 5.Initial Value: 1 6.Behavior: TextNumPlayersFN

VIDEO GAME PROGRAMMING STEP 2: Add Player Number and Text to Title Level continued… 7.Position: Left: 0 Top: 0 Right: 40 Bottom: 50 Now use the Level Preview to place the new sprites and text.

VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. You should be able to select 1 or 2 players at the title screen.

VIDEO GAME PROGRAMMING PART 19 – Add Player 2 Objective: –Now we’re going to add the second player. They can use the key to shoot. The second player will shoot the second number in our math equation. Step 1 – Add player2 Sprite to level1. Step 2 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add player2 Sprite to level1 In level1, insert a copy of the player1 sprite and name it player2. Set properties for player2 sprite: 1.Unused: Check this 2.Initial Animation: TWO 3.Position: Use to set manually

VIDEO GAME PROGRAMMING STEP 1: Add player2 Sprite to level1 continued… 4.Behavior: Remove KeyboardWASDMovementFN and KeyboardShootFN. ADD KeyboardArrowMovementFN and KeyboardShoot2FN.

VIDEO GAME PROGRAMMING STEP 2: Build and Run Build and Run your game. You should now be able to play a 2 player game! Player 2 uses the arrow keys to move and to shoot.

VIDEO GAME PROGRAMMING PART 20 – Enemies Part 1 Objective: –Add enemies with their own projectiles, movement patterns, and particle explosions. Step 1 – Create Enemy and Enemy Projectile Art. Step 2 – Add Enemy and Enemy Shot Actors. Step 3 – Add Enemy and Enemy Shot Sprites. Step 4 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Create Enemy and Enemy Projectile Art In MS Paint create 2 images: 1.enemy.bmp (60x60) 2.enemyShot.bmp (16x16) 3.Save them both in the Actors folder.

VIDEO GAME PROGRAMMING STEP 2: Add Enemy and EnemyShot Actors Create 2 new Actors: 1.ENEMY 1.New Animation Set: DEFAULT 2.Uses enemy.bmp 3.Give it collision data.

VIDEO GAME PROGRAMMING STEP 2: Add Enemy and EnemyShot Actors continued… 2.ENEMY 1.New Animation Set: DEFAULT 2.Uses enemyShot.bmp 3.Give it collision data.

VIDEO GAME PROGRAMMING STEP 3: Add Enemy and EnemyShot Sprites Add a new Sprite in level1 and set the following properties: 1.Name: enemy 2.Map: main 3.Unused: checked 4.Display List: 1 5.Local Data: ShotData

VIDEO GAME PROGRAMMING STEP 3: Add Enemy and EnemyShot Sprites continued… 6.Actor: ENEMY 7.Initial Animation: DEFAULT 8.Behavior: SpriteDeleteBelowViewportFN, EnemyShootFN, SpriteDecreasePlayerHealthFN 9.Collision: Precise, Activate, Check With Sprites, Ghost Collision

VIDEO GAME PROGRAMMING STEP 3: Add Enemy and EnemyShot Sprites continued… 10.Speed: 4 11.Vector Direction: Y = 1

VIDEO GAME PROGRAMMING STEP 3: Add Enemy and EnemyShot Sprites continued… Insert a copy of playerShot named enemyShot and set the following properties: 1.Display List: 1 2.Actor: ENEMYSHOT 3.Initial Animation: DEFAULT

VIDEO GAME PROGRAMMING STEP 3: Add Enemy and EnemyShot Sprites continued… 4.Behavior: REMOVE SpriteDeleteNumberOnCollision FN and SpriteDeleteOperatorOnCollisio nFN. ADD SpriteDecreasePlayerHealthFN.

VIDEO GAME PROGRAMMING STEP 4: Build and Run Build and Run your game. What happens? Why?

VIDEO GAME PROGRAMMING PART 20 – Enemies Part 2 Objective: –Now that we have actors and sprites, let’s add some behavior to make everything work. Step 1 – Add Spawn Behavior to level1. Step 2 – Add Behavior to Sprites. Step 3 – Add a New Particle System. Step 4 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add Spawn Behavior to level1 Add the LevelEnemySpawnFN function to level1.

VIDEO GAME PROGRAMMING STEP 2: Add Behavior to Sprites Add the SpriteDeleteEnemyOnCollisionF N function to the following sprites: 1.playerShot 2.playerShot2 3.player1 4.player2

VIDEO GAME PROGRAMMING STEP 3: Add a New Particle System Insert a copy of the ExplodeRed particle system and name it ExplodeEnemy. Go ahead and change the properties of this one to whatever you want.

VIDEO GAME PROGRAMMING STEP 4: Build and Run Build and Run your game. You should be able to shoot your enemies as they fall. You should also be able to run into them and destroy them.

VIDEO GAME PROGRAMMING PART 21 – Enemy Movement Objective: –Add a simple movement pattern to enemies. Step 1 – Create a new Movement Pattern. Step 2 – Add it to the enemy Sprite. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Create a new Movement Pattern Create a new Movement Pattern. Name it EnemyMP. Use the Free Track tool.

VIDEO GAME PROGRAMMING STEP 2: Add it to the enemy Sprite Open the properties for the enemy sprite. Check Movement Pattern and use EnemyMP. Check both the Initially Started and Loop boxes.

VIDEO GAME PROGRAMMING STEP 3: Build and Run Now Build and Run your game. The enemies should be following the new movement pattern. Change it around until you’re happy.

VIDEO GAME PROGRAMMING PART 22 – Health Objective: –Add player health to the game. Step 1 – Add Health Text. Step 2 – Add Health Numbers. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add Health Text Add a new Text Object to level1 and set the following properties: 1.Name: HealthText 2.Type: Text 3.Color: Yellow 4.Initial Value: Health

VIDEO GAME PROGRAMMING STEP 1: Add Health Text continued… 5.Position: Left: 700 Top: 520 Right: 800 Bottom: 600

VIDEO GAME PROGRAMMING STEP 2: Add Health Numbers Add a new Text Object to level1 and set the following properties: 1.Name: HealthNumber1 2.Type: Number 3.Font Size: 28 4.Color: Red 5.Initial Value: 3

VIDEO GAME PROGRAMMING STEP 2: Add Health Numbers continued… 5.Position: Left: 710 Top: 550 Right: 750 Bottom: Behavior: TextPlayer1HealthFN

VIDEO GAME PROGRAMMING STEP 2: Add Health Numbers continued… Insert a copy of HealthNumber1 and set the following properties: 1.Name: HealthNumber2 2.Color: Blue 3.Unused: check this

VIDEO GAME PROGRAMMING STEP 2: Add Health Numbers continued… 4.Position: Left: 750 Top: 550 Right: 800 Bottom: Behavior: REMOVE TextPlayer1HealthFN. ADD TextPlayer2HealthFN.

VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. You should be able to get hit by the enemies and have your health decreased (same goes for player2). Also, running into enemies should lower your health.

VIDEO GAME PROGRAMMING PART 23 – Victory Screen Objective: –Add a victory screen that prompts the player to play again. Step 1 – Make Ending Screen Art. Step 2 – Add Map to Victory Level. Step 3 – Copy Sprites to Victory Level. Step 4 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Make Ending Screen Art In MS Paint, create 2 images: 1.victory.bmp (800x600) 2.gameover.bmp (800x600) 3.Save them both in your Maps folder.

VIDEO GAME PROGRAMMING STEP 2: Add Map to Victory Level Add a new Map to the victory level. 1.Map Name: main 2.File Name: victory.bmp

VIDEO GAME PROGRAMMING STEP 3: Copy Sprites to Victory Level You can copy sprites from one level to another by holding and dragging a sprite from one level to another. Drag these sprites from title into victory: 1.Cursor 2.Start 3.Quit

VIDEO GAME PROGRAMMING STEP 3: Copy Sprites to Victory Level continued… Open the properties for the start sprite in the victory level. Change these properties: 1.Name: play 2.Actor: BUTTON_PLAY 3.Initial Animation: NORMAL 4.Behavior: REMOVE ButtonStartFN and ADD ButtonPlayAgainFN.

VIDEO GAME PROGRAMMING STEP 3: Copy Sprites to Victory Level continued… Go into the victory level preview and place the new sprites wherever you want them.

VIDEO GAME PROGRAMMING STEP 4: Build and Run Now Build and Run your game. Try and win if you can!

VIDEO GAME PROGRAMMING PART 24 – Game Over Screen Objective: –Add a game over screen that prompts the player to play again. Step 1 – Add Game Over Level. Step 2 – Set Level Properties. Step 3 – Build and Run.

VIDEO GAME PROGRAMMING STEP 1: Add Game Over Level Insert a copy of the victory level and name it gameover. In the gameover level, open the properties for the main map. Change the File Name to gameover.bmp Go into the Level Preview and place things where you want them.

VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. You should have: 1.2 Player Mode 2.Enemies that shoot 3.Numbers 4.Mad math stuff 5.Ending Screens

VIDEO GAME PROGRAMMING CONGRADULATIONS! You’ve just finished Number Attack If you want to add more levels, insert a copy of level1 only make sure you select Insert After level1!!! If you don’t, things will break.