stage.set_background("summer")
siili = codesters.Sprite("hedgehog", -170, -140)
kukka = codesters.Sprite("flower1", 170, -140)
koskettu = False
def left_key():
siili.move_left(20)
def right_key():
siili.move_right(20)
def collision(sprite, hit_sprite):
global koskettu
if(koskettu == False):
koskettu = True
kukkalista = ["flower2", "flower3", "flower4"]
hit_sprite.set_x_speed(5);
hit_sprite.set_y_speed(5);
sprite.say("Jee kukkia!!!")
for kukka in kukkalista:
lentokukka = codesters.Sprite(kukka, 200, -170)
lentokukka.set_x_speed(5);
lentokukka.set_y_speed(3);
stage.wait(1)
stage.event_key("right", right_key)
stage.event_key("left", left_key)
siili.event_collision(collision)
-
Run Code
-
-
Stop Running Code
-
Show Chart
-
Show Console
-
Codesters How To (opens in a new tab)