Graphical programming, entertainment and teaching, Kittenblock scratch examples, sights, tracking mouse movements

I have talked to many students, many students are not hard, but just can not find the feeling. It is undeniable that the same class is taught in the same classroom, and the teaching effect is also very different. The key problem is that the sense of substitution, the advice I can give, is to gritt your teeth, hold on, and have no knowledge you cannot learn.

 

Will continue to share the experience of graphical programming, hoping to make a topic. If you find it useful, please give it a thumbs up. Interpretation of the program: sight, track mouse movement, when the mouse is pressed, the shape is switched, 0.3 seconds

Knowledge points: detection, selection, control, motion, modeling

Involved software: scratch3.0 (.sb3) , Python , Kittenblock .

 

# -*- coding: utf-8 -*-

import _env, time, random

from kblock import *

Character 1 = Sprite (" Character 1")

 

x = 0

 

 

                    # Loop Effects

while True:

  # Role following the mouse

  Character 1.motion_goto ("_ mouse_")

      #If you press the mouse, switch to the next shape, delay 0.3 seconds

  if role 1.sensing_mousedown ():

    Role 1.looks_nextcostume ()

    time.sleep(0.3)

Process diagram!

 

 

 

 

 

 

 

 

 

 

Programming thinking is a very logical thinking mode, which is beneficial to the growth of everyone. However, in the face of sentences, many students have difficulty switching their thinking mode to the state of computer programming. I think learning programming starts with reading the program. The biggest advantage of graphical programming is that we can switch our thinking between graphics and code.

Guess you like

Origin www.cnblogs.com/ztg1/p/12730282.html