SlideShare uma empresa Scribd logo
1 de 11
Microsoft® Small Basic Responding to Events Estimated time to complete this lesson: 1 hour
Responding to Events In this lesson, you will learn about: Creating interactive games in Small Basic that respond to events.
Fun with Shapes  And you also know that you can use these shapes, controls, and events collectively to create interactive games in Small Basic. Let’s see how… So far, you have learned to insert and animate various shapes in your Small Basic programs. You have also learned to use controls and keyboard and mouse events to include interactivity in your Small Basic program.
Make the Turtle Draw – The Game In this simple game, you tell the Turtle to draw unique shapes in the graphics window by defining the number of sides. Notice how you use the Turtle object to draw shapes and how you use mouse and keyboard events to choose the color and the number of sides.  The game demonstrates how the user can make the Turtle draw colorful, unique shapes by specifying a color and the number of sides.
Make the Turtle Draw – How to Play So how do you play this game? Steps to play the game: ,[object Object]
Next, you specify the number of sides, so you can define what the Turtle should draw.
When you click Submit, the Turtle starts drawing.,[object Object]
Bounce the Ball – The Game Let’s move to a complex game now. In this game, you keep a ball above the ground by using the mouse to click the ball to keep it afloat.  Notice how we use mouse events to keep the ball from touching the ground. The ball responds to mouse clicks and stays afloat. The objective of the game is to keep the ball afloat as long as possible.
Bounce the Ball – How to Play So how do you play this game? Steps to play the game: ,[object Object]
You click the ball to make it bounce up in the air.
You must keep the ball from touching the ground. To do so, keep clicking the ball.

Mais conteúdo relacionado

Mais procurados

2.2 turtle graphics
2.2   turtle graphics2.2   turtle graphics
2.2 turtle graphics
allenbailey
 
2.1 graphics window
2.1   graphics window2.1   graphics window
2.1 graphics window
allenbailey
 
Scratch Lesson 1 – Basics
Scratch Lesson 1 – BasicsScratch Lesson 1 – Basics
Scratch Lesson 1 – Basics
David Oromaner
 

Mais procurados (20)

An Intro to Scratch Programming for Parents
An Intro to Scratch Programming for ParentsAn Intro to Scratch Programming for Parents
An Intro to Scratch Programming for Parents
 
Computer Coding with Scratch: Lesson 2_primaryschoollessons
Computer Coding with Scratch: Lesson 2_primaryschoollessonsComputer Coding with Scratch: Lesson 2_primaryschoollessons
Computer Coding with Scratch: Lesson 2_primaryschoollessons
 
2.2 turtle graphics
2.2   turtle graphics2.2   turtle graphics
2.2 turtle graphics
 
3 Kodu
3 Kodu3 Kodu
3 Kodu
 
Scratch Animation
Scratch AnimationScratch Animation
Scratch Animation
 
Programming in scratch
Programming in scratchProgramming in scratch
Programming in scratch
 
Kodu
KoduKodu
Kodu
 
2.1 graphics window
2.1   graphics window2.1   graphics window
2.1 graphics window
 
Coding Basics with Scratch
Coding Basics with ScratchCoding Basics with Scratch
Coding Basics with Scratch
 
Intro to Dimension
Intro to DimensionIntro to Dimension
Intro to Dimension
 
Interactive Project - Production Reflection
Interactive Project - Production ReflectionInteractive Project - Production Reflection
Interactive Project - Production Reflection
 
Scratch programming introduction to game creation
Scratch programming  introduction to game creationScratch programming  introduction to game creation
Scratch programming introduction to game creation
 
Lasso tool
Lasso toolLasso tool
Lasso tool
 
Google sketch up
Google sketch upGoogle sketch up
Google sketch up
 
Scratch Lesson 1 – Basics
Scratch Lesson 1 – BasicsScratch Lesson 1 – Basics
Scratch Lesson 1 – Basics
 
learn sketchup (for the beginners)
learn sketchup (for the beginners)learn sketchup (for the beginners)
learn sketchup (for the beginners)
 
6. production reflection(2)
6. production reflection(2)6. production reflection(2)
6. production reflection(2)
 
Presentation q4
Presentation q4Presentation q4
Presentation q4
 
