Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "VIDEO GAME PROGRAMMING Video Game Programming Junior – DigiPutt INSTRUCTOR TEACHER’S ASSISTANT."— Presentation transcript:

1 VIDEO GAME PROGRAMMING Video Game Programming Junior – DigiPutt INSTRUCTOR TEACHER’S ASSISTANT

2 VIDEO GAME PROGRAMMING PART 1 – Game Properties Objective: –Set up basic game properties. This is usually the first step when starting a project from scratch. Step 1 – Open Project Properties. Step 2 – Set Project Properties.

3 VIDEO GAME PROGRAMMING STEP 1: Open Project Properties In FUN, go to the Project menu and select Properties. You can also just hit to open the Project Properties.

4 VIDEO GAME PROGRAMMING STEP 2: Set Project Properties Set the Compiler to use either Microsoft Visual C++ 6.0 or Borland Free Command Line Tools. Set the Window Title to whatever you want to call your game (DigiPutt for instance).

5 VIDEO GAME PROGRAMMING PART 2 – Level OnStart Tab Objective: –Add functionality to the OnStart tab of a level. Step 1 – Add Code. Step 2 – Build and Run.

6 VIDEO GAME PROGRAMMING STEP 1: Add Code Open the Level Properties for the title level and click on the OnStart tab. Type the following EXACTLY: MouseCenter();

7 VIDEO GAME PROGRAMMING STEP 2: Build and Run Build and Run your game. When you start a new game the mouse cursor should automatically be at the center of the screen.

8 VIDEO GAME PROGRAMMING PART 3 – Add Map to hole1 Level Objective: –Add a new map to the level hole1. Step 1 – Add Map. Step 2 – Build and Run.

9 VIDEO GAME PROGRAMMING STEP 1: Add Map Add a new Map to hole1 and set the following properties: 1.Name: main 2.File: hold1.bmp (in Maps folder) 3.Collision Data: Draw Rectangular Collision data around the hole with inward pointing normals. Draw data around the walls with outward pointing normals.

10 VIDEO GAME PROGRAMMING STEP 2: Build and Run Build and Run your game. At this point, nothing should be happening, we just want to make sure you have everything all right and good.

11 VIDEO GAME PROGRAMMING PART 4 – Adding the Tee Objective: –Add a “tee” sprite to hole1. This is important as, when the game goes to place a ball, we use the tee sprite to tell it where to put the new balls. Step 1 – Add a New Sprite. Step 2 – Set Sprite Properties.

12 VIDEO GAME PROGRAMMING STEP 1: Add a New Sprite Add a new Sprite to hole1.

13 VIDEO GAME PROGRAMMING STEP 2: Set Sprite Properties Set the following Properties for the hole1 sprite: 1.Name: tee 2.Map: main 3.Actor: TEE 4.Initial Animation: UP 5.Position: Place on top of the spot labeled “tee” on the map.

14 VIDEO GAME PROGRAMMING STEP 2: Set Sprite Properties continued… 6.Collision: Loose Collision, Activate Sprite Collision, Check With Sprites, Ghost Collision, Check Same Display List

15 VIDEO GAME PROGRAMMING PART 5 – Adding the Cursor Objective: –Add the cursor for our main game. The player will use the cursor as his/her club. Step 1 – Add a New Sprite. Step 2 – Set Sprite Properties.

16 VIDEO GAME PROGRAMMING STEP 1: Add a New Sprite Add a new Sprite to hole1.

17 VIDEO GAME PROGRAMMING STEP 2: Set Sprite Properties Set the following properties: 1.Name: cursor 2.Map: main 3.Display List: 2 4.Local Data: CursorData 5.Actor: CURSOR 6.Peg Registered: Checked

18 VIDEO GAME PROGRAMMING STEP 2: Set Sprite Properties continued… 7.Behavior: MouseCursorMoveFN 8.Collision: Loose Collision, Activate, Check With Sprites, Ghost Collision, Show Bounding Box (optional)

19 VIDEO GAME PROGRAMMING PART 6 – Set Mouse to Center Objective: –Set the cursor to start at the center of the screen. Step 1 – Add Code. Step 2 – Build and Run.

20 VIDEO GAME PROGRAMMING STEP 1: Add Code Open the Level Properties for hole1. Click on the OnStart tab. Add the following EXACTLY: MouseCenter();

21 VIDEO GAME PROGRAMMING STEP 2: Build and Run Build and Run your game. You should see both the tee and the cursor and the cursor should start at the center of the screen.

