Data Types: Numbers

Objective

Students must use numeric data types to store and manipulate quantitative game data.

Evidence

Numeric data in game components:

  • Ghost.js - velocity.x and velocity.y for movement
  • GameLevelMaze.js - Position and scale calculations
  • Multiple classes - Health, score, damage values

Implementation Details

  • Integers for counts, indices, and whole values
  • Floating-point for positions, velocities, and physics
  • Arithmetic operations for calculations
  • Comparisons for game logic
  • Number properties and methods

Key Concepts

  • Integer vs floating-point precision
  • Number ranges and overflow
  • Mathematical operations (+, -, *, /, %, **)
  • Math object functions (Math.abs, Math.floor, Math.random, etc.)
  • Number validation and type checking