Copyright © 2005 DigiPen (USA) Corporation. All Rights Reserved

Copyright © 2005 DigiPen (USA) Corporation. All Rights Reserved.
Junior Workshop
DigiPutt
Project Outline
1 Game Properties
Setting up basic game properties – Color Depth and Compiler will vary depending on location / equipment
1.1 GameSteps
► Set Game Properties (Project->Properties, or “Alt + Enter”)
1.1.1
Compiler = Microsoft Visual C++ 6.0 or Borland Free Command Line Tools
1.1.2
Window Title = Let students decide (“DigiPutt”, for example)
2 MyFunctions and Level OnStart tab – MouseCenter()
Explain how the “OnStart” tab for a level can be used to do actions just as a level starts.
2.1 GameSteps
► Open “title” level -> Properties -> OnStart
2.2 Type – MouseCenter(); -- One of the ONLY pieces of code students must type.
BUILD AND RUN -- Mouse now starts in the middle of screen. Check function spelling for syntax errors.
3 Add the Map to hole1 Level
3.1 GameSteps
► Add a Map
3.2 General
3.2.1
Name = “main”
3.2.2
File = Art Assets -> Maps -> hole1.bmp
3.2.3
Click “Collision Data...” button
3.2.3.1
Drag a collision box around the rectangular hole frame from upper-left to lower-right. This mak
hole bounds.
3.2.3.2
Put rectangle collision around all walls
BUILD AND RUN
4 Setting up the Tee
The tee is a very important sprite. The game looks for the “tee” sprite when dynamically generating the balls and st
touch HotSpot 1 for the tee; the game assumes HotSpot 1 is the middle of the tee.
4.1 GameSteps
► Add a Sprite
Junior Workshop
Jul 13, 2017
Page 1 of 11
Copyright © 2005 DigiPen (USA) Corporation. All Rights Reserved.
4.2 General
4.2.1
Name = “tee”
4.2.2
Map = “main”
4.3 Animation
4.3.1
Actor = TEE
4.3.2
Initial Animation - UP
4.4 Position
4.4.1
Place on top of spot labeled “Tee” on the map
4.5 Collision
4.5.1
Loose Collision
4.5.2
Activate Sprite Collision
4.5.2.1
Check With Sprites
4.5.2.2
Ghost Collision
4.5.2.3
Check Same Display List
5 Putting in the Cursor
This “cursor”, internally, is more complicated than the one in the Title screen. The CursorData local data structure k
at the objects it hits, and to hit them with the proper strength.
5.1 GameSteps
► Add a Sprite
5.2 General
5.2.1
Name = “cursor” CHECK SPELLING
5.2.2
Map = “main”
5.2.3
Display List = 2
5.2.4
LocalData: Attach CursorData structure – CRASH IF NOT ATTACHED!!
5.3 Animation
5.3.1
Actor = CURSOR
5.3.2
Check “Peg Registered” Box
5.4 Behavior
5.4.1
Apply (F) MouseCursorMoveFN
5.5 Collision
5.5.1
Loose Collision
5.5.2
Activate Sprite Collision
5.5.2.1
Check With Sprites
5.5.2.2
Ghost Collision
5.5.3
optional – Show Bounding Box Collision
6 Interface Design – Start Player's Mouse in the Center
6.1 GameSteps
► Open hole1 Level -> Properties -> OnStart
6.2
Type – MouseCenter();
BUILD AND RUN – Should see the tee and the cursor, which can move and starts in the center of the window.
Junior Workshop
Jul 13, 2017
Page 2 of 11
Copyright © 2005 DigiPen (USA) Corporation. All Rights Reserved.
7 Adding Balls to the Game
The ball sprite is the most complex object in the game. Eventually, it will have 10 assigned behaviors (2 State Ma
“template” sprite, which is Unused. The sprite we set up in the Project tree will not show up in the game... instead
so we can have multiple players. This way, we could have 50, 100, or 1000+ players. For practical reasons the fr
The ball is a good example of how programming gradually evolves... a few more behaviors are built and attached
Each ball also has a Local Data structure that tracks its own strokes on the current hole, ID number, and whether i
7.1 GameSteps
► Add a Sprite
7.2 General
7.2.1
Name = “ball” -- CHECK SPELLING. CRASH WILL RESULT IF MISSPELLED.
7.2.2
Map = “main”
7.2.3
Display List = 1 -- IMPORTANT
7.2.4
Check “Unused” box – IMPORTANT
7.2.5
LocalData: Attach BallData structure – CRASH IF NOT ATTACHED!!
7.3 Animation
7.3.1
Actor = BALL
7.3.2
Initial Animation = YELLOW_NORMAL – The Animations for the BALL Actor are in “triples” that ar
HOLESINK. The game figures out animations based on “modulo 3” math. This “offset” is kept in the BALL
makes the framework extendable as long as Animation types are added following the cyclical pattern.
7.3.3
Check the “Peg Registered” Box
7.4 Behavior
7.4.1
Apply (S) BallCursorDragSM
7.4.2
Apply (S) BallAnimationSetSM
7.5 Collision
7.5.1
Precise Collision
7.5.2
Activate Sprite Collision
7.5.2.1
Check With Sprites
7.5.2.2
Ghost Collision
7.5.2.3
Check Same Display List
7.5.3
Check Collision With Map – New box, make sure students get this one.
7.6 Effects
7.6.1
Check “Reflection” box
7.6.2
Friction = 15 – (Friction is controlled in-game by the GRASS_FRICTION and SAND_FRICTION varia
BUILD AND RUN – No change from last time... ensure you CANNOT see the ball. It's Unused!
8 Creating Sprites Dynamically at Runtime
After all that setting up the ball template, the last Run wasn't too exciting because we didn't see anything. Let's add
8.1 GameSteps
► Open hole1 Level -> Properties -> OnStart
8.2
Type – CreateBallsForLevel();
Junior Workshop
Jul 13, 2017
Page 3 of 11
Copyright © 2005 DigiPen (USA) Corporation. All Rights Reserved.
BUILD AND RUN – Balls are created, but we can only see the Yellow one (Player 1). Hit the Yellow Ball. We ca
need to be able to “change turns” to hit the other balls too.
9 Player Selection and Escape Behavior for hole1 Level
9.1 GameSteps
► Open hole1 Level -> Properties -> Behavior
9.2 Apply (F) LevelChangeTurnFN
9.3 Apply (F) KeyboardFirstLevelFN
9.4 Uncheck the “Quit on Esc” box – We'll have the Esc key take us back to the Title
BUILD AND RUN – Player Selection works (multiplayer only) with 1 through 9 number keys. PlayerText is Visib
current player's ball. All the balls can now be hit. The balls should NOT collide with each other yet... if the balls ar
checked in the “ball” Sprite. Esc should take you back to the Title.
10
Adding the Hole
The framework supports multiple holes per Level. After students have one hole working, they can add others. May
in a dangerous spot?
10.1
GameSteps
► Add a Sprite
10.2
General
10.2.1 Name = “hole” CHECK SPELLING
10.2.2 Map = “main”
10.3
Animation
10.3.1 Actor = HOLE
10.4
Position
10.4.1 Set with ellipsis (...) button
10.4.2 Place on top of spot labeled “H” on the map
10.5
Collision
10.5.1 Precise Collision
10.5.2 Activate Sprite Collision
10.5.2.1
Check With Sprites
10.5.2.2
Ghost Collision
11
Updating Ball's Behavior
11.1
GameSteps
► Open “ball” Sprite properties -> Behavior
11.2
Apply (F) BallCollisionOffTeeFN – Disables Ghost Collision for balls off the tee, so they can bounce o
11.3
Apply (F) BallDeleteInHoleFN – If ball collides with hole at a slow speed, it begins to fall in with the H
the hole. Updates scoring information as ball is deleted.
BUILD AND RUN – Balls collide, but stationary one doesn't move yet... one step closer though. All balls can be hi
when the balls fall in – that's OK. The balls are looking for the “Par” for the hole to keep score, which isn't there ye
Junior Workshop
Jul 13, 2017
Page 4 of 11
Copyright © 2005 DigiPen (USA) Corporation. All Rights Reserved.
12
Making Stationary Balls Move When Struck
12.1
GameSteps
► Open “ball” Sprite properties -> Behavior
12.2
Apply (F) BallSetSpeedOnCollisionFN
13
Displaying the Final Scores (Function that Copies PlayerScoreText)
13.1
GameSteps
► Open “end” Level -> Properties
13.2
OnStart
13.2.1 Type – DisplayFinalScores();
13.3
13.3.1
13.3.2
Behavior
Apply (F) KeyboardFirstLevel
Uncheck the “Quit on Escape” box
BUILD AND RUN – When all balls are gone, the “Press Enter...” message appears. Player can go to the “End” lev
color for the corresponding ball. Pressing Esc takes Player back to Title.
14
Adding Bumpers
14.1
GameSteps
► Add a Sprite
14.2
General
14.2.1 Name = “bumper”
14.2.2 Map = “main”
14.3
Animation
14.3.1 Actor = BUMPER
14.3.2 Initial Animation = UPPERLEFT
14.4
Position
14.4.1 Set with ellipsis (...) button
14.4.2 Place on the spot labeled “1” on the map
14.5
Collision
14.5.1 Precise Collision
14.5.2 Activate Sprite Collision
14.5.3 Check With Sprites
15
Inserting Sprite Copies – Creating More Bumpers
15.1
Right-Click the “bumper” sprite and Click “Insert Copy”
15.2
Name the copy “bumper2”
15.3
Initial Animation = UPPERRIGHT
15.4
Place on the spot labeled “2” on the map
15.5
Right-Click the “bumper” sprite and Click “Insert Copy”
Junior Workshop
Jul 13, 2017
Page 5 of 11
Copyright © 2005 DigiPen (USA) Corporation. All Rights Reserved.
15.6
15.7
15.8
Name the copy “bumper”
Initial Animation = LOWERLEFT
Place on the spot labeled “3” on the map
15.9
BUILD AND RUN
16
Adding Ball Response to Water Traps
Water Traps cause a 1-stroke penalty and place the ball back to the previous position before it was hit. Water is imp
times to create some abstract-looking lakes.
16.1
GameSteps
► Open “ball” Sprite -> Properties -> Behavior
16.2
Apply (F) BallOnWaterFN
17
Adding the First Water Trap “Tile”
17.1
GameSteps
► Add a Sprite
17.2
General
17.2.1 Name = “water” -- CHECK SPELLING
17.2.2 Map = “main”
17.3
Animation
17.3.1 Actor = WATER
17.4
Collision
17.4.1 Loose Collision
17.4.2 Activate Sprite Collision
17.4.2.1
Check With Sprites
17.4.2.2
Ghost Collision
18
Create Group of Water Trap Sprites
18.1
GameSteps
► Right-Click “water” Sprite, Click “Create Group”
18.2
Use Rectangle tool
18.3
Make rectangle around area labeled “Water” on the map
18.4
Leave Horizontal and Vertical spacing at 0 – we want these sprites touching
18.5
Use the “magic wand” to fill the area with sprites
18.6
Close window and name group “water”
BUILD AND RUN – Balls should collide with water, take a one-stroke penalty, and be put back at prior location.
19
Adding Ball Response to Sand
Sand Traps cause massive friction and limit the top speed of the ball. They can be difficult to get through. Sand is i
many times to create some abstract-looking traps.
Junior Workshop
Jul 13, 2017
Page 6 of 11
Copyright © 2005 DigiPen (USA) Corporation. All Rights Reserved.
19.1
19.2
GameSteps
► Open “ball” Sprite -> Properties -> Behavior
Apply (F) BallOnSandFN
20
Adding the First Sand Trap “Tile”
20.1
GameSteps
► Add a Sprite
20.2
General
20.2.1 Name = “sand” -- CHECK SPELLING
20.2.2 Map = “main”
20.3
Animation
20.3.1 Actor = SAND
20.4
Collision
20.4.1 Loose Collision
20.4.2 Activate Sprite Collision
20.4.2.1
Check With Sprites
20.4.2.2
Ghost Collision
21
Create Group of Sand Trap Sprites
21.1
GameSteps
► Right-Click “sand” Sprite, Click “Create Group”
21.2
Use Rectangle tool
21.3
Make rectangle around area labeled “Sand” on the map
21.4
Leave Horizontal and Vertical spacing at 0 – we want these sprites touching
21.5
Use the “magic wand” to fill the area with sprites
21.6
Close window and name group “sand”
BUILD AND RUN – Balls should “drag” through the sand traps.
22
Adding Ball Response to Hills
Hills bend the path of a ball, and speed it up if downhill or slow it if uphill. Hills are implemented as a small “tile”
abstract-looking hill areas.
22.1
GameSteps
► Open “ball” Sprite -> Properties -> Behavior
22.2
Apply (F) BallOnHillFN
23
Adding the First Hill “Tile”
23.1
GameSteps
► Add a Sprite
Junior Workshop
Jul 13, 2017
Page 7 of 11
Copyright © 2005 DigiPen (USA) Corporation. All Rights Reserved.
23.2
General
23.2.1 Name = “hill” -- CHECK SPELLING
23.2.2 Map = “main”
23.3
Animation
23.3.1 Actor = HILLTILE
23.3.2 Initial Animation = DOWN
23.4
Displacement
23.4.1 Speed = 0.06 – We're using a kind of CHEAT here. We want to be able to give the hills different streng
Speed. The hill's VectorDirection is (0,0), so the hill isn't going anywhere... the Speed is just a really conveni
in the FUN Editor. Speed should be in the range from 0.01 to 0.06.
23.5
Collision
23.5.1 Loose Collision
23.5.2 Activate Sprite Collision
23.5.2.1
Check With Sprites
23.5.2.2
Ghost Collision
24
Create Group of Hill Sprites
Students may create a group of hill sprites and decide they need to be modified. This is a good time to show them h
single sprite and then re-create another group.
24.1
GameSteps
► Right-Click “hill” Sprite, Click “Create Group”
24.2
Use Rectangle tool
24.3
Make rectangle around area labeled “hill1” on the map
24.4
Leave Horizontal and Vertical spacing at 0 – we want these sprites touching
24.5
Use the “magic wand” to fill the area with sprites
24.6
Close window and name group “hill”
BUILD AND RUN – Balls react to the direction of the hills
25
Adding another hill
25.1
GameSteps
► Add a Sprite
25.2
General
25.2.1 Name = “hill”
25.2.2 Map = “main”
25.3
Animation
25.3.1 Actor = HILLTILE
25.3.2 Initial Animation = DOWN
25.4
Displacement
25.4.1 Speed = 0.05
Junior Workshop
Jul 13, 2017
Page 8 of 11
Copyright © 2005 DigiPen (USA) Corporation. All Rights Reserved.
25.5
Collision
25.5.1 Loose Collision
25.5.2 Activate Sprite Collision
25.5.2.1
Check With Sprites
25.5.2.2
Ghost Collision
25.6
25.7
Create new group of hill sprites at the spot labeled “hill2” on the map
Name the group “hill2”
26
Adding Ball Response to Rollers
Rollers are a little different than hills. First, they have a bigger actor with a large arrow on it, so we won't be tiling o
is greater than the Friction the ball is experiencing (GRASS_FRICTION), the ball WILL be thrown off the roller (th
26.1
GameSteps
► Open “ball” Sprite -> Properties -> Behavior
26.2
Apply (F) BallOnRollerFN
27
Adding a Roller
27.1
GameSteps
► Add a Sprite
27.2
General
27.2.1 Name = “roller” -- CHECK SPELLING
27.2.2 Map = “main”
27.3
Animation
27.3.1 Actor = ROLLER
27.3.2 Initial Animation = DOWN
27.4
Position
27.4.1 Set with ellipsis (...) button
27.4.2 Place on the area labeled “Roller” on the map
27.5
Displacement
27.5.1 Speed = 0.35 – We're using a kind of CHEAT here. We want to be able to give the rollers different stre
roller's VectorDirection is (0,0), so it won't move... the Speed is just a really convenient place to store a piece
Roller Speeds, because of the function logic, are generally much greater than Hill Speeds.
27.6
Collision
27.6.1 Loose Collision
27.6.2 Activate Sprite Collision
27.6.2.1
Check With Sprites
27.6.2.2
Ghost Collision
BUILD AND RUN – Balls react to the Rollers, and do not stop on the Rollers.
28
Copying a Level – Adding hole2
28.1
CAREFULLY make a copy of the hole1 Level
Junior Workshop
Jul 13, 2017
Page 9 of 11
Copyright © 2005 DigiPen (USA) Corporation. All Rights Reserved.
28.1.1 Right-Click “hole1” and Click “Insert Copy”
28.1.2 Name the copy “hole2”
28.1.3 Click “Insert After hole1” -- IMPORTANT. Hole2 must show up BETWEEN hole1 and End. If not, H
the levels to progress in the order they are listed in the Project tree. If a student accidentally adds Hole2 at La
again.
28.1.4 Delete all sprites and sprite groups except for tee, cursor, ball, and hole
BUILD AND RUN – Ensure flow of Levels goes from title -> hole1 -> hole2 -> End
29
Set HoleNumWord and Par for hole2
29.1
Change “HoleNumText” Text Object to say “Hole #2” instead of “Hole #1”
29.2
Change the “ParNumber” Text Object to the par for Hole 2.
30
Designing a new hole
30.1
Open up Hole_Template.bmp in paint
30.2
Design layout for new hole
30.3
Save As hole2.bmp
30.4
Make the level in FUN editor
31
Repeat steps 28 – 30 to add as many holes as you want.
Additional Notes:
Global Data Values that can be tweaked:
1. MAX_CURSOR_DISTANCE – The distance at which the cursor power is maxxed out, and the MaxPowerPS
particle system begins sparkling. The larger this number, the further back you have to pull the cursor to get
full power.
2. MAX_BALL_SPEED – The maximum speed of the ball when hit with a Max Power cursor shot (while on
grass).
3. NUM_SNAP_FRAMES – Determines how fast the cursor “snaps” to the ball. Purely a visual effect. If you
increase the MAX_CURSOR_DISTANCE, you'll need to change this too so things will look right. The
smaller the number, the faster the cursor snaps at the ball (small number -> fewer frames -> faster movement
for the same distance).
4. BALL_HOLE_SPEED_LIMIT – The speed at which the ball can go in the hole when it's colliding with the
hole. Set this limit higher to make things easier, you won't roll over the hole as much.
5. GRASS_FRICTION – The “normal” friction of the ball on the grass.
Junior Workshop
Jul 13, 2017
Page 10 of 11
Copyright © 2005 DigiPen (USA) Corporation. All Rights Reserved.
6. SAND_FRICTION – The friction of the sand traps. Higher friction slows you down more.
7. SAND_MAX_SPEED – In addition to high friction, the sand puts a cap on your max speed. A high friction
and low max speed can be very, very difficult.
8. SCORE_SPACING – Not too exciting... it's the spacing the game uses when auto-creating all the different
colored score texts. If you change the font or font size of your score text, you may have to adjust the spacing.
9. WATER_SPEED_LIMIT – The Speed you need to achieve to skip a ball across water. Set this lower for an
easier time skipping over the H2O.
Potential Extra Stuff:
1. Sound Effects – There is a PlaySound MyFunction included in the framework. If you want to add Sound
Effects to your levels, you can play them by passing the name of the sound effect to this function. For
example, if you have a sound named “BallThwack” then you'd type -- PlaySound(“BallThwack”); in the
game code.
Putting Sound Effects in Code can help you easily hear when a function is being called, and can help you
understand how the code works. It's unlikely you'll break anything by putting in just sound effects, but backup
your project somewhere else just in case!!
2. Transition Effects – Look in Level -> Properties at the “Transitional Effect / Enter” and “Transitional Effect /
Exit” tabs. You can play around with various fade-outs and other cool ways to transition from one level to the
next.
3. Artwork – Always more Painting to be done!!
4. DATABASE_GetPlayersColor -- This MyFunction defines the colors of the Score Text objects, the ball-inhole particle systems, the CurrentPlayerText, and the ScoreMessage that shows up when a ball drops in the
hole. The colors are in RGB format, where R represents Red, G is Green, and B is Blue. Values range from 0
to 255.
5. ParticleSystems – The code in the ParticleSystems objects defines the properties of the particles. You can
play with the values in the Size, Color, Angle, Velocity, and Maximum Age function calls to get Particle
Systems off shapes, sizes, colors, and behaviors. You can also change the Number of Particles... but don't go
too crazy. You just might lock up the machine if you set that value in the millions.
Junior Workshop
Jul 13, 2017
Page 11 of 11