Flapp' Shep
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This is a flappy bird clone made from the wolf sheep predation model. It's pretty much just a joke from biology class that went too far, haha.
HOW IT WORKS
The sheep's y coordinate is based on a "force" variable that constantly decreases, except when you jump, in which case force is set to a number controlled by "jump-height."
The pipes are spawned in on fixed intervals of ticks. As far as I know there's no way to hide things off screen in netLogo, so instead each column of the wolf pipes are spawned in separately.
Score is also counted on a timer.
The game ends when the sheep hits the ground. Control is taken away from you when you hit a wolf, so that'll end the game too.
HOW TO USE IT
First press setup to put everything in place. Then press go to start the game.
Press the 'x' key or just click the big button under the canvas to jump. That's all there is too it. Don't hit the pipes of wolves!
THINGS TO NOTICE
The pipes are actually just one long tower of wolves that wraps around the screen!
THINGS TO TRY
Toy around with some of the debug variables! It'll probably break the game, but it'll be fun! Points are pretty poorly programmed, so channging a lot of the variables desyncs the points :(
EXTENDING THE MODEL
Try changing the color of some of the assets in the game. Maybe chagne the pipe colors, or, uhh, fix the pipe speed system (whoops).
RELATED MODELS/REFERENCES
Take a look at the wolf-sheep predation model this game is based on!
Comments and Questions
globals [ max-sheep points gametick force alive pipeSliver pipey wolfPos] ; don't let the sheep population grow too large ; Sheep and wolves are both breeds of turtles breed [ sheep a-sheep ] ; sheep is its own plural, so we use "a-sheep" as the singular breed [ wolves wolf ] turtles-own [ energy flockmates ;; agentset of nearby turtles nearest-neighbor ;; closest one of our flockmates] ; both wolves and sheep have energy ] patches-own [ countdown ] ; this is for the sheep-wolves-grass model version to setup clear-all set points 0 set force 1 ;set spawnTime 70 * pipeSpeed set wolfPos 0.5 set alive true ifelse netlogo-web? [ set max-sheep 10000 ] [ set max-sheep 30000 ] ; Check model-version switch ; if we're not modeling grass, then the sheep don't need to eat to survive ; otherwise each grass' state of growth and growing logic need to be set up ask patches [ set pcolor brown if pycor < -13[ set pcolor green ] ] if theme [ ask patches [ set pcolor blue if pycor < -13[ set pcolor green ] ] ] create-sheep 1 ; create the sheep, then initialize their variables [ set shape "sheep" set color white if theme [ set color yellow ] set size sheepSize ; easier to see set label-color blue - 2 setxy -4 0 ] reset-ticks end to go set gametick true if force < -1 * maxForce [ set force -1 * maxForce ] if force > maxForce [ set force maxForce ] ask sheep [ if ycor < 16[ set ycor (ycor + force) ] if ycor >= 15.2 [ set ycor 15.2 ] if pcolor = green[ set force 0 set gametick false ] ] if gametick = false [ stop ] set force force - gravity if alive [ ask wolves[ eatsheep fd pipeSpeed if xcor <= -16 [ die ] ] if pipeSliver <= 5 [ if ticks mod 2 = 0 [ createTower set pipeSliver (1 + pipeSliver) ] ] if ticks mod spawnTime = 0 and ticks > 1[ set pipeSliver 0 set pipey int -4 + random-float 15 ] if (ticks - 10) mod spawnTime = 0 and ticks > spawnTime [ set points (points + 1) ] ] tick end to eatSheep let prey one-of sheep in-radius 2 if prey != nobody[ if alive = true [ set alive false ] set force 1 ] end to createTower let tempY int 0 ;;defining the amount of times sheep have been made if pipeSliver = 0 or pipeSliver = 5[ create-wolves 1 [ set shape "wolf" set color black if theme [ set color green set shape "square" ] set heading 270 set size 2 ; easier to see set label-color white - 2 setxy (16) (pipey + 1 + tempY) fd wolfPos ] repeat pipeLength [ set tempY (tempY + 1) ] create-wolves 1 [ set shape "wolf" set color black if theme [ set color green set shape "square" ] set heading 270 set size 2 ; easier to see set label-color white - 2 setxy (16) (pipey + tempY) fd wolfPos ] ] if pipeSliver > 0 and pipeSliver < 5 [ repeat pipeLength [create-wolves 1 ; create the sheep, then initialize their variables [ set shape "wolf" set color black if theme [ set color green set shape "square" ] set heading 270 set size 2 ; easier to see set label-color white - 2 setxy (16) (pipey + tempY + 1) fd wolfPos ] set tempY (tempY + 1) ] ] end to FLAP-YOUR-LITTLE-SHEEP-WINGS if alive [ ask sheep [if ycor < 16 [ set force jump-height ] ] ] end ;create-wolves initial-number-wolves ; create the wolves, then initialize their variables ;[ ; set shape "wolf" ; set color black ; set size 2 ; easier to see ; set energy random (2 * wolf-gain-from-food) ; setxy random-xcor random-ycor ;]
There are 3 versions of this model.
This model does not have any ancestors.
This model does not have any descendants.