22 VIDEO GAME PROGRAMMING PART 7 – Adding the Ball Objective: –Add the ball to the game. Step 1 – Add a New Sprite. Step 2 – Set Sprite Properties. Step 3 – Build and Run.

23 VIDEO GAME PROGRAMMING STEP 1: Add a New Sprite Add a new Sprite to hole1.

24 VIDEO GAME PROGRAMMING STEP 2: Set Sprite Properties GENERAL: 1.Name: ball 2.Map: main 3.Display List: 1 4.Unused: Checked 5.Local Data: BallData

25 VIDEO GAME PROGRAMMING STEP 2: Set Sprite Properties continued… ANIMATION: 1.Actor: BALL 2.Initial Animation: YELLOW_NORMAL 3.Peg Registered: Checked

26 VIDEO GAME PROGRAMMING STEP 2: Set Sprite Properties continued… BEHAVIOR: 1.State Machines: BallCursorDragSM, BallAnimationSetSM

27 VIDEO GAME PROGRAMMING STEP 2: Set Sprite Properties continued… COLLISION: 1.Precise: Check 2.Activate Sprite Collision: Check 3.Check With Sprites: Check 4.Ghost Collision: Check 5.Check Same Display List: Check 6.Check With Map: Check

28 VIDEO GAME PROGRAMMING STEP 2: Set Sprite Properties continued… EFFECTS: 1.Reflection: Check 2.Friction: 15

29 VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. You shouldn’t see your ball because we checked Unused. This is important!

30 VIDEO GAME PROGRAMMING PART 8 – Creating Sprites at Run Time Objective: –Have multiple balls spawn for multiple players. Step 1 – Explanation. Step 2 – Add Behavior to Level. Step 3 – Build and Run.

31 VIDEO GAME PROGRAMMING CONCEPT – Creating Sprites at Run Time In Number Attack we had to potentially create an infinite number of enemies, so we couldn’t just add infinite sprites to our level and place them, we used a function that spawned them at run-time. We need to do this in DigiPutt because we don’t know how many players we’re going to have in the game, so we have a function to spawn balls at run time based on how many people are playing.

32 VIDEO GAME PROGRAMMING STEP 2: Add Behavior to Level Open the Level Properties for hole1 and click the OnStart tab. Add the following EXACLTY: CreateBallsForLevel();

33 VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run the game. Try starting a Multiplayer game with at least 2 players. Hit the balls by clicking on them, dragging the mouse, and then releasing the left mouse button. Could you hit anything but the yellow ball?

34 VIDEO GAME PROGRAMMING PART 9 – Player Selection and Quitting Objective: –Add the ability to change turns (so other people can play). Also, add the ability to hit to quit the game. Step 1 – Add Behavior to Level. Step 2 – Build and Run.

35 VIDEO GAME PROGRAMMING STEP 1: Add Behavior to Level Open the Level Properties for hole1 and set the following: 1.Behavior: Add the LevelChangeTurnFN and KeyboardFirstLevelFN functions. 2.Quit on Escape: Uncheck this box.

36 VIDEO GAME PROGRAMMING STEP 2: Build and Run Build and Run your game. Try starting a multiplayer game again. You should now be able to change whose turn it is using the 1-9 Keys on the keyboard.

37 VIDEO GAME PROGRAMMING PART 10 – Adding the Hole Objective: –Add the hole to the game. Step 1 – Create a new Sprite. Step 2 – Set Properties.

38 VIDEO GAME PROGRAMMING STEP 1: Create a new Sprite Create a new Sprite in hole1.

39 VIDEO GAME PROGRAMMING STEP 2: Set Properties Set the following properties for the new sprite: 1.Name: hole 2.Map: main 3.Actor: HOLE 4.Position: Manually place on top of the H on the map.

40 VIDEO GAME PROGRAMMING STEP 2: Set Properties continued… 5.Collision: Precise, Activate Sprite Collision, Check With Sprites, Ghost Collision

41 VIDEO GAME PROGRAMMING PART 11 – Update the Ball’s Behavior Objective: –Add some more behavior to the ball. We’re going to make it so the balls ghost collision is turned off after it leaves the tee so it can run into other balls and changes animation once it’s in the hole. Step 1 – Add Behavior to ball. Step 2 – Build and Run.

42 VIDEO GAME PROGRAMMING STEP 1: Add Behavior to ball Add the following functions to the ball sprite: 1.BallCollisionOffTeeFN 2.BallDeleteInHoleFN

