Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ================================================================PIPE===============================================================
- patches-own [num oldcolor]
- to setup
- ca
- ask patches [
- set num 0
- ]
- end
- to move
- reset-ticks
- wait 0.1
- ask patches [
- set oldcolor pcolor
- ]
- ask patches with [pxcor < max-pxcor] [
- set pcolor [oldcolor] of patch (pxcor + 1) pycor
- ]
- tick
- end
- to line
- reset-ticks
- let x (random 20 - 6)
- ask patches [
- if ((pxcor > 10) and (pxcor < 15)) and ((pycor > -16) and ((pycor < x) and (pycor > (x - 5)))) [
- set pcolor white
- ]
- if pxcor = 14 [
- set num num + 1
- ]
- ]
- end
- to pipe
- repeat 10 [move]
- line
- end
- ================================================================BIRD=============================================================
- globals [jump? score]
- to setup
- ca
- cro 1
- ask turtles [
- setxy -10 0
- set size 5
- set shape "bird-norm"
- ]
- ask patches [
- if pycor = -16 [set pcolor green]
- ]
- end
- to flap
- set heading 0
- set shape "bird-norm"
- repeat 5 [
- fd 1
- wait 0.01]
- end
- to go
- set shape "bird-fall"
- set heading 180
- fd 1
- wait 0.1
- if mouse-down? and not jump? [flap]
- set jump? mouse-down?
- if (pycor = -14) or (pcolor = white) [
- ask patch 0 0 [
- set plabel "Game Over"
- ]
- ]
- end
- ==========================================================BIRD WITH [STOP]=======================================================
- globals [jump? score]
- to setup
- ca
- cro 1
- ask turtles [
- setxy -10 0
- set size 5
- set shape "bird-norm"
- ]
- ask patches [
- if pycor = -16 [set pcolor green]
- ]
- end
- to flap
- set heading 0
- set shape "bird-norm"
- repeat 5 [
- fd 1
- wait 0.01]
- end
- to go
- set shape "bird-fall"
- set heading 180
- fd 1
- wait 0.1
- if mouse-down? and not jump? [flap]
- set jump? mouse-down?
- if (pycor = -14) or (pcolor = white) [
- ask patch 0 0 [
- set plabel "Game Over"
- ]
- stop
- ]
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement