CF II

3rd 9 Weeks Study Guide 2025

Instructor Name: Julie Lawson

Plotting Shapes on the Screen

Shapes are plotted using a system of coordinates that are fundamental to graphic programming:

  • X and Y coordinates: These coordinates allow the positioning of shapes on a two-dimensional screen. The X-axis is horizontal, while the Y-axis is vertical.

  • Other methods include:

    • Alphabet letters: Used in some programming environments to denote points or functions.

    • Touch screens: Enables users to interact directly with the shapes by tapping.

    • Width and height values: These specify the dimensions of the shapes being created.

X and Y Values Explained
  • X value: Represents the distance from the left edge of the screen, determining how far right the shape is plotted.

  • Y value: Represents the distance from the top of the screen, determining how far down the shape is plotted.

Origin of Shapes

Understanding the origin point is crucial for accurate drawing:

  • Square or Rectangle Origin: Shapes' origins are typically at the top left corner of the shape.

  • Circle or Ellipse Origin: Shapes like circles or ellipses have their origin at the center, which affects how they are rendered on the screen.

Code Syntax and Shape Definitions

  • In code: rect(250, 100);

    • The Y value is set to 100, indicating the vertical position on the screen.

  • In code: rect(250, 250, 100, 50);

    • The values 100 and 50 represent the Width (w) and Height (h) of the rectangle, respectively.

Rectangle Function

The foundational function for drawing rectangles:`

  • Function signature: rect(x, y, w, h);

    • W = Width of the rectangle.

    • H = Height of the rectangle.

Background Color

  • Code: background("red");

    • This code changes the background color of the canvas to red, which can aid visibility when plotting shapes above it.

Fill Command

  • Fill Command: It changes the color of the shapes coded beneath it, which is essential for creating visually distinct graphics.

Random Number Generation

  • The randomNumber line of code allows you to pick a random integer from a defined set.

    • This can be used to replace a single value, such as a Y value, allowing for dynamic and unpredictable positioning of shapes.

Variables and Assignments

  • Code: var hello = 100

    • This code declares a variable named hello and assigns it an initial value of 100. This can be used for various purposes, including tracking sprite positions or state.

Drawing Ellipses

  • Code: ellipse(x, y, w, h):

    • This function draws an ellipse centered at coordinates x and y, fitting it within a rectangle specified by the width w and height h.

Sprite Properties and Commands

  • Changing Size: The sprite.scale property allows you to shrink or enlarge a sprite while maintaining its height-to-width ratio, essential for ensuring sprites do not stretch disproportionately.

  • Display Sprites: The drawSprites() command displays all sprites on the screen; if used without parameters, it will draw all sprites regardless of specific conditions.

Debugging

  • Debugging: Refers to the techniques used to identify and fix issues within an algorithm or a program, critical for ensuring smooth operation and performance.

Animation and Movement

  • Animation: Refers to the technique of displaying a series of images rapidly to create the illusion of motion, fundamental to game design and visual applications.

  • End of Line in Code: In programming, the semicolon (;) indicates the end of a line of code, which is necessary for the proper syntax.

  • Example: In rect(250,200,75,225);:

    • The X value on this rectangle is set to 250, which identifies its left edge position.

  • Sprite Movement: In the expression bee.y = bee.y + 2;, this line of code means that the sprite "bee" is programmed to move downward by 2 units each time it is executed, simulating downward motion.

Sprite Actions

To maneuver sprites effectively:

  • To move from left to right: Change the property sprite.x, which represents the horizontal position.

  • To create a rotational effect: Change the property sprite.rotation, allowing sprites to turn in place, which can enhance visual engagement.

Secure Passwords

Understanding password security is crucial in today’s digital landscape:

  • A secure password does NOT include common phrases or easily guessable information.

  • Actions contributing to online recommendations include:

    • Rating movies: Helping platforms understand your preferences.

    • Searching for items: Indicates interests and informs future recommendations.

    • Purchasing items: Direct engagement with services further refines personalized suggestions.

Online Recommendation Engine

  • These are software algorithms that utilize past user data to suggest relevant content, enhancing user experience and engagement by tailoring results based on behavior.

Variables and Their Changes

  • When an independent variable changes (e.g., user input), the dependent variable may also change in response, illustrating the important cause-and-effect nature of programming logic.

Key Concepts in Game Design

  • Game design refers to a network of physical devices that utilize:

    • Sensors: To detect user input.

    • Software: Programs that manage game logic and user interaction.

    • Connectivity: For data sharing between devices.

  • Skills integral to game design include:

    • Writing: To develop narratives and dialogue.

    • Artistic Visualization: To create engaging visual experiences.

    • Project Management: To ensure effective teamwork and project delivery.

  • Recommended Password Length: At least 8 characters is advised for security purposes.

X and Y Coordinates Explained

  • X-axis: Represents horizontal movement (left and right).

  • Y-axis: Represents vertical movement (up and down).

Architecture & Construction

  • Purpose: The sector focuses on building and maintaining structures such as:

    • Homes: Residential properties.

    • Manufacturing Facilities: Industrial buildings designed for production processes.

Business Administration, Health Sciences, Hospitality & Tourism

  • Business Administration: Encompasses planning, organizing, and directing business functions to improve efficiency and profitability.

  • Health Sciences: Involves the treatment and care of patients facing illness or injury, highlighting the importance of medical practitioners and support staff.

  • Hospitality & Tourism: Focuses on the management, marketing, and operational aspects of the food and travel service industries, essential for delivering quality customer experiences.