43 VIDEO GAME PROGRAMMING STEP 2: Build and Run Build and Run your game. Try hitting multiple balls so they collide with each other. We don’t quite have correct behavior, but we’re close. Also, if you get a ball in the hole, the game is supposed to crash (the game is looking for the ‘par’ for the hole, which we haven’t added, so it crashes.)

44 VIDEO GAME PROGRAMMING PART 12 – Making Stationary Balls Move When Struck Objective: –Add the ability to make balls already on the course move when struck. Step 1 – Add Behavior to ball.

45 VIDEO GAME PROGRAMMING STEP 1: Add Behavior to ball Add the BallSetSpeedOnCollisionFN function to the ball sprite. This will make it so, when 2 balls collide, the stationary ball will start rolling.

46 VIDEO GAME PROGRAMMING PART 13 – Displaying the Final Scores Objective: –Add final scores to the gameover screen. Step 1 – Add Behavior to end Level. Step 2 – Build and Run.

47 VIDEO GAME PROGRAMMING STEP 1: Add Behavior to end Level Open the Level Properties for the end level. Under OnStart type the following EXACTLY: DisplayFinalScores(); Next, add the KeyboardFirstLevelFN function under Behavior and UNCHECK the Quit on Escape box.

48 VIDEO GAME PROGRAMMING STEP 2: Build and Run Now Build and Run your game. Now, when all the balls are in the hole, you can hit to go to the end level and view every players score.

49 VIDEO GAME PROGRAMMING PART 14 – Adding Bumpers Objective: –Add bumpers around the level that the ball can bounce off of. Step 1 – Create a new Sprite. Step 2 – Set Properties.

50 VIDEO GAME PROGRAMMING STEP 1: Add a new Sprite Add a new Sprite to hole1.

51 VIDEO GAME PROGRAMMING STEP 2: Set Properties Set the following Properties for the new sprite: 1.Name: bumper 2.Map: main 3.Actor: BUMPER 4.Initial Animation: UPPERLEFT

52 VIDEO GAME PROGRAMMING STEP 2: Set Properties continued… 5.Position: Manually place the bumper on the spot labeled 1 on the map. 6.Collision: Precise, Activate Sprite Collision, Check With Sprites

53 VIDEO GAME PROGRAMMING PART 15 – Creating More Bumpers Objective: –Add more bumpers (go figure). Step 1 – Insert Copy of bumper Sprite. Step 2 – Set Properties. Step 3 – Build and Run.

54 VIDEO GAME PROGRAMMING STEP 1: Insert Copy of bumper Sprite Insert a Copy of the bumper sprite and name it bumper2. Insert another Copy of the bumper sprite and name it bumper3.

55 VIDEO GAME PROGRAMMING STEP 2: Set Properties Set these Properties for the bumper2 sprite: 1.Initial Animation: UPPERRIGHT 2.Position: Manually place it on the spot labeled 2 on the map. Set these for bumper3: 1.Initial Animation: LOWERLEFT 2.Position: Manually place it on the spot labeled 3 on the map.

56 VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. You should have working bumpers to assist you in putting the ball around corners.

57 VIDEO GAME PROGRAMMING PART 16 – Adding Ball Response to Water Traps Objective: –Add Water Trap Functionality to the ball. Later, we’ll be adding water traps that, when the ball hits the trap, causes the player to lose a stroke. Step 1 – Add Behavior to ball Sprite.

58 VIDEO GAME PROGRAMMING STEP 1: Add Behavior to ball Sprite Add the BallOnWaterFN function to the ball sprite.

59 VIDEO GAME PROGRAMMING CONCEPT – Interactive “Tiles” In DigiPutt we’re going to have a number of interactive tiles. These tiles are small sprites that we bunch together in groups to create the illusion of having one much larger sprite. We use these tiles to affect the ball in special ways (water traps, sand, etc.)

60 VIDEO GAME PROGRAMMING PART 17 – Add the First Water Trap “Tile” Objective: –Add the base water trap tile. Later, we’ll be making multiple copies of this sprite in a group. Step 1 – Add a New Sprite. Step 2 – Set Properties.

61 VIDEO GAME PROGRAMMING STEP 1: Add a New Sprite Add a new Sprite to hole1.

62 VIDEO GAME PROGRAMMING STEP 2: Set Properties Set the following properties for the new sprite: 1.Name: water 2.Map: main 3.Actor: WATER 4.Collision: Loose, Activate, Check With Sprites, Ghost

