Home Store Project Ideas Project Guide Ask An Expert Blog Careers Teachers Parents Students

Hit Boxes: How Size Affects Score

Time Required Average (6-10 days)
Prerequisites None
Material Availability Readily available
Cost Very Low (under $20)
Safety No issues


Video games come in many varieties: aim-and-shoot games, city-building games, racing games... the list goes on. In many, you get points for colliding with or hitting something. In this computer and video games project, you will learn about how hit boxes are used to detect collisions and you will determine if the size and placement of a hit box affects the score in the game.


To build a video game using GameMaker and experiment with how the size and placement of a hit box affect the game’s score.


Michelle Maranowski, PhD, Science Buddies

Cite This Page

MLA Style

Science Buddies Staff. "Hit Boxes: How Size Affects Score" Science Buddies. Science Buddies, 14 Feb. 2013. Web. 24 Oct. 2014 <http://www.sciencebuddies.org/science-fair-projects/project_ideas/Games_p028.shtml>

APA Style

Science Buddies Staff. (2013, February 14). Hit Boxes: How Size Affects Score. Retrieved October 24, 2014 from http://www.sciencebuddies.org/science-fair-projects/project_ideas/Games_p028.shtml

Share your story with Science Buddies!

I did this project I Did This Project! Please log in and let us know how things went.

Last edit date: 2013-02-14


If, on my daily walk, I bumped into my neighbor walking her dog, we would both know the reason we bumped into each other was that we were trying to occupy the same space at the same time. But how does a video game "know" when two characters have bumped into each other, or if a racing car has hit the speedway's wall? The answer is through collision detection and hit boxes. Why are hit boxes important? Because a poorly designed hit box can lead to errors during game play, like a collision between two characters in a game that are visually far apart. It is also frustrating for a player who can't score in a game.

A hit box, also known as a bounding box or bounding volume, is either a two-dimensional or three-dimensional shape that surrounds a character, which the game's programming uses to detect a hit or collision. Figure 1 shows an example of a hit box or bounding box. In the case of the racing game mentioned above, both the racing car and the speedway wall have a hit box surrounding them. If the x- and y-coordinates of the racing car's hit box overlap or match the x- and y-coordinates of the wall's hit box, then the game's programming registers a collision. As the character moves through the game, the size, shape, and coordinates of the hit box change. If the character is still, the hit box lies on top of the character. But as a character runs or moves, the hit box stays marginally behind it in order to account for lag. Lag is the delay between the action of the player and the reaction of the game's programming (or the server if the game is online). This makes a big difference in shooting games, when the player can shoot accurately at a character but doesn't score because the character has moved. To compensate for lag, the hit box trails spatially behind the character.

Bounding box
Figure 1. In this image, a bust of Athena is surrounded by a hit box or bounding box. (Wikipedia, 2011)

A hit box can be a simple rectangle that envelops the entire character, several boxes that surround the character's head, torso, or arms, or a complicated set of boxes or cylinders that closely follows the character's outline. A basic rectangular box means that the calculations that the game's programming performs to determine if a collision has occurred are simple. A complicated set of hit boxes or cylinders leads to complicated and time-consuming calculations. But the advantage that a complicated scheme of hit boxes has over a simple rectangle is that the collision is more realistic for the players.

In this computer and video game project, you will experiment with hit boxes and investigate how the size and placement of the hit box affects game score. You will use GameMaker, a free program that you can download from the Internet, to perform your experiment. You will use the engineering design process to build a simple video game that enables you to test the effect of varying the dimensions of the hit box.

Terms and Concepts

  • Hit box
  • Programming
  • Lag
  • Flowchart


  • What types of video games involve collision detection? Can you give specific examples of ones that do and do not?
  • Play a video game that involves collision detection. How do the hit boxes change over the time it takes to play the game?
  • What are some common types of hit boxes?


This page will help you get started with GameMaker and has links to lots of tutorials for beginners:

Materials and Equipment

  • Computer with Internet connection
  • GameMaker Lite. You can download the PC version for free from YoYo GameMaker for PC and the Mac version for free from YoYo GameMaker for Mac. Please note that at the time that this project was written, GameMaker worked better on PCs than on Macs.
  • Volunteer game players (10). Try to find game players who are all approximately the same age.
  • Lab notebook

Share your story with Science Buddies!

I did this project I Did This Project! Please log in and let us know how things went.

Experimental Procedure

Note: This engineering project is best described by the engineering design process, as opposed to the scientific method. You might want to ask your teacher whether it's acceptable to follow the engineering design process for your project before you begin. You can learn more about the engineering design process in the Science Buddies Engineering Design Process Guide.

Working with Human Test Subjects