Sketchup modul
Sketchup modulSketchup modul
Sketchup modul
 
Scratch an Editing App
 Scratch  an Editing App  Scratch  an Editing App
Scratch an Editing App
 

Semelhante a 4.2 responding to events

Noughts and Crosses Design Information
Noughts and Crosses Design InformationNoughts and Crosses Design Information
Noughts and Crosses Design Information
Christopher Orchard
 
Scratch for kids syllabus for 5 hours by bibek pandit
Scratch for kids syllabus for 5 hours by bibek panditScratch for kids syllabus for 5 hours by bibek pandit
Scratch for kids syllabus for 5 hours by bibek pandit
BibekPandit2
 
3.4 events and interactivity
3.4   events and interactivity3.4   events and interactivity
3.4 events and interactivity
allenbailey
 
Galactic Wars XNA Game
Galactic Wars XNA GameGalactic Wars XNA Game
Galactic Wars XNA Game
Sohil Gupta
 

Semelhante a 4.2 responding to events (20)

Workflow
WorkflowWorkflow
Workflow
 
2d game engine workflow
2d game engine workflow2d game engine workflow
2d game engine workflow
 
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
 
Noughts and Crosses Design Information
Noughts and Crosses Design InformationNoughts and Crosses Design Information
Noughts and Crosses Design Information
 
Street runner final
Street runner finalStreet runner final
Street runner final
 
02 unity 3_d_part_1
02 unity 3_d_part_102 unity 3_d_part_1
02 unity 3_d_part_1
 
intern.pdf
intern.pdfintern.pdf
intern.pdf
 
Gamemaker lesson 1
Gamemaker lesson 1Gamemaker lesson 1
Gamemaker lesson 1
 
Unity - Building Your First Real-Time 3D Project - All Slides
Unity - Building Your First Real-Time 3D Project - All SlidesUnity - Building Your First Real-Time 3D Project - All Slides
Unity - Building Your First Real-Time 3D Project - All Slides
 
Scratch for kids syllabus for 5 hours by bibek pandit
Scratch for kids syllabus for 5 hours by bibek panditScratch for kids syllabus for 5 hours by bibek pandit
Scratch for kids syllabus for 5 hours by bibek pandit
 
Lesson-6-Fruit-Slicer.pptx
Lesson-6-Fruit-Slicer.pptxLesson-6-Fruit-Slicer.pptx
Lesson-6-Fruit-Slicer.pptx
 
3.4 events and interactivity
3.4   events and interactivity3.4   events and interactivity
3.4 events and interactivity
 
Galactic Wars XNA Game
Galactic Wars XNA GameGalactic Wars XNA Game
Galactic Wars XNA Game
 
Gamemaker work flow
Gamemaker work flowGamemaker work flow
Gamemaker work flow
 
Gamemaker work flow
Gamemaker work flowGamemaker work flow
Gamemaker work flow
 
Work Flow for 2D Game
Work Flow for 2D GameWork Flow for 2D Game
Work Flow for 2D Game
 
03 whack a-witch!
03 whack a-witch!03 whack a-witch!
03 whack a-witch!
 
Unity - Building your first real-time 3D project
Unity - Building your first real-time 3D projectUnity - Building your first real-time 3D project
Unity - Building your first real-time 3D project
 
How to start a simple animation.
How to start a simple animation.How to start a simple animation.
How to start a simple animation.
 
Gaming Outline
Gaming OutlineGaming Outline
Gaming Outline
 

Mais de allenbailey

5.1 sharing code
5.1   sharing code5.1   sharing code
5.1 sharing code
allenbailey
 
3.6 debugging aids
3.6   debugging aids3.6   debugging aids
3.6 debugging aids
allenbailey
 
3.5 the controls object
3.5   the controls object3.5   the controls object
3.5 the controls object
allenbailey
 
3.3 the math object
3.3   the math object3.3   the math object
3.3 the math object
allenbailey
 
3.2 stacks and arrays
3.2   stacks and arrays3.2   stacks and arrays
3.2 stacks and arrays
allenbailey
 
3.1 file input and output
3.1   file input and output3.1   file input and output
3.1 file input and output
allenbailey
 
2.6 flickr, image list, and network objects
2.6   flickr, image list, and network objects2.6   flickr, image list, and network objects
2.6 flickr, image list, and network objects
allenbailey
 
2.5 clock, desktop, and dictionary objects
2.5   clock, desktop, and dictionary objects2.5   clock, desktop, and dictionary objects
2.5 clock, desktop, and dictionary objects
allenbailey
 
2.4 sound, program, and text objects
2.4   sound, program, and text objects2.4   sound, program, and text objects
2.4 sound, program, and text objects
allenbailey
 
1.5 branching and subroutines
1.5   branching and subroutines1.5   branching and subroutines
1.5 branching and subroutines
allenbailey
 
1.4 conditions and loops
1.4   conditions and loops1.4   conditions and loops
1.4 conditions and loops
allenbailey
 
1.2 statements, properties, and operations
1.2   statements, properties, and operations1.2   statements, properties, and operations
1.2 statements, properties, and operations
allenbailey
 
1.1 introduction to small basic
1.1   introduction to small basic1.1   introduction to small basic
1.1 introduction to small basic
allenbailey
 

Mais de allenbailey (14)

5.1 sharing code
5.1   sharing code5.1   sharing code
5.1 sharing code
 
3.6 debugging aids
3.6   debugging aids3.6   debugging aids
3.6 debugging aids
 
3.5 the controls object
3.5   the controls object3.5   the controls object
3.5 the controls object
 
3.3 the math object
3.3   the math object3.3   the math object
3.3 the math object
 
3.2 stacks and arrays
3.2   stacks and arrays3.2   stacks and arrays
3.2 stacks and arrays
 
3.1 file input and output
3.1   file input and output3.1   file input and output
3.1 file input and output
 
2.6 flickr, image list, and network objects
2.6   flickr, image list, and network objects2.6   flickr, image list, and network objects
2.6 flickr, image list, and network objects
 
2.5 clock, desktop, and dictionary objects
2.5   clock, desktop, and dictionary objects2.5   clock, desktop, and dictionary objects
2.5 clock, desktop, and dictionary objects
 
2.4 sound, program, and text objects
2.4   sound, program, and text objects2.4   sound, program, and text objects
2.4 sound, program, and text objects
 
1.5 branching and subroutines
1.5   branching and subroutines1.5   branching and subroutines
1.5 branching and subroutines
 
1.4 conditions and loops
1.4   conditions and loops1.4   conditions and loops
1.4 conditions and loops
 
1.3 variables
1.3   variables1.3   variables
1.3 variables
 
1.2 statements, properties, and operations
1.2   statements, properties, and operations1.2   statements, properties, and operations
1.2 statements, properties, and operations
 
1.1 introduction to small basic
1.1   introduction to small basic1.1   introduction to small basic
1.1 introduction to small basic
 

Último

Haridwar Call Girls, 8699214473 Hot Girls Service Haridwar
Haridwar Call Girls, 8699214473 Hot Girls Service HaridwarHaridwar Call Girls, 8699214473 Hot Girls Service Haridwar
Haridwar Call Girls, 8699214473 Hot Girls Service Haridwar
ranekokila
 
Ghansoli Escorts Services 09167354423 Ghansoli Call Girls,Call Girls In Ghan...
Ghansoli Escorts Services 09167354423  Ghansoli Call Girls,Call Girls In Ghan...Ghansoli Escorts Services 09167354423  Ghansoli Call Girls,Call Girls In Ghan...
Ghansoli Escorts Services 09167354423 Ghansoli Call Girls,Call Girls In Ghan...
Priya Reddy
 
Dubai Call girls Service 0524076003 Call girls in Dubai
Dubai Call girls Service 0524076003 Call girls in DubaiDubai Call girls Service 0524076003 Call girls in Dubai
Dubai Call girls Service 0524076003 Call girls in Dubai
Monica Sydney
 
Deira Call girl agency 0567006274 Call girls in Deira
Deira Call girl agency 0567006274 Call girls in DeiraDeira Call girl agency 0567006274 Call girls in Deira
Deira Call girl agency 0567006274 Call girls in Deira
Monica Sydney
 

Último (20)