63 VIDEO GAME PROGRAMMING PART 18 – Create Group of Water Trap Sprites Objective: –Add the base water trap tile. Later, we’ll be making multiple copies of this sprite in a group. Step 1 – Create a New Group of Sprites. Step 2 – Build and Run.

64 VIDEO GAME PROGRAMMING STEP 1: Create a New Group of Sprites Right-click on the water sprite and select Create Group. Use the Rectangle Tool to draw a square around the area of the map labeled Water. Set Horizontal and Vertical Spacing to 0.

65 VIDEO GAME PROGRAMMING STEP 1: Create a New Group of Sprites continued… Use the Magic Wand to fill the area with sprites. Close the window and name the group water.

66 VIDEO GAME PROGRAMMING STEP 2: Build and Run Now Build and Run your game. Try hitting a ball into the water. You should get a 1 stroke penalty and your ball should be placed back where it started. If you hit the ball hard enough, it will skip over the water!

67 VIDEO GAME PROGRAMMING PART 19 – Adding Ball Response to Sand Objective: –Add Sand Trap response behavior to the ball. Sand Traps greatly reduce the speed of the ball (or increase friction). Step 1 – Add Behavior to the Ball.

68 VIDEO GAME PROGRAMMING STEP 1: Add Behavior to the Ball Add the BallOnSandFN function to the ball sprite. This will make it so that when any ball collides with sand traps, the friction of the ball is greatly increased, thus the ball is slowed down.

69 VIDEO GAME PROGRAMMING PART 20 – Adding the First Sand Trap “Tile” Objective: –Add sand sprite. Step 1 – Create a New Sprite. Step 2 – Set Sprite Properties.

70 VIDEO GAME PROGRAMMING STEP 1: Create a New Sprite Add a new Sprite to the hole1 level.

71 VIDEO GAME PROGRAMMING STEP 2: Set Sprite Properties Set the following properties for the new sprite: 1.Name: sand 2.Map: main 3.Actor: SAND 4.Collision: Loose, Activate, Check with Sprites, Ghost Collision

72 VIDEO GAME PROGRAMMING PART 21 – Create Group of Sand Trap Sprites Objective: –Create a group of sand sprites. Step 1 – Create a new Group of Sprites. Step 2 – Build and Run.

73 VIDEO GAME PROGRAMMING STEP 1: Create a new Group of Sprites Right-click on the sand sprite and select Create Group. Use the Rectangle Tool to draw a square around the area of the map labeled Sand. Set Horizontal and Vertical Spacing to 0.

74 VIDEO GAME PROGRAMMING STEP 1: Create a new Group of Sprites continued… Use the Magic Wand to fill the area with sprites. Close the window and name the group sand.

75 VIDEO GAME PROGRAMMING STEP 2: Build and Run Now Build and Run your game. Try hitting some balls over the sand. Notice how the ball slows down significantly.

76 VIDEO GAME PROGRAMMING PART 22 – Adding Ball Response to Hills Objective: –Add Hill response behavior to the ball. Hills will cause the ball to slowly accelerate downward. Step 1 – Add Behavior to the Ball.

77 VIDEO GAME PROGRAMMING STEP 1: Add Behavior to the Ball Add the BallOnHillFN function to the ball sprite. This will make it so that when any ball collides with hills the ball slowly starts moving downward.

78 VIDEO GAME PROGRAMMING PART 23 – Adding the First Hill Sprite Objective: –Add hill sprite. Step 1 – Create a New Sprite. Step 2 – Set Sprite Properties.

79 VIDEO GAME PROGRAMMING STEP 1: Create a New Sprite Add a new Sprite to the hole1 level.

80 VIDEO GAME PROGRAMMING STEP 2: Set Sprite Properties Set the following properties for the new sprite: 1.Name: hill 2.Map: main 3.Actor: HILLTILE 4.Initial Animation: DOWN 5.Collision: Loose, Activate, Check with Sprites, Ghost Collision

81 VIDEO GAME PROGRAMMING STEP 2: Set Sprite Properties continued… Next, set the Speed to 0.06. We use the hill’s speed to define how steep the hill is. Since the hill’s vector direction is (0,0) it’s not actually moving. You’ll want to use values between 0.01 and 0.06.

82 VIDEO GAME PROGRAMMING PART 24 – Create Group of Hill Sprites Objective: –Create a group of hill sprites. Step 1 – Create a new Group of Sprites. Step 2 – Build and Run.

