Presentation on theme: "Section 1 Introduction National 4/5 VB Course. What you should know after this lesson What is a program Who writes programs Why is sequence important."— Presentation transcript:
Section 1 Introduction National 4/5 VB Course
What you should know after this lesson What is a program Who writes programs Why is sequence important in programs
Programming A program is a list of instructions that tell the computer what to do. A programmer writes the programs A user uses the programs You will be both programmer and user in this topic.
What is VB Visual Basic (VB) is a programming language that derived from BASIC – a general purpose programming language for beginners. Beginners All Purpose Symbolic Instruction Code. It’s aim was to create code to solve general types of problems.
Getting Started – Sample Program Launch VB We want to try running a VB program. Drag the Sample folder from the PupilArea > Computing > Comp Science > VB folder into your VB folder From the folder double click Sample.vbp (icon with the red line) and press run ► Experiment with the program, what can it do?
Sample Program The sample program uses code to make objects visible/invisible Has a This is how we join the program blocks together, you can unsnap a single or bunch of blocks by dragging them.
Drawing If we keep double clicking on the blocks you should notice the cat moves in a circular fashion. Drag the “pen down” block from the pen tab, to the top of the program What happens when you keep double clicking it?
Drawing a square I don’t want to double click the block every time to draw a side of the square, I would rather double click it once and have it draw the square for me. How can I change the program to make this happen? Hint on next page
Drawing a Square
Tasks Create a program to draw a square. Copy the diagram from the previous slide into your jotter. Write the program to draw a square into your jotter.
Adding a new Sprite Sometimes it is nice to have more than one sprite on the screen. Get a new surprise sprite Write a program to draw a triangle using the new sprite. Hint: the angle is 120
All at once Wouldn’t be easier if there was a start button? Well there is go to the control tab and drag “when flag clicked” to the top of each of your sprite’s program. Now when you click on the flag (top right) your program will run
Review Question Write the question & answers in your jotter 1.What is a program? 2.Who writes programs? 3.Why is sequence important in programs?
Extension Tasks Modify your program to draw the following shapes 1.A hexagon 2.A pentagon 3.A circle 4.A star