Haridwar Call Girls, 8699214473 Hot Girls Service Haridwar
Haridwar Call Girls, 8699214473 Hot Girls Service HaridwarHaridwar Call Girls, 8699214473 Hot Girls Service Haridwar
Haridwar Call Girls, 8699214473 Hot Girls Service Haridwar
 
Call Girls Bhubaneswar 9777949614 call me Independent Escort Service Bhubaneswar
Call Girls Bhubaneswar 9777949614 call me Independent Escort Service BhubaneswarCall Girls Bhubaneswar 9777949614 call me Independent Escort Service Bhubaneswar
Call Girls Bhubaneswar 9777949614 call me Independent Escort Service Bhubaneswar
 
Ghansoli Escorts Services 09167354423 Ghansoli Call Girls,Call Girls In Ghan...
Ghansoli Escorts Services 09167354423  Ghansoli Call Girls,Call Girls In Ghan...Ghansoli Escorts Services 09167354423  Ghansoli Call Girls,Call Girls In Ghan...
Ghansoli Escorts Services 09167354423 Ghansoli Call Girls,Call Girls In Ghan...
 
Deira call girls 0507330913 Call girls in Deira
Deira call girls 0507330913  Call girls in DeiraDeira call girls 0507330913  Call girls in Deira
Deira call girls 0507330913 Call girls in Deira
 
Hire 💕 8617370543 Auraiya Call Girls Service Call Girls Agency
Hire 💕 8617370543 Auraiya Call Girls Service Call Girls AgencyHire 💕 8617370543 Auraiya Call Girls Service Call Girls Agency
Hire 💕 8617370543 Auraiya Call Girls Service Call Girls Agency
 
Call Girls in Kollam - 9332606886 Our call girls are sure to provide you with...
Call Girls in Kollam - 9332606886 Our call girls are sure to provide you with...Call Girls in Kollam - 9332606886 Our call girls are sure to provide you with...
Call Girls in Kollam - 9332606886 Our call girls are sure to provide you with...
 
Dubai Call girls Service 0524076003 Call girls in Dubai
Dubai Call girls Service 0524076003 Call girls in DubaiDubai Call girls Service 0524076003 Call girls in Dubai
Dubai Call girls Service 0524076003 Call girls in Dubai
 
Call girls Service Bellary - 9332606886 Rs 3000 Free Pickup & Drop Services 2...
Call girls Service Bellary - 9332606886 Rs 3000 Free Pickup & Drop Services 2...Call girls Service Bellary - 9332606886 Rs 3000 Free Pickup & Drop Services 2...
Call girls Service Bellary - 9332606886 Rs 3000 Free Pickup & Drop Services 2...
 
Bhubaneswar🌹Call Girls Rasulgada ❤Komal 9777949614 💟 Full Trusted CALL GIRLS ...
Bhubaneswar🌹Call Girls Rasulgada ❤Komal 9777949614 💟 Full Trusted CALL GIRLS ...Bhubaneswar🌹Call Girls Rasulgada ❤Komal 9777949614 💟 Full Trusted CALL GIRLS ...
Bhubaneswar🌹Call Girls Rasulgada ❤Komal 9777949614 💟 Full Trusted CALL GIRLS ...
 
Hire 💕 8617370543 Kushinagar Call Girls Service Call Girls Agency
Hire 💕 8617370543 Kushinagar Call Girls Service Call Girls AgencyHire 💕 8617370543 Kushinagar Call Girls Service Call Girls Agency
Hire 💕 8617370543 Kushinagar Call Girls Service Call Girls Agency
 
Deira Call girl agency 0567006274 Call girls in Deira
Deira Call girl agency 0567006274 Call girls in DeiraDeira Call girl agency 0567006274 Call girls in Deira
Deira Call girl agency 0567006274 Call girls in Deira
 
Bhubaneswar🌹Patia ❤CALL GIRLS 9777949614 💟 CALL GIRLS IN bhubaneswar ESCORT S...
Bhubaneswar🌹Patia ❤CALL GIRLS 9777949614 💟 CALL GIRLS IN bhubaneswar ESCORT S...Bhubaneswar🌹Patia ❤CALL GIRLS 9777949614 💟 CALL GIRLS IN bhubaneswar ESCORT S...
Bhubaneswar🌹Patia ❤CALL GIRLS 9777949614 💟 CALL GIRLS IN bhubaneswar ESCORT S...
 
