Search Header Logo
Coding Lesson 1-7

Coding Lesson 1-7

Assessment

Presentation

Computers

7th Grade

Medium

Created by

Tiffaney Koontz

Used 8+ times

FREE Resource

10 Slides • 7 Questions

1

Coding Lesson 1-7

Review

Slide image

2

Creating Shapes

  • rectangle: rect(x, y, w, h)

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

  • x=distance to the right of the origin

  • y=distance down from the origin

  • w=width of the shape

  • h=height of the shape

Slide image

3

Fill in the Blank

How do you code a rectangle in Javascript?

4

Fill in the Blank

How do you code an ellipse in Javascript?

5

How to Create Other Shapes...

  • Polygons can be created by using multiple sets of coordinates.

  • For a triangle, it would look like this: (x1, y1, x2, y2, x3, y3) where each set represents a point on the coordinate grid.

Slide image

6

Fill in the Blank

What do the characters in parentheses mean when coding a polygon like this: shape(x1, y1, x2, y2, x3, y3)

7

Variables

  • You must create a variable to use it.

  • For example, to create the variable "school", we would first create it like this: var school

  • Then we need to give it a starting value. So we could add the two together into one step like this: var school = 100

  • Variables save storage space in our programs.

Slide image

8

Multiple Choice

What is the correct way to create a variable and declare its starting value?

1

var sandcreek = 10

2

var sandCreek = 10

3

var SandCreek = 10

4

var Sandcreek = 10

9

Random Numbers

  • Another way to add to a program is to create a random number.

  • To do this, you need to create this code: randomNumber (min, max)

  • The min is the minimum number that you want to be included.

  • The max is the maximum number that you want to be included.

Slide image

10

Multiple Choice

What do min and max mean in randomNumber(min, max)?

1

min means mini and max means maxi

2

min means minimum and max means maximum

3

min means minimum and max means max

4

min means min and max means maximum

11

Thickness of the border of an object.

  • To change the thickness of a border, you need to declare it.

  • To do this, you use the code: strokeWeight()

  • The parentheses will be filled with a number.

  • If you leave it blank, you will get no border.

Slide image

12

To fill in a shape with colors, do the following:

  • Use the code, fill(color).

  • Choose what color you want to have inside of it.

  • Place this code before the shape that you have created.

  • It will continue to use this color until you create a new fill(color).

Slide image

13

Other shapes...

  • point= point(x, y)

  • line= line(x1, y1, x2, y2) where these represent two sets of ordered pairs.

  • arc= arc(x, y, w, h, start, stop) The start and stop are the two angles within the arc.

  • 0 degrees=to the right

  • 90 degrees= down

  • 180 degrees= left

  • 270 degrees= up

Slide image

14

Other important information

  • If you do not want shapes filled in, use the code: nofill()

  • There are so many colors to choose from when you are creating your games.

  • Spend time learning the code.

  • You will be adding to these concepts.

  • You will use it for your summative.

  • You will be graded.

  • To choose colors: https://www.rapidtables.com/web/color/RGB_Color.html

Slide image

15

Sprites

  • A character on the screen with properties that describe its location, movement, and look.

  • Create them first:

  • var sprite = createSprite(x,y)

  • Property - A label for a characteristic of a sprite, such as its location and appearance.

  • To choose a different sprite, use this code:

  • sprite.setAnimation(label)

  • There are a lot to choose from in Game Lab.

Slide image

16

Multiple Select

Choose the correct descriptions of sprites.

1

You must create them first using "var sprite".

2

You can change the type of sprite with: sprite.setAnimation(label)

3

They have a location on the Game Lab screen.

4

They hold a lot of code inside them including location, movement, and look.

17

Poll

You will be graded on using this and other code when we get to our summative assessments, so it is important for you to learn it.

Yes

No

Coding Lesson 1-7

Review

Slide image

Show answer

Auto Play

Slide 1 / 17

SLIDE