Posts

Showing posts from March, 2022

CATTERPILLAR GAME USING PYTHON

 SOURCE CODE FOR YOUR GAME > import turtle as t import random as rd t.bgcolor( 'yellow' )       caterpillar = t.Turtle() caterpillar.shape( 'square' ) caterpillar.color( 'red' ) caterpillar.speed( 0 ) caterpillar.penup() caterpillar.hideturtle() leaf = t.Turtle() leaf_shape = (( 0 , 0 ),( 14 , 2 ),( 18 , 6 ),( 20 , 20 ),( 6 , 18 ),( 2 , 14 )) t.register_shape( 'leaf' ,leaf_shape) leaf.shape( 'leaf' ) leaf.color( 'green' ) leaf.penup() leaf.hideturtle() leaf.speed() game_started = False text_turtle = t.Turtle() text_turtle.write( 'Press SPACE to start' , align = 'center' , font =( 'Arial' , 16 , 'bold' )) text_turtle.hideturtle() score_turtle = t.Turtle() score_turtle.hideturtle() score_turtle.speed( 0 ) def outside_window ():     left_wall = -t.window_width()/ 2     right_wall = t.window_width()/ 2     top_wall = t.window_height()/ 2     bottom_wall = -t.window_height()/ 2     (x,y) = caterpillar.po