Banda call girls 📞 8617370543At Low Cost Cash Payment Booking
Banda call girls 📞 8617370543At Low Cost Cash Payment BookingBanda call girls 📞 8617370543At Low Cost Cash Payment Booking
Banda call girls 📞 8617370543At Low Cost Cash Payment Booking
 
Call girls Service Berhampur - 9332606886 Our call girls are sure to provide ...
Call girls Service Berhampur - 9332606886 Our call girls are sure to provide ...Call girls Service Berhampur - 9332606886 Our call girls are sure to provide ...
Call girls Service Berhampur - 9332606886 Our call girls are sure to provide ...
 
Deira Call girls 0507330913 Call girls in Deira
Deira Call girls 0507330913 Call girls in DeiraDeira Call girls 0507330913 Call girls in Deira
Deira Call girls 0507330913 Call girls in Deira
 
Hire 💕 8617370543 Mirzapur Call Girls Service Call Girls Agency
Hire 💕 8617370543 Mirzapur Call Girls Service Call Girls AgencyHire 💕 8617370543 Mirzapur Call Girls Service Call Girls Agency
Hire 💕 8617370543 Mirzapur Call Girls Service Call Girls Agency
 
Badshah Nagar ] Call Girls Service Lucknow | Starting ₹,5K To @25k with A/C 9...
Badshah Nagar ] Call Girls Service Lucknow | Starting ₹,5K To @25k with A/C 9...Badshah Nagar ] Call Girls Service Lucknow | Starting ₹,5K To @25k with A/C 9...
Badshah Nagar ] Call Girls Service Lucknow | Starting ₹,5K To @25k with A/C 9...
 
Kailashahar Call Girl Whatsapp Number 📞 8617370543 | Girls Number for Friend...
Kailashahar  Call Girl Whatsapp Number 📞 8617370543 | Girls Number for Friend...Kailashahar  Call Girl Whatsapp Number 📞 8617370543 | Girls Number for Friend...
Kailashahar Call Girl Whatsapp Number 📞 8617370543 | Girls Number for Friend...
 
Call Girls In Gandhinagar 📞 8617370543 At Low Cost Cash Payment Booking
Call Girls In Gandhinagar 📞 8617370543  At Low Cost Cash Payment BookingCall Girls In Gandhinagar 📞 8617370543  At Low Cost Cash Payment Booking
Call Girls In Gandhinagar 📞 8617370543 At Low Cost Cash Payment Booking
 
🌹Bhubaneswar🌹Ravi Tailkes ❤CALL GIRL 9777949614 ❤CALL GIRLS IN bhubaneswar E...
🌹Bhubaneswar🌹Ravi Tailkes  ❤CALL GIRL 9777949614 ❤CALL GIRLS IN bhubaneswar E...🌹Bhubaneswar🌹Ravi Tailkes  ❤CALL GIRL 9777949614 ❤CALL GIRLS IN bhubaneswar E...
🌹Bhubaneswar🌹Ravi Tailkes ❤CALL GIRL 9777949614 ❤CALL GIRLS IN bhubaneswar E...
 

4.2 responding to events

  • 1. Microsoft® Small Basic Responding to Events Estimated time to complete this lesson: 1 hour
  • 2. Responding to Events In this lesson, you will learn about: Creating interactive games in Small Basic that respond to events.
  • 3. Fun with Shapes And you also know that you can use these shapes, controls, and events collectively to create interactive games in Small Basic. Let’s see how… So far, you have learned to insert and animate various shapes in your Small Basic programs. You have also learned to use controls and keyboard and mouse events to include interactivity in your Small Basic program.
  • 4. Make the Turtle Draw – The Game In this simple game, you tell the Turtle to draw unique shapes in the graphics window by defining the number of sides. Notice how you use the Turtle object to draw shapes and how you use mouse and keyboard events to choose the color and the number of sides. The game demonstrates how the user can make the Turtle draw colorful, unique shapes by specifying a color and the number of sides.
  • 5.
  • 6. Next, you specify the number of sides, so you can define what the Turtle should draw.
  • 7.
  • 8. Bounce the Ball – The Game Let’s move to a complex game now. In this game, you keep a ball above the ground by using the mouse to click the ball to keep it afloat. Notice how we use mouse events to keep the ball from touching the ground. The ball responds to mouse clicks and stays afloat. The objective of the game is to keep the ball afloat as long as possible.
  • 9.
  • 10. You click the ball to make it bounce up in the air.
  • 11. You must keep the ball from touching the ground. To do so, keep clicking the ball.
  • 12.
  • 13. Let’s Summarize… Congratulations! Now you know how to: Create interactive games in Small Basic that respond to events.
  • 14.
  • 15. Create a series of statements to be displayed on the screen.
  • 16. For any statement, the user will click True or False.
  • 17. The user scores points by guessing correctly.

