2D Game Design and Development 1 — Questions and Answers
Question 1: The purpose of adding a variable to your game is what?
- If you want to save data to utilize in the game later (Correct answer)
- If you want a list of the top ten things
- If you want an object in your game to move to a specified location
- If you want a message to show up
Correct answer: If you want to save data to utilize in the game later
Variables are fundamental programming constructs used to store data that can change during a program's execution. In game development, they are essential for holding dynamic information like player scores, health points, item counts, or character positions. This stored data can then be accessed, modified, and utilized by the game logic to influence gameplay and manage game states.
Question 2: An object's movement angle in your game can range from:
- 0 and 180 degrees
- 0 and 90 degrees
- 0 and 360 degrees (Correct answer)
- 180 and 360 degrees
Correct answer: 0 and 360 degrees
In most 2D game development environments, angles for object movement or rotation are typically represented in a full circle. This range from 0 to 360 degrees allows for specifying any direction an object can face or move within a 2D plane. 0 degrees usually represents a specific direction (e.g., right or up), and 360 degrees completes a full rotation back to that starting point.
Question 3: How are sprites and objects different from one another?
- An object has behavior, but a sprite is an image. (Correct answer)
- An object cannot have an event, but a sprite might have.
- An alarm can be used to produce a sprite.
- A sprite cannot be animated, whereas an object can.
Correct answer: An object has behavior, but a sprite is an image.
In game development, a sprite is primarily a visual asset, essentially an image or a sequence of images used for animation. An object, however, is a game entity that possesses properties, behaviors, and can interact with other elements in the game world. An object often uses a sprite for its visual representation but also includes code, events, and attributes that define its functionality.
Question 4: Initiating an alarm action involves:
- Initiating a quick action
- Establishing an instance
- Keeping time when playing a game
- The timer counting down until an alarm event occurs (Correct answer)
Correct answer: The timer counting down until an alarm event occurs
An alarm action in game development typically functions as a timer that, once initiated, counts down for a specified duration. When the timer reaches zero, it triggers a predefined 'alarm event.' This event then executes specific code or actions, allowing developers to schedule delayed actions, create timed effects, or manage recurring events within the game.
Question 5: The position of an object on the screen is indicated by its:
- Angle
- Parent
- Background
- X, Y Coordinate (Correct answer)
Correct answer: X, Y Coordinate
In a 2D game environment, the position of an object on the screen is universally defined by its X and Y coordinates. The X coordinate represents the horizontal position (left to right), and the Y coordinate represents the vertical position (up and down). Together, these two values precisely pinpoint an object's location within the game's two-dimensional space.
Question 6: Which action do you use to determine whether one object has come into contact with another?
- Step
- Collision (Correct answer)
- Keyboard
- Alarm
Correct answer: Collision
The 'Collision' event or action is specifically designed to detect when two or more game objects physically overlap or touch each other. This event is crucial for implementing interactions such as a player character hitting an enemy, a bullet striking a target, or an item being picked up. When a collision is detected, specific game logic can be triggered to handle the interaction.
Question 7: Which attribute would you choose if you wanted an object to be visible in the game?
- Visible (Correct answer)
- Accurate Collision Detection
- Zero Origin
- Opaque
Correct answer: Visible
The 'Visible' attribute or property directly controls whether an object's visual representation (its sprite or model) is rendered on the screen. If this attribute is set to true, the object will be drawn and seen by the player; if set to false, the object will exist in the game's logic but will not be visually displayed. This is essential for hiding or showing game elements as needed.
The purpose of adding a variable to your game is what?