There are special considerations when designing an experiment involving human subjects. Fairs affiliated with Intel International Science and Engineering Fair (ISEF) often require an Informed Consent Form (permission sheet) for every participant who is questioned. Consult the rules and regulations of the science fair that you are entering, prior to performing experiments or surveys. Please refer to the Science Buddies documents Projects Involving Human Subjects and Scientific Review Committee for additional important requirements. If you are working with minors, you must get advance permission from the children's parents or guardians (and teachers if you are performing the test while they are in school) to make sure that it is all right for the children to participate in the science fair project. Here are suggested guidelines for obtaining permission for working with minors:

  1. Write a clear description of your science fair project, what you are studying, and what you hope to learn. Include how the child will be tested. Include a paragraph where you get a parent's or guardian's and/or teacher's signature.
  2. Print out as many copies as you need for each child you will be surveying.
  3. Pass out the permission sheet to the children or to the teachers of the children to give to the parents. You must have permission for all the children in order to be able to use them as test subjects.

Programming the Test Game in GameMaker

  1. First, download the GameMaker Lite program from YoYo GameMaker for Mac or YoYo GameMaker for PC. Make sure that your computer's operating system fits the requirements for running GameMaker listed on the download page.
  2. Before you start your project, work through the first two beginner (level 1) tutorials listed in the Science Buddies GameMaker User Guide. These tutorials will walk you through the steps of making a video game with GameMaker. Even if you've never programmed before, you will be ready to build a simple program after completing the tutorials.
  3. Once you have completed the tutorials, practice with GameMaker so you feel comfortable with the programming environment.
  4. After practicing, it is time to start the project. In order to test your hit boxes, build a simple test game where one object collides with another several times. An example of a test game could be where you scatter an object several places in a room, and the goal is for the player to gather as many of the objects as possible in a set time. Another could be using a hook to "catch" as many fish as possible from the ocean in 10 seconds. In this example, both the hook and fish are sprites as described in the tutorials and the ocean is a room that you build.
  5. Follow the engineering design process to build your simple program. The following list will help you to focus your efforts. Remember, if you need assistance or are troubleshooting, the GameMaker User Guide will help you find resources.
    1. Define the problem. In this case, you will create a simple test game for the purpose of testing various hit boxes. Refer to the Science Buddies define the problem page to help you set the boundaries for the game.
    2. Do background research. Play some other video games and figure out techniques from these games that you can use in your own.
    3. Develop the project requirements. In this case, you are building a video game that helps you test the effects of differently sized hit boxes. Refer to the Science Buddies design requirements section to get tips on how to formulate your game's design requirements. Here are some ideas to consider:
      1. What kind of game should you build? The game should be engaging for the player.
      2. What kinds of sprites will you use and where will you get them?
      3. You need sprites that are big enough to easily change the size and position of the hit box.
      4. How will you control the time the player has to finish the game—with a timer incorporated in the game's programming or an outside timer that you control?
      5. How will you count the player's score?
    4. Create and analyze solutions. Keeping your project requirements in mind, think about different ways that you could build your game. Take a look at the Science Buddies document on creating alternative solutions to guide your efforts. Once you have developed a few solutions, analyze the solutions by making rough sketches and flowcharts for each one. Refer to the Science Buddies best solution document to help you pick a working solution.
    5. Build and test a sample video game. Once you have created a set of requirements and a possible solution, it is time to open GameMaker and start working on building a sample video game. Remember to review your requirements to keep focused on the task. Review the Science Buddies prototyping document.
    6. Program your video game. Keep testing each step of the game as you work. When you have fulfilled a requirement or task, run the game and test that requirement or task out.
      1. Break the game programming down into smaller tasks so that the project is not overwhelming.
      2. Fix small issues as they come up. This will prevent your having a long set of events at the end that don't work.
      3. Once you have finished programming your game, check to see that all of the project requirements are fulfilled.
    7. Test the game. Review the Science Buddies test and redesign document to help organize your work.

Hit Box Testing

  1. Now that your video game is built, it is time to start testing the effect of varying the size and position of the hit boxes.
  2. Based on the game example given above where the player is supposed to gather fish using a hook, there are many ways to explore the effect of hit box sizes. You will use the game score as a way to explore the effect of changing the hit boxes. First, you will change the size of the hit box for the fish, keeping the hook's hit box the same size, and then have your volunteers play the game. Then you will change the size of the hook's hit box before having the volunteers play the game. Finally, you will change the position of the hit box and have the volunteers play the game again.
  3. Before changing the hit box, direct each one of your players to play the game for the set time with all the default hit box sizes in place. The hit box size is modified on the sprites properties page. Don't modify anything yet, keeping GameMaker's assigned hit box, and just play the game as is. Record each player's score in your lab notebook in a table like the one shown below.