Notas do Editor

  1. Solution:' Copyright (c) Microsoft Corporation. All rights reserved.GraphicsWindow.Hide()gw = 500gh = 350scoreBoxLeft = 200passedQuestion = 0score = 0Clicked = ""i = 1Q[1] = "Nile is the longest river in the world."Q[2] = "The highest mountain in the world is Mount Everest."Q[3] = "Zambia is also known as the 'Country of Copper'."Q[4] = "The coldest place on the earth is in Siberia."Q[5] = "Sydney is the capital of the USA."Q[6] = "The river Jordan flows out into the Dead sea."Q[7] = "Mumbai is the capital of India."Q[8] = "Africa is the largest coffee growing continent in the world."Q[9] = "The largest desert in the world is Sahara Desert."Q[10] = "London is the capital of the UK."A[1] = "True"A[2] = "True"A[3] = "True"A[4] = "True"A[5] = "False"A[6] = "True"A[7] = "False"A[8] = "False"A[9] = "True"A[10] = "True"ArrayRandom[1] = "5234162"ArrayRandom[2] = "1896523"ArrayRandom[3] = "5974216"ArrayRandom[4] = "2756194"randomNumber = Math.GetRandomNumber(Array.GetItemCount(ArrayRandom))GraphicsWindow.CanResize = "False"GraphicsWindow.Width = gwGraphicsWindow.Height = ghGraphicsWindow.Top = (Desktop.Height - gh) / 2GraphicsWindow.Left = (Desktop.Width - gw) / 2GraphicsWindow.Title = "True or False"GraphicsWindow.Show()Controls.ButtonClicked = OnButtonClickedCreateUI()Sub CreateUIGraphicsWindow.BrushColor = "Purple"GraphicsWindow.FontName = "Verdana"GraphicsWindow.FontSize = 14GraphicsWindow.DrawRectangle(10, 10, 480, 330) trueButton = Controls.AddButton("True", 30, 210) falseButton = Controls.AddButton("False", 320, 210) Controls.SetSize(trueButton, 150, 100)Controls.SetSize(falseButton, 150, 100)GraphicsWindow.DrawText(220, 300, "Result")resultTextBox = Shapes.AddText("")Shapes.Move(resultTextBox, 220, 250)scoreTextBox = Shapes.AddText("Score: 0")Shapes.Move(scoreTextBox, 404, 15)StartGame() EndSubSub StartGamepassedQuestion = Text.GetSubText(ArrayRandom[randomNumber], i, 1) If i <= 7 Thenqx = 60qy = 90 GraphicsWindow.BrushColor = "LightBlue"GraphicsWindow.FillRectangle(200, 220, 100, 80) GraphicsWindow.FillRectangle(20, 50, 460, 100) GraphicsWindow.BrushColor = "Blue"GraphicsWindow.DrawBoundText(qx - 20, qy, 420 "" + Q[passedQuestion])currentAnswer = A[passedQuestion]Else Program.Delay(1000)GraphicsWindow.ShowMessage("Your Score is " + score, "Game Over")Program.End()EndIfi = i + 1EndSubSub OnButtonClickedclickedButtonCaption = Controls.GetButtonCaption(Controls.LastClickedButton)If currentAnswer = clickedButtonCaption Then lastAnswer = "Correct"Shapes.Move(resultTextBox, 220, 250) score = score + 1ElselastAnswer = "Incorrect"Shapes.Move(resultTextBox, 212, 250)EndIfShapes.SetText(resultTextBox, lastAnswer) Shapes.SetText(scoreTextBox, "Score: " + score)StartGame()EndSub