AC Y11 DIGITAL TECHNOLOGY
  • Home
  • 11TGN Programming - MakeCode
    • MakeCode Skills1
    • MakeCode skills2
    • MakeCode US Assessment
    • MakeCode AS Assessment
  • 11COD Arcade.MakeCode
    • Coding Skills 1
    • Coding skills 2
    • Advanced Coding Skills
    • Design Game Assessment AS91878
    • Code Game Assessment AS91883

SPRITES
A sprite is a computer graphics term for a two-dimensional bitmap that is integrated into a larger scene, most often in a 2D video game. 

TASK
Complete the learning and activities on this webpage 
https://arcade.makecode.com/courses/csintro1/intro/sprites

Picture
Picture

VARIABLES
Variable Definition: a container used to store values in your code.
Variables are used extensively in code. Variables allow code to be written in a generic way, and allow for easier reuse of our code.


TASK - MATH VARIABLES
Learners click here for the Math variables webpage.
Try to complete tasks 1-5.

The INFO 
category in blocks contains a few variables (data properties) which we are allowed to update. These properties have to do with score, life, and time.

TASK - INFO VARIABLES

Learners click here for the Info variables webpage.
​Try to complete tasks 1-3.


Picture
Picture

SETTING A VARIABLE TO A VALUE
You may have noticed that when making a variable, there is usually (almost always) a SET command before the variable does anything. Using a SET command tells the program the variable exists and what type (number, text, or boolean) the variable is.

If you don't SET the variable (let firstNumber = 15; in JavaScript) there will most likely be an error message. The program cannot be run or executed until the message is fixed.

SETTING a variable to a value often happens at the beginning of a group of blocks.



LOWER CAMEL CASE
Lower Camel Case is a naming technique for variables, program names and other names the coder needs to use in their program.

For example ​lowerCamelCase could be a variable name. The first word begins with  a lower case letter and the other words in the name begin with an upper case letter.


Picture

CO-ORDINATE WALKER
We need to know the coordinates for the screen. 

TASK
​Complete task 1 and 2.

Open the Co-ordinate Walker task. 
The code has bugs you need to change it to get it working (see the image on the right).
You also need to adjust the values in the IF commands to get the red dot of the sprite in the four corners of the screen.
​What are the co-ordinates for the 4 corners of the screen?

​NOTE: The IF command is a new programming structure that's used in this program.

Picture
Picture

SPRITE MOTION AND EVENTS
Being able to move and control the movement of sprites in a game is important. 

TASK
Complete the tasks in this activity.
There are tasks 1-4.
​NOTE: in task 3 and 4 a FUNCTION structure is used for the first time. 

The image on the right-side is an example of how to get the image to flip and move when a button is pressed (Task 4).


Picture

FORMAT CODE (Right-click coding area)
Once you start getting more and more code the 'code area' can become messy and unorganised. By right-clicking on the code area you can choose the option 'Format Code'. Be careful not to delete all blocks.
​
TASK
Try Formatting your Code now.

Picture

SPRITE OVERLAP AND EVENTS 1
Once the sprites are moving, the next step is to detect when they interact with other objects. Overlap is the primary way in which we can make sprites interact with each other.

We can assign events to overlaps between sprites of different (or even the same) kind, , adding behaviors such as scoring points, destroying an object, starting an animation, and much more.

Picture

TASK
Complete the tasks 1-3 in this activity.
Remember to use camelCase e.g. 'otherSprite' when naming variables.

Picture
Picture

CODE COMMENTS (Right-click on code block)
Comments need to be added to the code to document what components of the program do. For Merit comments need  to explain 'What the code does (function)" and "The way it functions (behaviour)". Here are two images to explain.

Picture
Picture

TASK
Open 2 of your saved arcade makecode programs by importing them into the editor.
Add code comments the explain what the code does (function) and how the code works (behaviour).



THE ORDER (Or Sequence) OF CODE
The sequence of the block changes the way the code works. If the code breaks, a rule like not declaring a variable an error message is sent from the interpreter. If the code does not break a rule but is not logically correct (semantically) then it will not do what you want.

Sequential execution: all programming languages run from top to bottom, one block of code after the other.

TASK
In a program you have that works try changing the order of the code blocks and see what happens.

Proudly powered by Weebly