83 VIDEO GAME PROGRAMMING STEP 1: Create a new Group of Sprites Right-click on the hill sprite and select Create Group. Use the Rectangle Tool to draw a square around the area of the map labeled Hill1. Set Horizontal and Vertical Spacing to 0.

84 VIDEO GAME PROGRAMMING STEP 1: Create a new Group of Sprites continued… Use the Magic Wand to fill the area with sprites. Close the window and name the group hill.

85 VIDEO GAME PROGRAMMING STEP 2: Build and Run Build and Run your game. Try hitting a ball onto the hill. Does the hill affect the movement of the ball?

86 VIDEO GAME PROGRAMMING PART 25 – Adding Another Hill Objective: –Create a new hill sprite. Step 1 – Create a new Sprite. Step 2 – Set Sprite Properties. Step 3 – Create a new sprite group.

87 VIDEO GAME PROGRAMMING STEP 1: Create a New Sprite Add a new Sprite to the hole1 level.

88 VIDEO GAME PROGRAMMING STEP 2: Set Sprite Properties Set the following properties for the new sprite: 1.Name: hill 2.Map: main 3.Actor: HILLTILE 4.Initial Animation: DOWN 5.Collision: Loose, Activate, Check with Sprites, Ghost Collision

89 VIDEO GAME PROGRAMMING STEP 2: Set Sprite Properties continued… Next, set the Speed to 0.05.

90 VIDEO GAME PROGRAMMING STEP 3: Create a New Sprite Group Create a group of hill sprites out of the hill sprite you just created. Create the group over the part of the map labeled hill2 and name the group hill2.

91 VIDEO GAME PROGRAMMING PART 26 – Adding Ball Response to Rollers Objective: –Add Roller Response to the ball sprite. Rollers are different than hills in that they are a bigger, single sprite and the ball won’t stop on a roller, unlike a hill. Step 1 – Add behavior.

92 VIDEO GAME PROGRAMMING STEP 1: Add Behavior Add the BallOnRollerFN function to the ball sprite.

93 VIDEO GAME PROGRAMMING PART 27 – Adding a Roller Objective: –Now that we have the functionality in, let’s add a roller sprite. Step 1 – Create a new sprite. Step 2 – Set properties. Step 3 – Build and Run.

94 VIDEO GAME PROGRAMMING STEP 1: Create a new Sprite Add a new sprite to hole1.

95 VIDEO GAME PROGRAMMING STEP 2: Set Properties Set the following properties for the new sprite: 1.Name: roller 2.Map: main 3.Actor: ROLLER 4.Initial Animation: DOWN 5.Collision: Loose, Activate, Check with Sprites, Ghost Collision

96 VIDEO GAME PROGRAMMING STEP 2: Set Properties continued… 6.Speed: 0.35 7.Position: Manually place on the part of the map labeled Roller.

97 VIDEO GAME PROGRAMMING STEP 3: Build and Run Build and Run your game. Hit the ball so it goes over a roller. The ball should be pushed downward as long as it’s on the roller.

98 VIDEO GAME PROGRAMMING PART 28 – Adding a new Hole Objective: –Congrats! You’ve finished the first hole. Now we’re going to add another hole. Step 1 – Create the art for hole2. Step 2 – Insert a copy of hole1. Step 3 – Build and Run.

99 VIDEO GAME PROGRAMMING STEP 1: Create the Art for Hole2 Open MS Paint. Open the file hole_template.bmp and IMMEDIATELY go to File->Save As and save it as hole2.bmp. You should do this for every new hole you create so you can reuse this template art. Draw the hole. When you’re done, just go to File->Save to save it.

100 VIDEO GAME PROGRAMMING STEP 2: Insert a Copy of Hole1 Right-Click on hole1 and select Insert Copy. Name the copy hole2. MAKE SURE you select Insert After hole1. If you don’t do this, your levels will be out of order and your game won’t work.

101 VIDEO GAME PROGRAMMING STEP 2: Insert a Copy of Hole1 continued… Right-click on every sprite group in hole2 and select Restore to One. This way you can create multiple copies of your base tile sprites and insert multiple groups of sprites. If you don’t want to use a sprite (the roller for instance) then open the Sprite Properties for that sprite and check the Unused box.


Download ppt "VIDEO GAME PROGRAMMING Video Game Programming Junior – DigiPutt INSTRUCTOR TEACHER’S ASSISTANT."

Similar presentations


Ads by Google