Player Score
Default Hit Box Size Hit Box Size 1 Hit Box Size 2 Hit Box Size 1
Hook Box Size 1
Hit Box Location 2

Table 1. Raw data for hit box variation tests

  1. Now change the size of the hit box for the fish. Click on the sprite that is "to be gathered" (or caught) to access the sprites properties page. There, go to the section devoted to controlling the bounding box (or hit box) for the sprite. Click on the manual option. This permits you to change the left, right, top, and bottom boundaries. Increase the left and top boundaries by 5 steps, and decrease the right and bottom boundaries by 5 steps. This changes the size of the hit box but keeps it centered at the same location as the default hit box. This is Hit Box Size 1. Save the changes.
  2. Ask the first player to come in, sit down, and play the game. After the set time is over, record the player's score in your lab notebook.
  3. Repeat step 5 for the additional players. Record all scores in your lab notebook.
  4. Repeat steps 4 through 6, changing the size of the hit box by 5 more steps at each boundary. This is Hit Box Size 2. Record all data in your lab notebook.
  5. Go back to Hit Box Size 1. Now modify the hit box size of the sprite that is doing the colliding (which, in the example above, is the hook sprite). Change each boundary of the hit box for the hook by 10 steps. This is Hook Box Size 1. Save the changes.
  6. Ask the first player to come in and play the game. After the set time is over, record the player's score in your lab notebook.
  7. Repeat step 9 for the additional players. Record all scores in your lab notebook.
  8. Now go back to the properties page of the first sprite—in the case of this example, the fish sprite's properties page. Click on the full image option and then on the manual option. Now change the position of the hit box by carefully varying the boundaries. When you are satisfied with the new position and size of the box, save the changes. This is the Hit Box Location 2.
  9. Now ask the first player to come back to the computer and play the game. Record the player's score in your lab notebook. After the player has finished, thank him or her for participating in the experiment.
  10. Repeat step 12 with the additional players. Record all scores in your lab notebook, and thank these players as well.

Analyzing Your Data

  1. Plot the data you gathered in the previous section on one graph. Label the x-axis Player and the y-axis Score. Make a line graph for each of the five conditions.
  2. Average the data by player for each of the five conditions. Record the data in a table like the one shown below.

Average Score
Default Hit Box Size Hit Box Size 1 Hit Box Size 2 Hit Box Size 1
Hook Box Size 1
Hit Box Location 2

Table 2. Average score data

  1. Based on the plot from step 1 and the data from Table 2, does varying the hit box affect the score? Which condition affects the score the most?

Share your story with Science Buddies!

I did this project I Did This Project! Please log in and let us know how things went.


  • Investigate the mask option in GameMaker to modify your hit boxes and improve the visual effect of the collision.
  • Some programming environments are easier than others in which to create certain game features. Try programming your video game in both GameMaker and Scratch (or another programming environment of your choice from the table of the Science Buddies resource Kid-Friendly Programming Languages. How do the two programs compare? Which programming environment made it easier to create hit boxes in? Why?
  • Some video games use visual effects to help a player know when they have, or have not, successfully come in contact with a hit box. What are some examples of such visual feedback in the games you play? Can you create and apply helpful visual effects for the hit boxes in your game?

Share your story with Science Buddies!

I did this project I Did This Project! Please log in and let us know how things went.

Ask an Expert

The Ask an Expert Forum is intended to be a place where students can go to find answers to science questions that they have been unable to find using other resources. If you have specific questions about your science fair project or science fair, our team of volunteer scientists can help. Our Experts won't do the work for you, but they will make suggestions, offer guidance, and help you troubleshoot.

Ask an Expert

Related Links

If you like this project, you might enjoy exploring these related careers:

NASA flight software engineer

Computer Software Engineer

Are you interested in developing cool video game software for computers? Would you like to learn how to make software run faster and more reliably on different kinds of computers and operating systems? Do you like to apply your computer science skills to solve problems? If so, then you might be interested in the career of a computer software engineer. Read more
artist drawing at computer

Multimedia Artist or Animator

If you've ever watched a cartoon, played a video game, or seen an animated movie, you've seen the work of multimedia artists and animators. People in these careers use computers to create the series of pictures that form the animated images or special effects seen in movies, television programs, and computer games. Read more
Computer programmer typing on a keyboard

Computer Programmer

Computers are essential tools in the modern world, handling everything from traffic control, car welding, movie animation, shipping, aircraft design, and social networking to book publishing, business management, music mixing, health care, agriculture, and online shopping. Computer programmers are the people who write the instructions that tell computers what to do. Read more

Looking for more science fun?

Try one of our science activities for quick, anytime science explorations. The perfect thing to liven up a rainy day, school vacation, or moment of boredom.

Find an Activity