110 likes | 220 Views
LO: We’re learning to understand when it is appropriate to use particular data types. . Learning Objective. Variables Known as a place holder to store values. Can be shown in a number of data types Constants
E N D
LO: We’re learning to understand when it is appropriate to use particular data types. Learning Objective
Variables Known as a place holder to store values. Can be shown in a number of data types Constants Constants are a little different to normal variables in that they cannot be modified. To add in a variable / constant using touch develop we click on: Variables / Constants….
Data Types…. What would you use them for?
One bit of information Only two outcomes – True or False Used for simple flags to track true or false conditions. Default value is false.
The board is the 2D engine which lets you create the game. You can move objects around on it according to gravity or friction. You can use the board to time elements. Without the board, you will find it difficult to move characters around your screen. Imagine it as your interface. Without setting up the board, you willnot be able to control the appears of yourgame.
We use Numbers because they help us later on in whatever job we will need our code to do. For instants, if we need to calculate numbers. It isn’t good trying to add text together, the program will give you an error. Number variables allow us to use onlynumbers whereas strings allow acombination of numbers and letters.
Sometimes it’s not good enough to just calculate things. We might need to name them. It is not possible to put a persons name inside a number variable. It will give us an error message. Strings allow us to use a combination of numbers and characters providing them they havebeen converted.
This data type is used to specify a date. Within Touch Develop you can call on specific functions such as just the time or the date. You can push buttons such as:
A Sprite is an object or set of objects which performs an action. If you have used scratch before, you will already understand this. Sprites can be programmed to carry out different activities. Most projects have at least one sprite.
Here is some mapping to videos which use some of these data types: Video 1 – Introduces height and width using the board and number data types. Video 2 – Sprite data types introduced. Video 7 – Uses strings in a list. Experiment with the data types and seewhat you can come up with. Useful Videos